0% found this document useful (0 votes)
63 views

Arduino 4WD Rover Bluetooth Controlled by Android

This document describes how to build an Arduino 4WD rover that is controlled via Bluetooth by an Android phone or tablet. The rover uses an Arduino board, Bluetooth module, motor driver board, 4 DC motors and wheels, batteries, and other basic electronic components. Instructions are provided on assembling the hardware, connecting the components, and uploading an Arduino sketch that enables Bluetooth control of the rover using a custom communication protocol. The sketch and protocol are open source, allowing users to control other robots through a Bluetooth-connected Android app.

Uploaded by

MyintMoe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
63 views

Arduino 4WD Rover Bluetooth Controlled by Android

This document describes how to build an Arduino 4WD rover that is controlled via Bluetooth by an Android phone or tablet. The rover uses an Arduino board, Bluetooth module, motor driver board, 4 DC motors and wheels, batteries, and other basic electronic components. Instructions are provided on assembling the hardware, connecting the components, and uploading an Arduino sketch that enables Bluetooth control of the rover using a custom communication protocol. The sketch and protocol are open source, allowing users to control other robots through a Bluetooth-connected Android app.

Uploaded by

MyintMoe
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

instructables

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet

by AppsByDavideV

Arduino 4WD bluetooth controlled rover source, also the communication protocol (developed
This is a simple 4WD rover i made with Arduino. by me) from the app to Arduino is explained in the
the rover is controlled with an android phone or tablet sketch .
over bluetooth. With that app you can control speed
(using Arduino's pwm) , run it with the accelerometer Knowing the protocol you can use the app to control
and many other things. other robots...

The Arduino sketch is fully commented and open

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 1


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:

http://www.robotik.center/index.php?route=product/... from http://www.robotik.center/

http://www.robotshop.com/en/dagu-4wd-chassis.html

http://www.robotshop.com/en/whippersnapper-runt-ro...

http://www.robotshop.com/en/juniorrunt-rover-kit.h...

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.

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 2


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.

Download
https://www.instructables.com/ORIG/FCN/YABW/IHNTEND4/FCNYABWIHNTEND4.pdf

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 3


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…).

1. Start with the motors on the chassis and wheels (image 1).
2. Mount the L298 motor controller board and wire motors to it.
Also add 2 wires to power the board (image 2 and 3).
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).
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).
5. Place the top of the rover…the flat cable and the jack plug passes through the hole (image 6)

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).

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).

1. motor w/gearbox 1. L298 dual motor driver

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 4


2

3
1
1
2

1. board inputs to arduino 1. i used a flat cable to simplify connections


2. right motors 2. flat cable and power jack to arduino board
3. left motors

1. 3x AA 3.7V Li-Ion battery w/battery holder or battery pack

https://www.youtube.com/watch?v=xmrNsbA97AE

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 5


Step 4: The Arduino Sketch...

Connect only the Bluetooth module HC-05 or HC-06 see 'HC-06> OKsetname' in about a second.
to Arduino as in the schematic (remember the 1Kohm Now try to find the Bluetooth module with your
resistor! on RXD pin of the module). smartphone or tablet and pair with it, insert the pin,
usually 1234 when asked for.
Open the Arduino sketch, uncomment the correct
#define for your bluetooth module and be sure to 2b) Test for HC-05 module
comment the other one, see image. Upload it to an
Arduino uno R3 or Leonardo Board, let the USB This bluetooth module is a bit tricky, so follow exactly
cable connected so the board remains powered. the instructions and see the image with the
screenshot from the IDE.
1) Open the serial monitor and set the communication Power off Arduino by removing the USB cable.
speed to 115200 baud and the NL (New Line) There is a little pushbutton on the HC-05, see
terminator. images, keep it pressed while reconnect the USB
cable to power on Arduino and until the red led on the
In the serial monitor write the string: ‘Echo on’ and module starts flashing slowly.
click Send, you should see ‘Echo is on’, this will This is a special command mode to be sure to match
echoes the next commands to the screen. Now write the BtSerial.begin(38400) speed in the sketch.
the string: ‘Device’ and click Send, you should see Now open the serial monitor as per point 1, enter
‘Connected to: ArduinoRover’ 'Echo on' and click Send, you should see 'Echo is on'.
Send the string 'AT' , you should see 'HC-05> OK'.
Now follow the steps below to test the bluetooth Send the string 'AT+ORGL' , the module will respond
connection depending on the module you chose. 'HC-05> OK' , this resets the module to factory
Note: when you send AT commands to the bluetooth default parameters.
module be sure commands are uppercase! Send the string 'AT+UART?' , you should see 'HC-
05> +UART:38400,0,0' this is the default
2a) Test for HC-06 module communication speed.
Send the string 'AT+PSWD?' , you should see 'HC-
Don't power off Arduino (if you did it, restart from 05> +PSWD1234' this is the default password 1234.
point 1, you need the Echo on) and send the string Send the string 'AT+NAME=HC-05_rover' (for
‘AT’ , you should see ‘HC-06> OK’ after about one example, just use your preferred name after the
second, this mean your Bluetooth module is correctly sign=), it should respond with 'HC-05> OK' .
connected and the baud rate match the one set in the Now power off Arduino by removing the USB cable
sketch at line: BtSerial.begin(9600). and power on again after a few seconds.
To change the Bluetooth module name send the Try to find the Bluetooth module with your
string ‘AT+NAMEArduino’ (for example), you should smartphone or tablet and pair with it, insert the pin

you got in serial monitor, 1234, when asked for. not already done.

3) Complete the project (see assembling the rover) if

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 6


Download
https://www.instructables.com/ORIG/FIJ/QA0G/J8F64JDB/FIJQA0GJ8F64JDB.zip

Step 5: The Android App...

Now your Rover is ready to run! Open the app menu (the 3 lines button),open the
app settings (the gear) -> Remote control setup ->
You need the FREE android app IRacer & Arduino click and select the device to drive: Arduino
BT controller from the playstore here: Rover.

https://play.google.com/store/apps/details?id=com.... From the menu, choose connect and select your


already paired bluetooth module name from the list to
The app allow you to drive the rover with the four way connect to.
joystick in portrait mode or with 2 joystick (multitouch)
in landscape mode. In the settings menu there are a lot of options
(backgrounds, speed limits ...) to play with, enjoy :)
Be sure to choose the correct device in the app:

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 7


I just made one, bluetooth module and the rest were successfully done but the rover is not
moving.....i dont know whats happening the code was successfully uploaded.
Hello, did you manage to connect correctly?
You should see something like the image below, check the red box in the image.
If the connection is good then the problem could be in the motor driver controller or connections
between Arduino and the driver. Check also to have enough power from the battery (i recommend
a battery pack >10V and 1500mA)
Be sure to choose the correct device in the app: open the app settings -> Remote control setup ->
click and select the device to drive: Arduino Rover
You can also post a detailed pics of your work, specially the driver and connections

Hello everyone !
The Instructables has been updated to support HC-05 modules as many of you are asking for.
Arduino code was updated as well :-)
Enjoy!

bro please reply

Hi EmilS32,
it seems an error of the IDE, maybe a missing driver/bad installation.
Try install the IDE again. Your problem is not related to the project.
I suggest you to try search on the Arduino forum if the reinstallation of the IDE doesn't fix the
problem.
I have done it successfully bro... But the controls from the app is reversed. Eg:If driven front it runs
left
go to the settings menu of the app. there are 2 switches to change the direction of the sliders.
don't forget to click on IMade it! under the title above... thanks!

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 8


BRO it shows following errors
Arduino: 1.8.3 (Windows 7), Board: "Arduino/Genuino Uno"
Sketch uses 8122 bytes (25%) of program storage space. Maximum is 32256 bytes.
Global variables use 543 bytes (26%) of dynamic memory, leaving 1505 bytes for local variables.
Maximum is 2048 bytes.
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 1 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 2 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 3 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 4 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 5 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 6 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 7 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 8 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 9 of 10: not in sync: resp=0x76
avrdude: stk500_recv(): programmer is not responding
avrdude: stk500_getsync() attempt 10 of 10: not in sync: resp=0x76
Problem uploading to board. See http://www.arduino.cc/en/Guide/Troubleshooting#upload for
suggestions.
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
These are the photos of the driver bro

Ok, i'm not quite sure without having it on my hands, anyway...


Assuming Motor1 is channel A and Motor 2 is channel B and referring to pg5 of the datasheet you
find in this INSTRUCTABLE, try to connect as for picture below. In case of problem you must
compare your board with the one of the datasheet.

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 9


Bro sorry for late reply.. O havn't seen it...But I can't find the perfect datasheet for my driver as the
ic used in the driver is l²98n but the in the driver it is printed as l298
Send me some detailed images of the board with the driver

I have L298N..Will it work? Please reply

Hi,
please provide a link or schematic of your L298N board/shield so i can try to help
See this errors

Hi, it compiles correctly for me using the windows version of the Arduino IDE V1.8.1 and arduino
nano.
Don't know about ArduinoDroid.
Why don't you use the arduino ide instead?
Ok i will try
Program errors
Uses of undeclared identifier 'setmotor'
Uses of undeclared identifier ' getreceivedbytes'
Uses of undeclared identifier
'btserialprint'
Uses of undeclared identifier 'readusbuffer'
Uses of undeclared identifier 'usbechomode'
Uses of undeclared identifier 'serialprint'
Uses of undeclared identifier 'usbsendatmode'
How to solve this please tell me
Arduino nano will work on this project?
Yes , it is the same as Leonardo that i already test. Carefully check the pinout to match the
schematic.
sorry, i'm wrong. it is the same as UNO so it will work anyway. Again, check carefully the pinout

I got a L293d shield. Will it work?

Hi Rijult,
sorry for the late reply.
I think it will work but you need to adjust code to match this shield. Carefully check/compare your
shield's pinout with the one used in the project. Also (probably) you need only 1/2 of your shield for
this project.
Bye
PLEASE, do you have a video i have to see how it works brother.....

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 10


Click on show all items in this instructables to view the video or:

//www.youtube.com/embed/xmrNsbA97AE

and

//www.youtube.com/embed/BGJLUEP8xfM

If only the wheels on the right part are turning , what you think may be the problem?

Hi Isaac,
assuming you didn't change the arduino code, the problem could be only in the L298 motors driver
wirings or broken module (internally the L298 has 2 separate driver).
Refer to the datasheet attached to this instructable if you have a different module/pinout.
Let me know :)
Well i know each driver works because they work alternatively, so the ENA and ENB have a
jumper that joins two different connections which I removed, and only made a single connection on
both, I don't know if I should leave the jumper and make that single connection. When I
alternatively make a connection on the different pins for each EN only side works
Do you have a datasheet of your L298 module? ok a link to it?

Hi Davide, nice work...


What you used to do the app in android?
Hi Peppers,
i'm using B4A development tool:
https://www.b4x.com/b4a.html
Bye
thank you very very much
very very much
without you i couldnt make it
Hi,
solved?
Does it work?
hi
yes it worked very well
sorry for the late reply
Perfect Nidulaw, enjoy :)

hi
can i use a L298 driver module except a dual motor driver
thanks
Hi Nidulaw,
i think yes but i'm not sure without seeing a schematic of your module.
Of course you must match connections from your L298 driver board and the board i used.
Let me know if you need help (in that case please provide a link to a schematic of your board).

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 11


Bye
THIS IS MY DRIVER

It seem very similar to the suggested one but can't help with photo... i need a schematic. Where did
you bought it? There is something written on the pcb? Name... model.. ?
Hi all other stuffs are ready but i have motor driver shield not this module so can you please tell
what are the changes i have to made in the code
THANKS inadvance
Hi,
you can find the datasheet of the motor driver i used on step 2 of this instructables.
you should adapt pinout of this motor driver to your motor driver.
I can't be more specific without seeing your motor shield specifications/model, so please post a link
of your product or a datasheet/schematic in pdf format.
Bye.
Davide
New V2.10 Arduino code:
-Improved Bluetooth buffer
-Arduino can send messages to the app (requires latest version of the android app)
Enjoy :)
Hi AppsByDavideV, i was following your instructions and i have problems setting the BT
connection up. The code was uploaded correctly but when i type AT on the serial monitor i do not
get any response, just "You sent: AT". What can i do to fix this?
for hc-05 the default baude rate for communication is 9600 and to enter into AT mode the baude
rate is 38400 try changing the baude rates. Btserial.begin(38400).
In hc-05 if we want to enter into AT mode we should enable pin 34. we can do that in two ways
If your Hc-05 has a small button then hold pressing the button, by pressing the button pin 34 is
HIGH, now power on the module and leave the button, the module will enter into mini AT mode. In
mini AT mode, only some commands work like AT+VERSION etc. However, you can press the
button and send the command and leave the button. In this way, you can send all AT commands.
The other way to enter into AT mode is by enabling pin34 by connecting EN or Enable pin of your
hc-05 to vcc that is 3.3v or if your module supports 5v. The new factory out modules support upto
5v.
Hi EstebanCV,
wich BT module did you use? Are the rxd and txd pins connected in the right place ? be sure they
aren't exchanged togheter.
Also when sending AT commands the module must not be connected over bluetooth.
You can try to change the line:
BtSerial.bregin(9600).
with a different speed, maybe your module is set to another speed.
Last: can you post a detailed image of the bluetooth module you are using?

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 12


Bye
I have been trying change both lines of code:
Serial.begin(57600);
BtSerial.begin(9600); and nothing happens
The module just keeps on blinking rapidly.TThe module that i am using is the HC 05 GW 040
which works as slave as well as master but i have no answer.

Yeah, I too got the same problem. Change serial.begin also to 9600, then it works. i.e
Serial.begin(9600)
Hi EstebanCV, as far as i know the HC-05 and HC-06 have different communication protocols.
This could be the problem. The project was developed with an HC-06 and actually works. I'm sorry
i haven't an HC-05 to test and adapt the sketch.
You can try change the BtSerial.begin(9600); up to 115200 bps one step at a time but i think it's
not enought: perharps the module waits for some extra characters
Attached the serial monitor result for the project using the HC-06 and the android app connected to
arduino. Also find the pdf that explain the differences from the HC bt modules...
Hope it helps :)
Bye

BtSerial.readBytes(BtBuffer,7);.....................error

Hi MR32,
i can't get errors using the correct Arduino (Uno or Leonardo) with either the ide 1.6.9 from
arduino.cc and the ide 1.7.10 from Arduino.org.
Check the Arduino you are using is correct (must be Uno or Leonardo)
Greetings

Arduino 4WD Rover Bluetooth Controlled by Android Phone/tablet: Page 13

You might also like