Introduction: Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet
Arduino 4WD bluetooth controlled rover
This is a simple 4WD rover i made with Arduino.
the rover is controlled with an android phone or tablet over bluetooth. With that app you can control speed (using Arduino's pwm) , run it with the accelerometer and many other things.
The Arduino sketch is fully commented and open source, also the communication protocol (developed by me) from the app to Arduino is explained in the sketch .
Knowing the protocol you can use the app to control other robots...
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What You Need...
In order to build your own Arduino 4wd rover you should buy all the needed parts from your preferred store.
Most of them can be bought on ebay or amazon or other online electronics/hobby stores.
I try put some links but they could be outdated and not working, in this case try search the part manually by name. Sorry for that.
Anyway it’s a very simple robot kit usually made by a chassis, four Dc (up to 12V) motors with gearmotor and four wheel.
The parts used are:
- 1 pcs of chassis complete with 4 DC motors, usually called Arduino rover 4wd, for example these:
Also a search on Ebay with the '4WD chassis robot arduino' keywords will return a lot of results.
- 1 pcs of Arduino uno R3 or Arduino Leonardo board.
- 1 pcs of Bluetooth module HC-05 or HC-06 with adapter board (Updated! 2017 , October 10, now supports HC-05 module for whose of you that already have it)
- 1 pcs L298 bridge dual motor controller board.
There are many different of these but the pinout is 99% the same for all.
Just connect wires to the right pins based on the board diagram. with this tutorial you can find the datasheet of the one I used (see next step).
- 3 pcs 3.7V 1200mA (or more) Li-Ion rechargeable battery AA size or 11,1V 1200mA LiPo battery pack.
if you use the AA size battery you can put them in a battery holder.
- 1 pcs Jack plug for Arduino power plug.
- 1 pcs 1Kohm resistor.
Step 2: The Schematic Diagram...
This is the schematic diagram for wiring the rover, please follow it while assembling it in the next step...
The L298 pdf will help you in case you have a different board pinout.
The HC-05 and HC-06 bt modules have the same pinout.
Sometimes the HC-05 has 6 pins instead of 4, check pins name on the bottom of the module to be sure to use correct pins.
Step 3: Assembling the Rover…
Follow the numbered images and the short video for the assembling order (some things may differ depending on your chassis…).
- Start with the motors on the chassis and wheels (image 1).
- Mount the L298 motor controller board and wire motors to it.
Also add 2 wires to power the board (image 2 and 3).
- A piece of flat cable will connect the board to Arduino, you need only 6 wires but I left some other free for future use (maybe lights or ultrasonic sensor…).
Also wire the jack plug , pay attention to polarity, the central pin is positive (+11.1V from battery) (image 4).
- Place the battery holder (or the battery pack) in the front of the rover, fix it with a piece of double-sided tape. If you choose the AA size battery it’s simple to remove them individually for recharging.
If you choose a battery pack then could be a good idea to put a connector between the battery pack and the rover (image 5).
Place the top of the rover…the flat cable and the jack plug passes through the hole (image 6)
Assemble the bluetooth module with the resistor using a piece of flat cable (usually provided with the module). Cut the RXD wire (not the pin!) and solder the resistor in series to the wire.
Seal with a heat-shrinkable tube (image 7).
Place the Arduino board and the module. Connect the flat cable as in the schematic.
Fix the Bluetooth module with a (very) little piece of double-sided tape.
Connect the power jack to Arduino (image 8).
Step 4: The Arduino Sketch...
Connect only the Bluetooth module HC-05 or HC-06 to Arduino as in the schematic (remember the 1Kohm resistor! on RXD pin of the module).
Open the Arduino sketch, uncomment the correct #define for your bluetooth module and be sure to comment the other one, see image. Upload it to an Arduino uno R3 or Leonardo Board, let the USB cable connected so the board remains powered.
1) Open the serial monitor and set the communication speed to 115200 baud and the NL (New Line) terminator.
In the serial monitor write the string: ‘Echo on’ and click Send, you should see ‘Echo is on’, this will echoes the next commands to the screen. Now write the string: ‘Device’ and click Send, you should see ‘Connected to: ArduinoRover’
Now follow the steps below to test the bluetooth connection depending on the module you chose. Note: when you send AT commands to the bluetooth module be sure commands are uppercase!
2a) Test for HC-06 module
Don't power off Arduino (if you did it, restart from point 1, you need the Echo on) and send the string ‘AT’ , you should see ‘HC-06> OK’ after about one second, this mean your Bluetooth module is correctly connected and the baud rate match the one set in the sketch at line: BtSerial.begin(9600).
To change the Bluetooth module name send the string ‘AT+NAMEArduino’ (for example), you should see 'HC-06> OKsetname' in about a second.
Now try to find the Bluetooth module with your smartphone or tablet and pair with it, insert the pin, usually 1234 when asked for.
2b) Test for HC-05 module
This bluetooth module is a bit tricky, so follow exactly the instructions and see the image with the screenshot from the IDE.
Power off Arduino by removing the USB cable.
There is a little pushbutton on the HC-05, see images, keep it pressed while reconnect the USB cable to power on Arduino and until the red led on the module starts flashing slowly.
This is a special command mode to be sure to match the BtSerial.begin(38400) speed in the sketch.
Now open the serial monitor as per point 1, enter 'Echo on' and click Send, you should see 'Echo is on'.
Send the string 'AT' , you should see 'HC-05> OK'.
Send the string 'AT+ORGL' , the module will respond 'HC-05> OK' , this resets the module to factory default parameters.
Send the string 'AT+UART?' , you should see 'HC-05> +UART:38400,0,0' this is the default communication speed.
Send the string 'AT+PSWD?' , you should see 'HC-05> +PSWD1234' this is the default password 1234.
Send the string 'AT+NAME=HC-05_rover' (for example, just use your preferred name after the sign=), it should respond with 'HC-05> OK' .
Now power off Arduino by removing the USB cable and power on again after a few seconds.
Try to find the Bluetooth module with your smartphone or tablet and pair with it, insert the pin you got in serial monitor, 1234, when asked for.
3) Complete the project (see assembling the rover) if not already done.
Step 5: The Android App...
Now your Rover is ready to run!
You need the FREE android app IRacer & Arduino BT controller from the playstore here:
The app allow you to drive the rover with the four way joystick in portrait mode or with 2 joystick (multitouch) in landscape mode.
Be sure to choose the correct device in the app: Open the app menu (the 3 lines button),open the app settings (the gear) -> Remote control setup -> click and select the device to drive: Arduino Rover.
From the menu, choose connect and select your already paired bluetooth module name from the list to connect to.
In the settings menu there are a lot of options (backgrounds, speed limits ...) to play with, enjoy :)