Introduction: How to Make a Bluetooth Controlled Simplistic RC Car
Hello everyone, I'm Bryan Tee Pak Hong. I'm currently a year one student in Singapore Polytechnic studying Computer Engineering.
When I was a child, I was always fascinated in RC cars and how they work. When I did take it apart, all I see are chunks of metal placed everywhere. I always wished that there was a simple tutorial covering the basic components that make up an RC car and today I will show you exactly that.
I plan to use this RC car for a variety of other projects as well, do refer back to this instructables guide if you have faced any problems.
Without further ado, let's begin!
Step 1: Step 0: Preparing Materials
Materials are very basic and easy to get, they are:
- Car chassis* (I'm using a new year cookie box, be creative with your choice!) x1
- DC motors and tires x2
- Arduino Uno (or any other variants) x1
- L298N H-bridge x1
- Caster wheel x1
- Batteries (1 for Arduino, 1 for motors)
- Male to male jumpers, male to female jumpers
- Bluetooth module HC-06 or HC-05 x1
- Breadboard (fast and easy connections) x1
Other equipments you will/may need:
- Solder iron
- Hot glue gun
*Note: my chassis has an IR sensor attached on it, it is not required in this tutorial
Step 2: Step 1: Preparing the Chassis
Firstly, take apart your breadboard. It should be able to split into 3 portions, 2 +/- vertical bars from the sides and the middle section, where most your connections will be made. This allows very easy placements of components whereby you can:
- connect 5V from your Arduino to the left side
- connect GND from your Arduino to the right side
- do all you connections close to the Arduino
It is important to get the position correct the first time as it will be hard to remove and re-position the breadboard. Ensure that there is enough space for both the Arduino and L298N to sit in between the 2 vertical bars.
Step 3: Step 2: Connecting the L298N to Your Motors
Solder 2 wires to your DC motor. Next, connect the other ends of the wires to one of the 2 hole sockets on the L298N bridge. The order of how you connect the wire doesn't matter. Repeat this for the other motor.
Next, put male to female jumpers on the male pins found beside the 3 socket. 6 is required, 3 for each side, whereby 1 is to control the speed of the motor via PWM and 2 for the directions. Remember which wires are connected to where as this will be important later on.
Take one of your battery packs and attach/solder the black wire (ground wire) to a male jumper. This will be used to acheive a common ground with the arduino later. Connect the red wire to the 12V input (leftmost socket) and the black wire to the GND (middle socket) of the L298N module.
Step 4: Step 3: Putting Everything Together
Hot glue the L298 module on you car chassis on the position you've deemed fit in Step 1. Next, hot glue the 2 DC motors to the sides of your chassis. My chassis has a dip around the edges so I used some nuts I had lying around to offset the height so I could glue the motors properly. This is optional for if you are using a flat chassis no offset is required. After gluing the 2 motors, glue the battery pack onto the chassis. I glued mine at the bottom due to space constraints. I also glued my battery pack slightly to the right to make space for removing the battery pack cover. Finally, glue the caster wheel in place and your basic car is done! Try to find a caster wheel that can allow your robot to have consistent height however the wheel turns.
Connect the 6 jumper wires onto the breadboard, categorize them as 3 for left and 3 for right.
Next part we'll cover on the Car's brain, a.k.a. the Arduino.
Step 5: Step 4: Arduino Connection and Code
Connect the right speed pin to Pin 6 and left speed pin to Pin 11 on the Arduino.
Next connect the other 2 direction pins of each side from the breadboard onto the Arduino via male to male jumpers:
- right ---> Pin 7 and 8
- left ---> Pin 12 and 13
Whichever order doesn't matter as we'll change the connections if they are wrong. It is important however not to switch the left and right parts altogether. Place the Arduino in the position you've planned in Step 1.
Now, copy the code from this website to test the motor movements:
- upload this code to your Arduino
- if the robot is rotating clockwise, switch the 2 direction wires of male to male jumpers on the right
- if the robot is rotating counter-clockwise, switch the 2 direction wires of male to male jumpers on the left
- if the robot moves backwards, switch the 2 direction wires of male to male jumper on both sides
Glue the other battery to the chassis and a basic robot is done! At this point, you can program your robot however you like, feel free to experiment. In the next step, we'll explore some basic movements for our RC car via bluetooth.
Step 6: Step 5: HC-06 Module
Handling this module is a bit tricky. Before we begin, upload this code to your Arduino.
Place the module on the breadboard, do not overlap the connections with the motors. Do the connnections as shown:
- VCC ----> 5V (3.3V will not work!)
- GND ----> GND
- RX on bluetooth -----> Pin 1 on Arduino
- TX on bluetooth -----> Pin 0 on Arduino
Download an app called Arduino bluetooth controller on your android phone. I do not own an iphone so I'm sorry iphone users, but you should be able to find similar apps that have the same function. Power up your Arduino and pair the bluetooth module with your phone (usually called HC-05/06 or BT03/04 etc.), if you are prompted to key in a password, type in 1234 or 0000, if the verification fails or you can't seem to connect, then we'll need to control it from a PC that has bluetooth function. For now, open up the Arduino bluetooth controller app and connect it to your device. Select your bluetooth module and you'll reach a PS2-ish control interface.
Do these key bindings
- w --> Forward
- a --> Left
- s --> Back
- d --> Right
- EDIT: j --> Stop button
Step 7: Congratulations! Your Simple Bluetooth Controlled RC Car Is Complete!
- We will need 2 motors and an H-bridge to drive the motor
- A brain, in our case arduino, is needed to command the robot how to move
- We can use our phones as a remote control for our RC car
If you want to use your computer however, pair your computer with the bluetooth module, go to bluetooth settings which is found at the end of the bluetooth configuration page, check which port is it connecting to (tip: it is outgoing and has the name of your bluetooth module). Go to tools > serial ports and change the COM to the correct COM port. Fire up Seial monitor and enter 'w' for the robot to move forward, 's' to move backward etc.
If you've made this far, congratulations! Have fun with your Bluetooth controlled RC car!
Update: You can read up my blog post here.
1 Person Made This Project!
- ArghyaD1 made it!