CxemCAR 1 - Android Control RC Car Over Bluetooth

by tolik777 in Circuits > Robots

45140 Views, 64 Favorites, 0 Comments

CxemCAR 1 - Android Control RC Car Over Bluetooth

1.jpg
3.jpg
This is a open source project of RC Car with control from Android Phone via Bluetooth. The controller is used with .NET Micro Framework: FEZ Panda II, but you may use any controller works with .NET Micro Framework core (Netduino, GHI Electronics board's and other). All source code is available at GitHub.

To control the machine using  4 different way:
  1. Accelerometer. Tilt forward - car goes forward, tilt to the left - car turns to the left, tilt back - car goes back. Speed of movement or rotation depends on how much you tilt the device. Sensitivity and value of the tilt set in the configuration Android-apps.
  2. On-Screen Buttons.
  3. Touch Control via virtual circle.
  4. Wheel Control - like virtual steering wheel.
More detailed see video:


Assembly

5.jpg
FEZ Panda II board to the chassis 4WD stuck with 2-sided scotch tape:

Parts

2.jpg
For this project you need Android device with accelerometer and Bluetooth: tablet, smartphone and other... As an Android device, I used a cheap Chinese Phone "Jiayu g2s" with Android 4.1 OS.

Also you need any .NET Micro Framework board, Chassis, Bluetooth module (i'm use HC-06) and L298N Dual Bridge DC stepper Motor Driver module

Calculations and Block Diagram

4.png
All calculations are performed in the Android-application, and immediately calculate the values of the PWM for the left and right motor. Application has flexible settings, such as the range of the PWM, the sensitivity of tilt, the minimum threshold for the PWM and other. Example commands transmitted by Bluetooth:
L-255\rR-120\r
L - the command to the left engine, R - for the right
A dash means the motor rotation to move back
255 - PWM value (for Arduino is the maximum speed of rotation)
\r - end of command.
On this command RC car will move forward and slightly rotated to the right, as right engine rotates slowly left.

L255\rR-255\r
On this command the left engine will rotate back and forward right, forcing a car to rotate around its axis counterclockwise.

H1\r
Command is an additional channel to which you can connect for example lights, sound, etc.

Symbols command L, R and H can be defined in the settings of Android-applications.

In the MCU control program provides a timer that shuts off the engine if the last command was received more than n-seconds ago. The data are stored in the EEPROM memory of the controller and can be changed from Android device. The range of this setting is from 0.1 seconds to 99.9 seconds. This setting can be disabled. To work with EEPROM provides commands: Fr - reading values and Fw - record values.

Android Application

20130722114009.png
20130722114104.png
20130722114127.png
20130722114146.png
20130722114204.png
20130722114212.png
mac.png
eclipse.png
The application for Android was written in Eclipse IDE. All sources of the project and the project for Eclipse, you can download from GitHub. Android version on your device must be > 3.0.

The application contains several activity. Main activity is a home screen with buttons running different operating modes and settings

MAC address

To establish a connection with the RC Car's Bluetooth module, you must set MAC-address in the application settings. But first, you must configure the pair the devices on Android-device: open Settings -> Bluetooth and click "Search for devices". When the phone finds our Bluetooth-module, click them and enter password for pairing (usually "1234")

To know Bluetooth module MAC-address possible from any application, such as Bluetooth Terminal. To do this, click "Connect a device - Secure" and in the resulting window, click the button "Scan for devices". Software will be scans the Bluetooth devices and displays them MAC-address.

Assembly

4wd1.jpg
4wd2.jpg
4wd3.jpg
4wd4.jpg
4wd5.jpg
4wd6.jpg
4wd7.jpg
1.jpg
I soldered a Bluetooth-module to the FEZ Panda 2 and led status light. For communication between Arduino and Bluetooth, read this article: Arduino and Bluetooth. Module HC-06 placed in heat-shrink tube 10mm. Bluetooth-state LED with current limiting resistor (calculator) were also placed in heat-shrink tube.

Power DC motors are from the 3xLi-Po battery 3.7V 1100 mAh. The controller is powered by a single 3.7V Li-Po battery (although the required 5V, but works fine on 3.7V). Power supply of Bluetooth module is taken from the FEZ board.

Source Code