The goal of this project is to transform a little (and cheap) tracking car into a bluetooth drived model by using an android app. The code (arduino and android) is avaiable for any modify.

Take a look on YouTube.

Firstly the bill of material (prices at 11/11/2015):

  1. Tracking car 8,05 €
  2. Arduino Pro Mini atmega328 5V 2,15 €

  3. HC-05 RS232 Bluetooth 4,59 €

  4. 4 x AA Battery Holder rx pack 1,80 €

  5. 6 Pin USB 2.0 to TTL UART 1,99 €

Now some note:

  1. In the list above items from 1 to 4 are (of course) needed
  2. Item no. 5 is a USB to RS232 converter to program Arduino Pro Mini (maybe you have it)
  3. If you need also the item no. 5 please select just the type above that have drivers also for Win 8, 8.1 and 10.

The overall cost is about 20 $ (or euro) but unlike commercial products you can learn much more about arduino and android programming.

Step 1: Buy the Tracking Car and Build It

I advise before to buy only the car and build it. The kit have a clear schematic diagram and the printed circuit have also a nice serigraphy. Anyone having a minimal experience in electronic homebrewing get the model working.

You can see in the website of the seller a short video with a car chasing a black stripe.

Step 2: Destroy the Car.....

After playing a bit with the car it is time to destroy it ! Now you must have the items (2, 3, 4 and 5) described in the introduction.

In the schematic above you can see the list of changes:

  1. Remove the original battery pack (2x1,5V AA size) and replace it with the 4x1,5V AA size pack.
  2. Replace the 51 ohm resistors R11 and R12 with two (equal) resistors in the range 470-1000 ohm (they must have the same nominal value).
  3. In the bottom side of the printed circuit cut the tracks near PINS 3 and 5 of IC1 (as you can see in the above image).
  4. Desolder the photoresistor R13 and short-circuit his PINS (see the modified schematic).
  5. Desolder the photoresistor R14 and short-circuit his PINS (see the modified schematic).

  6. Desolder the LED1 D4 (see schematic).
  7. Desolder the LED2 D5 (see schematic).

In the bottom side of the printed circuit, between the two motors, you must insert the Arduino Mini Pro...go to next step...

Step 3: Preparing the Arduino Pro Mini

Arduino Pro Mini come without any PIN soldered so you must:

  1. Solder a 4 PIN connector in the Arduino board (component side of the PCB!) like in the second picture of this step. Pay attention: the 4 PIN connector must be soldered in correspondence of the PINS: Vcc GND RXD TXD (maybe you read another order of this PINS depending from the Arduino Pro Mini version). This connector will be used to program arduino (to upload the executable file) from the PC.
  2. Solder 7 wires (see the third picture of this step) of about 7-10 cm each. Wires must be soldered on component side of the PCB (in the same side of 4 PIN connector). In the 3d picture of this step you can see where the wires must be soldered, i.e. PIN 6 of arduino must be connected to PIN 5 of IC1 (in the main PCB), PIN 12 of arduino must be connected to RXD PIN of the HC05 bluetooth module.
  3. When done the previous steps you can insert the arduino PCB between the two motors TAKING CARE to insulate the two PCB with a very little piece of sponge (or plastic, or so on). See the 2nd picture of the introduction of this article.
  4. You can now solder all the wires of arduino to the main PCB except the two wires connected to PIN 11 and 12 because the HC-05 BT module must be before inserted in the main PCB....see next step.

Step 4: The HC-05 Bluetooth Module

Drill the main PCB making 6 little holes of about 1mm of diameter in the position showed in the picture. Generally the HC-05 (6 pin module) come with a male connector soldered so insert the module (in the same side of the battery pack).In the other side :

  1. Solder Vcc of HC-05 to Vcc of main board.
  2. Solder the GND of HC-05 to GND of main board (after the switch - the HC-05 must be switched off when main board is'nt powered)
  3. Solder the TXD of HC-05 to the PIN 11 of the arduino board (you previous have soldered a wire to PIN 11...)
  4. Solder the RXD of HC-05 to the PIN 12 of the arduino board (you previous have soldered a wire to PIN 12...)

Now the hardware modding is complete....let's go to the software...

Step 5: The Arduino Firmware

If you still have worked with the arduino IDE please jump down to the SW description.

Otherwise you must have the arduino IDE be installed (download page).

Download the file (below) SoftwareSerial.zip, decompress it and copy the SoftwareSerial folder in the subfolder libraries of the Arduino IDE folder. Now you can download (below) the MOTORBG.ino file and open it into the arduino IDE.

SW description (MOTORBG.ino)

Few concepts are contained in this software:

  1. With the SoftwareSerial library an object named mySerial is instantiated assuming RXD PIN no. 11 and TXD PIN no. 12
  2. PIN 3 and 6 (SX_MT = left motor and DX_MT = right motor) are setted for OUTPUT.
  3. Initialize the serial port (serial.begin(38400) ) for communication with the PC
  4. Initialize the mySerial object (mySerial.begin(38400) ) for communication with the HC-05 module
  5. In the setup function set the analogWrite for PINS 3 and 6 to the maximum output (255). This means that an high voltage level (5V nominally) is applied both to PIN 3 and 5 of IC1. Assuming that R1 and R2 trimmers are turned to have approximately 1V applied to the inverting inputs (PIN 2 of IC1A and PIN 6 of IC1B) the outputs of both opamp (PIN 1 and 7) are high and the PNP BJT Q1 and Q2 are switched off. Pratically PIN 3 and 6 of arduino are PWM (8 bit) output that drive motors "backwards" : when are setted to 255 motors are down, when are setted to 0 motors deliver full power (and speed). Intermediate values permit to set a speed between 0 and the max possible speed.
  6. loop function: when the android app send a string in the format AhklPxyz (so the string length is always 8 and Ahkl means an angle of hkl degrees and Pxyz a power or speed of xyz percent of maximum) the output of mySerial.available() getting true and the String named "command" acquire a new character by the HC-05 module. After the block of the while the command string have the same format of the transmitted string. The outled function is called and set the PWM output (of two motors) depending from "angolo" (0 to 360 degrees) and "potenza" (0 to 100).
  7. The StrToInt function convert a string of 3 characters (i.e. "034") in the integer number (i.e. 34).

How to load the program into arduino Pro Mini

If you have previous uploaded a program to an arduino Pro Mini please skip to step 6.

Otherwise read next.

In the picture above you can see (left to right) the arduino Pro Mini (without the soldered wire because is'nt important here) and the "6 Pin USB 2.0 to TTL UART Module". They are connected by a 4 wire cable ending with female-female connectors. The schema of connections is quite simple:

  • GND arduino to GND USB_to_TTL
  • Vcc arduino to +5V USB_to_TTL
  • RXD arduino to TXD USB_to_TTL
  • TXD arduino to RXD USB_to_TTL

You must download and install the USB_to_TTL drivers for windows located in the intro page of this article. After that insert the USB_to_TTL device into an USB port of your PC and don't permit a driver search from internet. If the device is properly installed you can see in the device manager windows by clicking ports (COM and LPT) something like "Silicon Labs CP210x USB to UART Bridge (COMn)" where n of COMn is the port number assigned to the device. In the arduino IDE you must choice in the tools menu the same port number, the board "Arduino Pro or Pro Mini" and the processor "ATmega328 (5V, 16 MHz).

Finally you can upload the program into Arduino Pro Mini board in this mode: after having loaded the source code (MOTORBG.ino) left click over the right arrow (compiling and uploading) a bit down to the menu bar in the arduino IDE. Firstly you read in the status bar (at the bottom) "compiling sketch"; press (continuosly) the reset push button (in the arduino board) until you read "Uploading" in the status bar so ONLY NOW YOU CAN RELEASE THE RESET BUTTON.

Only in this way you can upload the firmware into the board.

Now the android App.

Step 6: The Android App

You must install the BTcommander.apk from this page. Set "unknow origin" in the security item of the settings of your smartphone.You can see here some screenshot of the app: Firstly the app enable the bluetooth (if not previous enabled). The first activity (screen) show only one button enabled : "Scan devices". After pressed it the app search for bluetooth devices around; if something is found the "Stop Scan" button is enabled, press it and will be show a list with name and mac address of the found devices. At this point tap over a device in the list and the activity (screen) will change: on a black background there is a button (tap it to connect the device) and a virtual joystick with a blue disc in the middle. Moving the disc inside the white one the car will move in the selected direction with the selected speed. Releasing the blue disc the car will stop.This app send to the HC-05 bluetooth receiver a string with info's about angle and power(speed) to apply at the car model (please refer to step 5 - the arduino software).

The source code (BTcommander.zip is a change made by me on a existing code) is developed with an Eclipse IDE and you can download it (and import into a similar IDE) from the bottom of this page.

A full explanation of the code is really too long so if someone ask for it I'll send a synthesis.

About This Instructable




More by i4xcc:Modding a little tracking car model Function generator (arduino pro mini) 
Add instructable to: