Introduction: RC Cannon
This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com)
Step 1: What You Will Need
Body components:
-2 wheels (3d printed or however you wish to design them)
-Chassis-Preferably made of something that can be easily shaped, i.e drilled, laser cut etc. This is because we will have a lot of wiring and thus will need to create ports in the chassis to wire the cannons electrical components.
Electrical Components:
-Arduino Uno board
-Ir Remote
-Ir sensor
-Dc stepper/speed motors
-Lots of wiring and jump cables
-V.2 board (not required but makes connections alot more organized and easier to run)
-12v batteries and battery pack (power supply)
-L298 motor driver
Step 2: Assembling the Cannon- Electrical Build
Connect the DC speed motors to the L298 motor driver.
-Run individual wires from the Dc speed/stepper motor and plug them into the ports of the L298 module. This is the component that will drive the motors.
Step 3: Connect the Ir Sensor to the V5 Board
Connect the Ir sensor to the V5 Board. This is part that will allow the user to control the car via Ir remote. This is done by simply plugging in the cable from the IR sensor to the port that says "Ir sensor"
Step 4: Set V5 Board Onto Arduino Uno
-This is the great part about using the V5 board, it makes these connections easy. It is designed to "bag-pack" onto the Arduino Uno and thus saves a lot of wiring and makes the connections look neat. Be sure to set your pins in the right accordance, i.e. (GND to ground port, analog to analog etc) this is to avoid bending or damaging ports.
Step 5: Connect Power Supply to the Arduino Board.
By using a battery pack for this also, it makes this element also save on lots of wiring and appears a bit more elegant. Highly recommended. These battery packs which are often inexpensive, also come with its own independent on and off switch. Simply connect the power outlet (make sure to get a port compatible with the arduino) to the arduino.
Step 6: Overall Circuit Layout
Here is whats going on under the hood.
-The speed motors driven by the L298
-The Ir sensor connected to the V5 board .
-A 12v power supply
- All electrical components are powered/ grounded using a grounding rail as needed.
Step 7: Code and Working Principle
The cannon is basically fully operated via Ir remote control and will be the main focus for programming purposes. The Ir control system consists of sending and receiving information. The sending is done from the remote and the receiving is done by the Ir sensor. Ir remotes send signals via a binary pulse code, like many other everyday instruments. In order not to confuse the sensor and avoid picking up the wrong pulse code, it is common practice to modulate it at a given carrier frequency which the sensor can then filter and receive as a unique command.
Step 8: Including the IR Library
-there are many ir libraries online that could be included into the arduino sketch in order to facilitate the programming of the ir remote. These could be found e.g at
After downloading the library, include it into your initial sketch , (see image above).
There is also "example sketches" in the program, one of which is for an Ir system. This would also be a great starting point. (see above image)
Included is also a liquid crystal file with some library properties.
Attachments
Step 9: Program the Keys You Wish to Use.
The cannon goes forward, backward and aims left and right. So we would need keys to carry out these operations. We could accomplish the task of assigning keys to do specific things by making use of their unique key value. We could then assign these key values to have specific functions by use of the #define function.
e.g
#include
#define F 16736925
#define B 16754775
where "F" would be the variable associated with going forward and the digit next to it, the unique key value to do this task.
Setting particular components to "high" or "low" will carry out particular goals. e.g. In our code if we wish to have the cannon go forward we would set the output pins on the dc motor to high, causing the car to move. A full sketch of all this will be provided at the end.
Step 10: Finish Up the Code and Get Moving!
-If you are unfamiliar with coding, have no fear, there are many codes and examples online that you could follow to get your cannon moving. Here is my final code for this cannon, it was sampled from www.elegoo.com and adjusted to suit the criteria for aiming the cannon.
Attachments
Step 11: Upload Your Code and Test It Out.
If all went well, you should be able to have your cannon moving. Be sure to remember to charge batteries and turn switch on. Also, do not run cannon while plugged into the computer. This could be hazardous for some of the sensitive parts in your build.
Goodluck!