September 16, 2013

Bluetooth remote control car


Last semester my roommate brought an RC-car to the dormitory, but we didn't have the batteries to use it. It was the beginning of the semester (=we had free time) so we decided to make it driven with an arduino via bluetooth. It took us approx. a week to make it ready. In the end it could be driven with an android smartphone or with a computer.


First of all we removed the cover and the original IC from the car. We only kept the undercarriage and the back-motor (a simple small DC-motor, similar to this). We wanted to keep the wheel-motor, but it accidentally fell apart, so we replaced it with a servo motor (model: Tower Pro SG90).
We wanted to drive the DC motor in both direction, so we used a H-bridge IC. I don't remember the exact product number, but I think the cheapest one should be enough.
We used a cheap bluetooth modul (JY-MCU) for the connection with the remote controller (android or pc).
The wiring was not so complicated. We connected the H-bridge forward pin to pin 11, backward pin to pin 8, servo's pin to pin 3 and the BT modul to pin 0 and 1 so, that BT's RX pin was connected to arduino TX pin (pin 1) and BT's TX to arduino's RX (pin 0). But be careful! If you connect the arduino TX and RX pin it won't get any further data from the USB cable, so connect those pins only after upload your code! Or use arduino mega, which can handle more communication parallel.

Software part1: arduino

I hope it doesn't need too much comment. It was hard to find the right angle for the steering-servo, so we implemented an easy way to change the scale with sending a number 0-9. Here is the code.

Software part2.1: android

None of us could program android, so we tried to find a program written by someone else. Fortunately we found one, available on Google Play for free: Actually we first found this program and after that wrote the code with the command (which letter for which direction) given by the program. The program has two interfaces, it can be used with buttons on the touchscreen but you can also use the accelerometer in your phone and just tilt your phone. Overall it's a great program and saved a lot work for us.

Software part2.2: computer

Arduino uses Bluetooth as a simple serial input (but it should be clear after the arduino code). So we wrote a program in LabVIEW to send the drive-commands (represented by characters) to the arduino. We wrote it so that you could use your arrow-keys to drive the car. Here is the vi.
The block diagram:
And the front panel in two situations (with no button pressed and with front and right keys pressed):


My roommate used this project as a homework and recorded a video. Unfortunately  it's only in Hungarian language, but here it is:

Further development

Later we updated it with 2 ultrasonic distance-sensor to avoid crash. Here is the updated arduino code.

Best regards, feel free to comment: