CxemCAR 1 - Android Control RC Car Over Bluetooth
Intro: CxemCAR 1 - Android Control RC Car Over Bluetooth
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:
To control the machine using 4 different way:
- 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.
- On-Screen Buttons.
- Touch Control via virtual circle.
- Wheel Control - like virtual steering wheel.
STEP 1: Assembly
FEZ Panda II board to the chassis 4WD stuck with 2-sided scotch tape:
STEP 2: Parts
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
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
STEP 3: Calculations and Block Diagram
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.
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.
STEP 4: Android Application
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.
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.
STEP 5: Assembly
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.
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.
12 Comments
dulpratt 7 years ago
Thanks for the information about Android Control RC Car. Your instructions are very helpful. However, I was wondering if I do need to download all 3 of the source code on step #6 and uploaded them onto the Arduino IDE before making any configuration. please respond.
tankmonxk 7 years ago
does this work on latest android version
NishanN2 7 years ago
TheH5 8 years ago
Hey the app says socket failed... any idea why and what's the fix?
jasonjason931 8 years ago
I cant find or figure out how to download the cxem car 1.0 program. the closest thing i can find is from the googleplay store called "wn-bluetooth car"
anyone have the program and willing to post it somewhere so i could get it??!!
mattia.colli1 8 years ago
how do i downlode the app on my phone?
madscience.rk 9 years ago
how can i use atmega 328 board to this project..?
lWilmer 9 years ago
kpalan 9 years ago
mukesh0121 9 years ago
hey i have made this project and it is successfull...
I only want to ask that how can i add an hc sr04 distance sensor in this project, please give me the arduino coding for this purpose, any help should be highly appreciated..
please email me the step for doing this on my id- mirnal.mannu123@gmail.com
or call me 8109948815
bbogdanmircea 9 years ago
Very nice.
Can I use the application to control Arduino Uno robot with Bluetooth ?
pdantas 10 years ago
Nice work.
Have a look in http://pedrodantas.com/wp/2013/07/928/
I develop a robot with Fez Panda II, too.