Intro: Build a Bluetooth Robot W/ Arduino & MIT App Inventor
In this Instructable I will be showing you how to build a four wheel drive robot car that is controlled using your cellphone via bluetooth and an App using MIT App Inventor. I will also be showing you how to add other functionality to it in later Instructables, so stay tuned.
Step 1: Things You Will Need
1. Robot car chassis
The robot car can be purchased from eBay and other online websites for less than $25.
2. An Arduino Mega
In theory you could use an Arduino Uno but for later upgrades the Mega is a Must
3. The L293d Motor Controller Shield
The L293d is necessary for sending voltage to our four motors, the Arduino is incapable of providing enough current for our motors by itself.
4. The HC-06 Bluetooth Module
In order for our phone to control the robot we will need an HC-06 bluetooth module onboard our robot. An HC-05 could also work. Some older model Bluetooth modules were not 5v tolerant. Be sure to purchase one that says it is 5 volt tolerant.
5. A battery pack
You can use a battery pack that uses 6 AA batteries or you could use Lithium Ion battery you want the output voltage of your battery(s) to be between 6 and 12 volts
6. Dupont wires & other wire
You will also need some dupont connectors, 4 if I counted correctly. Male terminals on one end and female on the other. Also you will need some wire for connecting the motors to the L298d motor controller, 8 wires approximately 7 inches long.
7. Other things you may need
A soldering gun, solder, screws, a screwdriver, wire strippers, hot glue gun, a cellphone, and patience
Step 2: Assemble the Robot
First you will need to solder two wires to each of the four motors, I chose to use red and black wires but you can use whatever color you like. Don't worry about which wire goes where. If we get the polarity wrong (the motor runs in the wrong direction) we can just reverse the wires on the L293d motor controller later.
After soldering the wires to each of the motors you will be ready to assemble the robot, to do this follow the instructions provided in the packaging of the kit. Also, you can watch the first part of my YouTube video to see how it's done.
Step 3: Some Assembly Required
After assembling you robot car it should look something like this. Be sure to look at the orientation of the motors and the wiring so that they are facing the right way and the motor wires are facing inward - toward the inside of the robot. Hint: a little hot glue between the motors and the chassis will add rigidity and strength to the assembly.
P.S. This is where the patience comes into play! There are alot of screws in the kit.
Step 4: The Arduino Mega & L293d Motor Contoller
Next we need to attach the L293d motor control module to the Arduino Mega by simply aligning the pins in the correct orientation and firmly pressing the two together. Look closely at the pins to confirm they are aligned before pushing too hard.
We will also need to mount the Arduino Mega to the robot chassis. You could accomplish this in many ways, hot glue is one. The way I chose to do it was to 3d print a mount. You can also purchase the mounts on eBay or print one out yourself if you have access to a 3d printer. Here is a link to the file located on Thingiverse.
In the second YouTube video I show how to install the mount, the Arduino Mega, and the Motor Controller
Step 5: Wiring It Up
Next, we will need to hookup the motors to the L293d motor controller. As I mentioned earlier we may need to reverse these wires later so don't spend much time over thinking this part, if we get the polarity wrong it's very easy to change it later. Odds are that you will have at least one motor running the wrong direction, it's not a big deal!
You will need a small phillips head screwdriver to tighten the connector down onto the wires coming from each of the motors. Make sure they are firmly in place, failure to make a good connection may result in a motor not turning.
Step 6: The HC-06 Bluetooth Module
Wiring up the Bluetooth module is fairly straightforward. There is a Voltage Connector (VCC) on the module. In my picture/video this is a Red wire which I attach to the Arduino Mega to a 5 volt terminal, there is one Near pin 22, but you can choose a different one. There is also a Ground (GND) on the module, I connect the other end of the Dupont Green wire to a ground wire Near pin 53 but you could choose a different ground terminal.
We also have signal wires Transmit (TXD) and Receive (RXD). I connected a Yellow wire to the (RXD) of the bluetooth module and connected the other end of the wire to Pin 18 (TX) of the Arduino Mega. I then connected a Blue wire to the (TXD) of the bluetooth module and the other end of the Blue wire to Pin 19 (RX) of the Arduino Mega. Remember Transmit goes to Receive and Receive goes to Transmit If you get these reversed to Bluetooth Module will not be able to communicate with the Arduino.
When you finished wiring up the Bluetooth Module you might want to secure it to the chassis using a zip tie as I did in the photo.
When you supply power to the Bluetooth Module you will need to pair it to you phone if this is the first time using it. Make sure the led on the bluetooth module is blinking (it has power). Next, make sure your phone's bluetooth is turned on and that it is ready to pair to another device (visible). When your phone sees the bluetooth module pair the devices, it will ask you for a 4 digit passcode, the code is usually "1234". If it fails to connect using this code read the datasheet for your bluetooth module.
Once the Phone connects to the bluetooth module the light should stop blinking and be constantly lit, this is true for most bluetooth modules. I also show more about how to wire up the Bluetooth Module in part 2 of the YouTube video.
I should note pins 18 and 19 on the Arduino Mega are a Serial Communications Port, the Mega has Four serial ports in all. By using Serial1 (pins 18 & 19) we will not be interfering with Serial0 which is the port that the Arduino uses to communicate with the computer when uploading a Sketch (program). This is one reason why I prefer using the Arduino Mega vs the Uno, otherwise you would need to unplug the Bluetooth module every time you upload a sketch to the Uno.
Step 7: Downloading the Arduino Sketch
Next we will need to get the Arduino sketch. You can find it on Github at this link
Just click the Download button and save the file to your computer then open it using the Arduino IDE.
Next, simply connect the Arduino to you computer and upload the sketch.
Step 8: Download the App
Next we will need to download the App to our phone from MIT App Inventor, but first you will need to sign up and have an App Inventor account. It's free and only takes a few minutes.
When in App Inventor you can search for the app in the Gallery by typing "Build Bluetooth Robot"
I show how to do this as well as the previous step, downloading the Arduino sketch from Github, in the Third YouTube video here...
You will also need to download the MIT App Inventor Android App to your phone.
If you have never used App Inventor here is a link to a YouTube video demonstrating how it works.
Step 9: Testing and Motor Direction
After you have downloaded the app to your phone you can connect to the bluetooth module and give commands to the robot car. I would suggest placing an object under the car to prevent the wheels from touching anything while you test the direction of the motors. Press the Forward button and check the direction of the motors, if one or more of the motors is going the wrong way, reverse the wiring of the motor on the L293d motor control shield until all motors are going the same way.
Have fun and stay tuned for more updates or Subscribe to my YouTube channel for new Videos.