ARDUINO BLUETOOTH ROBOT CAR
Project Date: August 2018
1. 1 * Custom base platform.
2. 4 * DC Motor + Wheels.
3. 3 * 18650 batteries with 3 battery holder and 2 *18650 batteries with 2 battery holder.
4. 2 * Rocker switches.
5. 2 * Red LED lights with 220K resistors in series
6. 1 * kit containing: 2 pcs SG90 Servo Motor + 1pcs 2-Axis Servo Bracket.
7. 1 * Arduino Uno R3
8. 1 * Arduino Sensor Shield V5
9. 1 * L298N Dual Bridge DC Stepper Motor Driver
10. 1 * Ultrasonic Module HC-SR04
11. 1 * 8 led neo pixel strip ws2812b ws2812 smart led strip RGB
12. 1 * BT12 Bluetooth Module BLE 4.0
13. 1 * 12V voltage 4 digit display
14. 1 * 1602 LCD Display plus IIC serial interface Adapter Module
15. Hot Glue, M3 stand-offs, screws, washers.
16. Male-to-Female 10cm and 15cm jumper wires.
17. Plain 1mm wire about 50cm.
18. Tools including: Soldering Iron, miniature screwdrivers and pliers
19.USB to Arduino cable.
This is the second Arduino based project I have submitted to Instructables, however the robot described below is the forth robot I have built. This robot builds upon a previous version which was WiFi based, this new version has both WiFi and Bluetooth communications. The WiFi to allow the camera to stream video directly to the Android App. and the Bluetooth to provide simple control of the robot. The Arduino code listens for the Bluetooth commands, receives them, decodes the command, acts upon the command, and lastly returns a reply message to the Android App. confirming that the command has been enacted upon. In addition to this feedback on the Android App. the robot also repeats the commands onto its own LCD 16x2 line display.
My philosophy when building robots is to ensure that they not only work in the way required but also that they look aesthetically correct with clean lines and good construction methods. I used a number of internet-based resources both for the electronics and Arduino code and for that I offer my thanks to those contributors.
The choice of the 18650 batteries was based on their power rating and ease of obtaining good quality second hand batteries usually from old laptops. The Arduino board is a standard clone, as is the L298N Dual Bridge motor controller. The DC motors are adequate for the project but I felt that larger 6V DC motors with direct drive would perform better, this being a possible future upgrade to the project.
Step 1: Fritzing Diagram
The Fritzing diagram shows the various connections from the batteries, via the two-pole switch, to the Arduino Uno. From the Arduino Uno to the L298N Motor Driver, LCD 16X2 line display, Bluetooth BT12, HC-SR04 sonic transmitter and receiver, servos for the camera and sonic transmitter, and finally from the L298N to the DC motors.
Note: The Fritzing diagram does not show any of the GND cables.
Step 2: Construction
The basic construction consisted of a single base 240mm x 150mm x 5mm with holes drilled for the M3 stand-offs, holes for the L298N, MPU-6050, and Arduino Uno supports. A single 10mm hole was drilled in the base to allow control cables and power cables. Using 10mm stand-offs the LCD, Arduino Uno, and L298N motor driver where attached and wired as per the above diagram.
The DC motors where mounted on the bottom plate using hot glue. After being soldered each motor’s wires where connected to the left and right connectors of the L298N motor driver. The L298 motor driver jumper was installed so that a 5V supply could be provided for the Arduino Uno board. Next the 18650 battery holders were glued to the underside of the base and wired through a two-pole switch to the Arduino Uno and the 12V and Ground inputs of the L298 motor driver.
Camera servo cables where connected to Pins 12 and 13, HC-SR04 servo cable was attached to Pin 3. Pins 5,6,7,8,9, and 11 where attached to the L298N motor driver. The BT12 Bluetooth module was connected to the Arduino Sensor Shield V5 Bluetooth pin outs, VCC, GND, TX and RX, with TX and RX cables reversed. The URF01 pin set was used to attach the HC-SR04, VCC, GND, Trig, and Echo pins, while the IIC pin set was used to connect the LCD VCC, GND, SCL and SCA pins. Finally, the 8 LED light set pins VCC, GND, and DIN where connected to Pin 4 and its associated VCC and GND pins.
As both of the battery packs and their power switches where mounted below the base a single red LED and 220K resister was added in parallel with the power switch so that it would illuminate when the power switch was turned on.
The attached photos show the construction stages of the robot starting with the M3 stand offs being attached to the Arduino Uno and L298N, then both of these items are attached to the base. Additional M3 stand offs are used together with the brass plate to construct a platform onto which the HC-SR04 and Camera Servos are mounted. Additional photos show the wiring and construction of the motors, battery holders and Neo pixel light strip.
Step 3: Arduino and Android Coding
Using the Arduino 1.8.5 development software the following program was modified and then downloaded to the Arduino Uno board via a USB connection. It was necessary to find and download the following library files:
(All of these files are available from the https://github.com web site)
The above photo shows a simple fix to allow the Arduino code to be downloaded to the Arduino Uno board. While the BT12 module was attached to the TX and RX pins the download program would always fail, so I added a simple break connection on the TX line which was broken while the code was downloaded and then remade in order to test the BT12 communications. Once the robot was fully tested I removed this breakable link.
Arduino and Android source code file can be found at the end of this page.
Using Android Studio build 3.1.4. and the help of many internet sources of information, for which I offer my thanks, I developed an App which allows the user to select and connect to a WiFi source for the camera and a Bluetooth source to control the Robot’s actions. The user interface is shown above and the two following links show video of the robot and camera in action. The second screen shot shows the WiFi and Bluetooth scanning and connection options, this screen will also check that the App has the necessary permissions to access both the WiFi and the Bluetooth network and devices. The App can be downloaded via the link below, however I cannot guarantee it will work on any other platform except a Samsung 10.5 Tab 2. Currently the App assumes that the Bluetooth device is called “BT12”. The Android App sends simple one character commands to the robot but receives command confirmation strings in return.
Step 4: To Conclude
You Tube video of the robot’s basic operation can be seen at: https://youtu.be/DrUt7L_qrxo
You Tube video of the robot’s Obstacle Avoidance can be seen at: https://youtu.be/j83tRwSaMgI
What I have learned:
The Bluetooth communication is definitely the best method for controlling the robot, even with the 10m maximum range that the BT12 has. Use of the 18650 batteries, one set to power the motors and a second set to power the Arduino, shield, servos, BT12, and LCD helps greatly to extend battery life. I was impressed with the NEO Pixel light strip, RGB LEDs are bright and easy to control as was the BT12 Bluetooth module which has functioned flawlessly since receiving it.
This project was always about the use of Bluetooth Communications. Now that I have a working model and can control the robot via the Android App I am ready to start the next project which will be the most complex I have attempted, namely a six leg, 3 DOM per leg, Hexapod which will be controlled by Bluetooth and be able to stream real time video via its head which itself will be able to move vertically and horizontally. I also expect the robot to have obstacle avoidance.