This instructable was created in fulfillment of the project requirement of the Makecourse at the University of South Florida (www.makecourse.com).
So as an over view, the idea of this project is to gain an introductory understanding of electronics, soldering, wiring, and coding in Arduino in regards to RC stuff. To be completely honest, before this project a lot of the way that RC cars worked was a mystery to me. So in this Instructable I will be sharing with you, and teaching you what I have learned and how to build the same RC car I built. The reason for building this RC car with an Arduino is so that I could include turn signals on the car. The integration of a micro controller also allows me to add head lights, taillights and sound in the future if I want to.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Aquiring the Parts
So to begin this project you are going to need quite a few parts and pieces. I will do my best to link to any parts that were purchased, and I will also add any 3D printed files that were needed to create this project.
Things you will need:
- Soldering Iron
- Solder Wire
- 1/18th scale RC Car (this will give you a controller and receiver that are already matched, However, you can buy components separately and put the build together, it just becomes more difficult with the mechanics.)
- Arduino Uno
- A Box
- 2 LED's
- 2 220 ohm Resistors
- 3D Printed base Frame
- 3D printed top plate
- 3D printed wheels (if you want to)
- Arduino wire
- RC car Battery (RC car probably came with one)
- 9V battery
- 9V batter adapter for Arduino
- Hot Glue gun
- hot glue sticks
- 3D Printer (or access to one)
links for the things above that I used:
1/18th scale RC Car:
(its important to note that for the initial build of this project I didn't use a pre-bought RC car. I used parts and pieces from RC cars that my family and friend donated to me to complete this build. However to make the build easier to follow, I have rebuilt the project with the car linked to below.)
any box will due
220 Ohm Resistors:
3D Printed Parts:
the Gcode files for the Parts I used for this specific RC car should be in the files for this step.
9V battery Adapter:
Hot Glue Gun and Sticks:
3D printer: (you don't need to buy this, however, this is the printer I used for this project.)
any parts/pieces that were left out are left out because they are common household items that anyone should be able to acquire from the store, or already came with the RC car that was purchased.
Also you will Need to download the Arduino Software if you do not already have it. (ITS FREE)
here is the link
Step 2: RC Car Tear Down
Now that you have acquired all of your parts and pieces its time to start the build.
to starts lets take apart the RC car you bought. so the car you bough was a 4 wheel drive car that has both a front and a back differential. if you have a large enough box then you can keep this length the same and move on to the next step. However, if your box is not long enough, then you will need to take the RC car apart. to do this you will need to remove the battery, the receiver, the servo, the battery tray, and the mid section holding the two differentials together. you will also need to remove the drive shaft from both differentials. Once all of this has been removed you must then cut the drive shaft to the desired length and re-install it to the rear differential only. the rear differential is the one with the wheels that don't turn left and right.
Step 3: Rebuild
If you didn't Tear down the RC car Continue to the next step.
Now that the RC car has been taken apart and the Drive Shaft cut and re-installed, you can start to Rebuild the car. To do this you will need to print the 3D parts from step one.
- Looking at the first Pic above of the Base Plate, you will screw the front differential into holes 1 and 2 ( in that order).
- Then you will screw in the rear differential into holes 3 and 4 (respectively).
- you will then use the same mounting bracket that came for the steering servo and screw it into holes 5 and 6 respectively.
- The next step is to attach the Top Plate, to do this screw Hole one to the top of the FRONT differential and hole 2 to the top of the REAR differential.
- then pull the cables for the motor through hole 3.
The bottom plate that was printed is used to attach the two separate differentials together into one, shorter wheel base to fit more boxes or bodies. The top plate will be used later to attach other electronics to as well as give added rigidity to the car.
Step 4: Electrical SetUp
now its time to get all the Electrical components working and wired up.
- To Start (if you are new to soldering) I suggest taking one of the protoboards and a couple of the extra wires and practicing soldering, it can be a bit tricky if you've never done it before.
- Once you feel like you are ready looking at the schematic I have posted above you will want to start with the ProtoBoard.
- For this you will want to start by soldering one RED male to male arduino wire to the protoboard going out horizontally. This will attach to the 5V terminal on the Arduino Board.
- Then attach a Black Arduino wire to a separate line on the board in the same manner as the first wire. this will attach to the ground terminal on the Arduino board.
- You will then need to attach 2 more RED wires in line with the red wire attached to the 5V terminal on the Arduino. Then bridge the 3 wires together using the solder.
- Then attach 5 BLACK wires in line with the first ground terminal wire you attached. these are needed because everything must be commonly grounded to the Arduino or this project wont work.
- You will then need to solder a 220 ohm resistor to the positive side of the BOTH LEDs that will be used for this project. If this isn't done then the LEDs will burn out and need to be replaced which wont be easy.
- Then solder a red wire to the opposite side of the resistors (like it is shown in the schematic above).
Once this soldering has been completed you can hook everything up EXCEPT the batteries the way it is shown in the schematic. For reference on most 3 wire servos and ESC's (electronic Speed Controller) the WHITE (or ORANGE) wire is the signal wire, the RED wire is the voltage input wire, and the BLACK (or BROWN) wire is the ground wire.
ALSO the power and ground from the PROTOBOARD to the RECEIVER should be connected to the power and ground on channel 1. the green wire should connect to channel 1 as well, and the orange wire should connect to channel 2 on the receiver.
Whats GOING ON???
So, for those of you who are wondering what is actually happening in this set up continue to read, if you not interested in this, and want to just keep building then you can move on to the next step. So, what is happening is that we are wiring the receiver to the Arduino. Now the Receiver receives input signals from the linked controller which based on the users input will make the car go forward, backward, left and right. The rear motor is controlling the forward and backward motion and the steering servo is controlling the left and right motion of the front wheels. The way we are able to make the turn signals work on the rear of the car is that the Arduino receives the input signal from the receiver, then based on the input signal to the steering servo either the left or right LED will blink, thus creating turn signals.
Step 5: Putting It Together
Once the electrical setup has been completed you are ready to put it all together.
to do this:
- Before adding the top plate to the care plug in the wired for the receiver and place the receiver underneath the top plate. this will keep it from moving around and wires coming loose.
- Then start by heating up your hot glue gun
- Then once hot add a dab of hot glue to the top of the 9V and printer cable port on the Arduino board and press the bottom of the ProtoBoard onto the (still Hot) Hot glue dabs. this will simi-permanently hold the two together.
- Then add a dab of hot glue to the top of the rear differential and press the bottom of the Arduino into it. this will keep the Arduino from moving around while driving the car.
- then place a small dab of hot glue to the bottom of the ESC and press it against the top plate infront of the Arduino. (MAKE SURE TO NOT BLOCK THE PORTS ON THE ARDUINO, WE STILL NEED TO UPLOAD THE CODE, and attach a 9V battery.)
- Also set the completed mechanical and electrical build beside the box you will be using to house everything, this will allow you to mark out where the holes for the wheels need to go.
- then cut out the holes for the wheels. (NOTE: make sure to cut the holes for the front wheels a bit larger as they will be turning left and right and will require more room.)
- Then Poke holes in the rear of the box that are just big enough for the tip of the LED to fit into.
- Test fit everything in the box with the holes and make sure everything fits before moving on.
- Once you have MADE SURE everything fits in the box the way it is supposed to, place a large amount of hot glue on the bottom of the bottom plate and press it firmly against the bottom of the box so that the wheels show through the bottom of the box.
- Continue to hold the car against the box until the hot glue cools.
Once this is completed you can proceed to the coding portion of the project.
Step 6: CODING
Before Starting this step if you do not already have the arduino app or software installed on your computer you can go to the link below and download it (ITS FREE!!). you will have to do this before continuing on with this project.
- Start by downloading the .ino file I have available for this project.
- Then open the code and upload it to your Arduino.
- test the left and right steering motion and make sure your LEDs are in the correct orientation for the left and right signals.
- once the LEDs are on the correct sides place them in the holes made earlier in the build and place a dab of hot glue on the LEDs to hold them in place.
If your the kind of person who wants to know the ins and outs of stuff, or just is wondering what is happening behind the scenes with the code then continue to read. If not you can move on to the next step.
so what is happening (line by line):
- The first line is the include statement that allows the code to include the servo library imbedded in the Arduino software.
- The next two define statements in the code define what pins the LEDs will be attached to on the Arduino.
- The next 3 int statements are declaring the different channels on the receiver as integers, this allows the input from the controller to be accepted.
- The Next 2 int statements are declaring the terms "move" and "turn" as integers so that I am able to change the type of signal being sent out by the Arduino later on in the code.
- Next you will see two "Servo" statements, these are needed so that the code knows I have 2 servos and that the names are "myservo" and "esc"
- Next we enter the "VOID setup" loop: this is the setup loop that will run once and then moves on to the rest of the code. so this is where I declare what pins are input pins and what pins are output pins. input pins take IN a signal, and output pins OUTPUT a signal.
- First in the void setup loop you will see the two ".attach()" code lines, these two lines are specifying that the servos are attached to pins 9 and 11 on the Arduino board.
- next you will see five "pinMode" lines. the first 3 of these are declaring that pins 5, 6 and 7 are input pins. these are the pins that are connected to channels 1, 2, and 3 (respectively) on the receiver. the Last 2 "pinMode" pins are declaring that the pins that the LED's are connected to are sending the signal out to the LEDs.
- The "Serial.begin()" line is declaring the baud rate or bits per second that is accepted and read into the arduino.
- Next we move to the "void Loop" this is what is run continuously after the Arduino is powered on.
- The first two lines of this loop are reading/setting what the pulse width of each input channel from the receiver is. this is important as without it we would not be able to read any of the incoming signals.
- Next is the mapping sequence. what is happening is that the incoming signal is being mapped to a signal that the esc can read and make something happen. so we set the mapped values equal to the previously defined variable "move".
- We then write to the servo called "esc" the values of "move" this is what is allowing the car to move forward and backward.
- For the "turn" mapping set up it is doing the same thing, only its mapping the incoming signal to an angle that is then sent to the steering servo. the steering servo will then move to the corresponding angle.
- The first "if" statement says that if the steering servo is moved to an angle less than 75 degrees then the left LED will blink, thus creating the left turn signal.
- The second "if" statement says that is the steering servo is moved to an angle greater than 100 degrees then the right LED will blink. Thus creating the right turn signal.
and that is how the code works.
Step 7: Have FUN
Now that you have uploaded the code you are ready!
- First put batteries in your controller and turn it on.
- Then plug in the RC car battery to the ESC and turn on the ESC.
- then Plug in the 9V battery to the arduino.
once the Arduino has powered on you should be able to control the car and have turn signals. you will also have gained a bit of knowledge that will allow you to pursue and start more complex coding and design projects on your own. so continue to grow and HAVE FUN!
Also an optional upgrade (if you bought the suggested car) are these wheel I designed. you can 3D print them in any color you want. I think they are pretty cool.