Introduction: RC Truck With Electromagnetic Accelerator Turret

There are many different types of RC cars on the market today, that come in all different price ranges and can do all kinds of different things. In this instructable, I will not only be showing you how to build an RC military truck kit that I recieved in the mail, but how to build your own DC motor controller that utilizes an arduino and is compatable with most RF PWM recievers. This setup has the added benefit of being able to control the car with a remote and being able to switch between manual and autonomous mode at the click of a button. Just for fun, I will also be adding an electromagnetic accelerator turret (coilgun)* to the car so it can remotely shoot ferrous projectiles at the click of a switch.

You can watch the video below for a demonstration of this car working along with a visual and verbal explanation of how to build it.

Lets get started!!!!

*The coilgun in this instructable utilizes a 400v 360uF capacitor bank, which does not deliver enough power to do any harm to any human*

Step 1: Gathering Materials

For this project, you will need a wide variety of different materials.

The most important thing that you will need for an RC car project is of course the RC car! Haha! Though you can use almost any RC truck or car kits, I chose to use the military truck by Banggood, the link is right here:

You will also need to use a remote controller, I chose to use the Flysky I6 RC plane controller because it had the necessary amount of channels to support my needs. The link is here:

You will also need to obtain these other parts:

⦁ Arduino uno(Or other type)

⦁ Wiring(All Kinds!!!)

⦁ 2-3 Cell lipo battery

⦁ L298N H bridge Motor controller

⦁ 400v 120uF Capacitors ⦁ 2.4gHz RF reciever

⦁ Silicon Controlled Rectifier(SCR)

⦁ Glue

⦁ Tape

⦁ 9Gram Servos

⦁ Ballpoint pen tube

⦁ 26 Gauge Enamled copper wire

Step 2: Building the Truck Part 1

Allright, it is time to build the RC car kit. If you are buying the kit that I mentioned above, then you should continue reading as normal. If not, then you can skip the next step as it will not be useful to you. You can modify any RC car for this project, even down to the 10 dollar Walmart special one. Now that we got that out of the way, you can unpack your car kit and lets get building.

The pictures above are the instruction manual for this particular kit, so if your kit did not come with instructions, here you go! This will also help you understand how to build the car. I made the mistake of thinking that I could build this car without instructions, and made a few errors that forced me to take everything apart that I had just built! Take it from me, read the instructions;)

Step 3: Building the Truck Part 2

To build the truck, you will need to first take all of the parts out of their respective bags. Then lay them all out on a flat surface that is not carpet(Again, one of the mistakes I made) so you can easily see everything. You will first need to start building the car by finding the two long metal rails. These will form the foundation for everything else. Then, follow the instructions to add the plastic bits to connect the metal rails together in parallel. You can then add more plastic bits to the connected metal rails so you will be able to mount the wheels, bed, and cab. Before you add any of the fance stuff like the cab, you will need to build and install the drive train.

This truck kit is unique because it has suspension and a 4 wheel drive train. It also has "differentials" that connect the wheels to the drive shaft which goes to the motor. You will need to put together the drive train system by first screwing in the electric motor, and then putting together the two differentials. Make sure that you add plenty of the included grease into the gearboxes. One thing that the instructions do not tell you, is to make sure that the drive rod is coming out of the correct side of the gearbox when the wheels are mounted. I made the mistake of putting it on the wrong side and my wheels turned the opposite directions, almost ruining the drive train!! After the drive train is installed, I added all of the other things including the 9 gram servo, bed, and cab. Now that the truck kit is built, it is time to build the electronics!

Step 4: Interfacing the RF Reciever With the Arduino

It is interesting, the kit that I recieved did not come with any kind of control system, or any electronics for that matter. I looked around for some small cheap DC motor ESC's, but could not find any that would be suitable for the small motor and PWM input from a remote control RF reciever. To solve this problem, I decided to use the cheap L298N motor controller board that is meant to be used with arduino. I wanted to use this board by connecting it straight to the RF reciever that could be plugged in to other ESCs and servos, but that did not work.

This is due to the nature of PWM signals. The servo control signal gives pulses between 1000 and 2000 uS, which make up a very small duty cycle of 20-25% while the L298N needs an input duty cycle of 0-100%. It also needs directional control inputs! To solve these issues, I resorted to using an arduino micro-controller. This would allow me to control the full range of motor speeds while also having the ability to control various GPIO pins of the arduino using the switches of channel's 5 and 6 of the remote. I then have the ability to have a forward and reverse switch on the controller that can control car direction and coil-gun firing. This also gives me the future ability to switch to autonomous mode in the car by adding some code. To interface the RF receiver to the arduino, I first needed to connect the RF receiver to the arduino. I wired up 5 volts and ground(duh) and connected three PWM output pins of the RF receiver to 3 digital input pins of the arduino. By writing some code that utilizes the pulseIn function, a function that measures the time a pulse takes when it is applied to a digital pin, we can get a value of approximately 1000-2000uS based on the position of the remote control sticks. You can now do whatever you want with these numbers for any project. The more PWM inputs you have, the more lag you will have in your system, there is no noticeable lag for 3 PWM inputs though.

Awesome, you can now understand some important electronics stuff! Now lets put it into practice.

Step 5: Building the DC Motor Control System

The DC motor control system consists of an arduino, L298N H bridge driver, and RF reciever. I built it all on a piece of cardboard that can be mounted in the bed of the RC truck. The RF reciever is taped to the top of the ATMEGA chip in the arduino and is situated next to the h-bridge on the piece of cardboard. The entire thing is glued to the base of the truck. This is a pretty bulky setup, but it could be reduced in size using an integrated H--bridge and an AtTiny arduino chip.

Now to the wiring, you will need to take a wire that goes to your power supply, which is a battery, and connect it to the 12 volt input on the L298N board and ground. The ground will be common for everything. The h-bridge will have an integrated switching converter that will step the 12 volts down to 5 volts for all the logic level circuitry. You can connect this 5 volts output to the arduino 5 volt pin and the power pin of the RF receiver. Also, make sure that you connect the motor to the output of the motor controller. To wire up the logic signals, you will need to connect the channel 6 PWM output to pin 7 of the arduino, channel 5 to pin 6, and channel 3 to pin 5. This wiring configuration may change based off your code. Then, connect the direction pins of the h-bridge to pins 8 and 9 on the arduino and the enable pin to arduino pin 10. Lastly, run a wire from pin 11 to where you will have your coil-gun at, because that is the fire pin.

One thing that I forgot to mention: you will need to wire up the drive servo of the RC car to a channel of the RF receiver. This is pretty easy because it is basically plug and play. The channels that different things are connected to can change and are based off personal user control preference.

Step 6: The Coilgun Capacitor Bank

Here is the fun part, High Voltage!! This is a dangerous amount of voltage, so be careful. I probably am legally obligated to tell you not to build this part becuase it contains dangerous voltages, so don't try this at home kids ;) All jokes aside, if you really have no experience with high voltage, talk to somebody who does and get there help. I have been working with this type of voltage for a while as I build tube amps and repair tube radios, so I have experience. With this out of the way, lets build this capacitor bank!

A coilgun is a device that uses a coil of wire around a barrel of wire to accelerate a projectile. When a ferrous object is placed in the back of the tube and a pulse of high voltage and high current is applied to the coil, an electromagnetic feild forms. This feild accelerates the projectile to the middle of the coil. By the time it reaches the middle, it has already gained some momentum. When the feild collapses, the projectile keeps accelerating out the barrel. We need some large capacitors to store the charge required to power this gun. I will be using 3 120uF 400V caps for a total of 360uF. I soldered these three caps together in parallel and glued them to the back of the bed. To charge these caps, you could add a high voltage power supply to the truck that is controlled by the arduino, but I was too lazy to build that. I use my 400 volt power supply that I built a while back to test vacuum tube circuits to charge up the capacitors. This seems to work well. You can build an integrated power supply though! The discharge needs to be triggered by the arduino, so an SCR is used. This is a device that, when a charge is put between it's cathode and gate, allows a large current to flow between its anode and cathode. I could have used an opto-isolator circuit to protect the arduino from the 400 volt SCR circuit, but I was pressed for time and instead directly connected the SCR to arduino pin 11. This seems to work well enough and I have not had any problems with it, yet I would recommend adding isolation. The SCR is just wired in series with the coil, with the anode of the SCR connected to the coil and the cathode connected to capacitor ground.

Step 7: Building and Mounting the Turret

Turret time! The coil-gun is formed by wrapping about 60 turns of wire around a small section of pen tube. The back is sealed up for the projectile to lean against. I took two servos, and put one on top of the other to have movement in 2 axis'. The barrel was then mounted to one of the servos on top. With the servos connected to the RF receiver, they can be actuated by one stick on the remote control.

Step 8: Writing the Code

The code is pretty simple. It basically reads the PWM values from the RF receiver and decodes them. The throttle stick input, which is a value between 950 and 2100, is constrained to 1000 to 2000, then mapped to a value of 0-255 for input to the enable pin of the h-bridge. The forward/reverse switch just controls an if statement for the direction pins of the h-bridge. When the switch changes direction, the direction pins switch states. The fire pin basically does the same thing. The code is in a file below:

Step 9: It Works!!!

This project has taken some time, but it was well worth it! I can now drive this car around in the dirt and shoot random things with the coil-gun. The coil-gun is kind of a pain to load though, because it has to be barrel loaded and charged from a separate source. I may end up just using the lipo to fire the coil-gun. There are many modifications that can be made to this project to make it better, but isn't that the purpose of engineering? There is always room for progress. When I make this car work better, I will probably post a video about it on my channel, so subscribe for any future updates, along with other cool videos about Tesla coils and circuit boards and such.

Good luck building this project, comment with any questions!!

Microcontroller Contest

Participated in the
Microcontroller Contest