Android phone accelerometer controlled Remote Car
I bought an RC toy car and found the traditional joystick console boring and old fashioned. I decided to modify it to be able to control it from my Android mobile phone using an App based on the orientation of the phone (accelerometer) and values sent out via Bluetooth to the Arduino.
Basically what I need was the body, chassis and motors, the rest of the circuit and joystick went straight to the rubbish bin.
Most smart phones have an accelerometer built into them.
Operation:
- To turn the car just tilt the phone to the left or right.
- To move forward and backward just tilt the phone to the direction.
- Speed is increased or decreased based on how far the phone has been tilted.
Parts and functions:
- Prototype is built around an Arduino UNO.
- Android phone application (developed using MIT App inventor 2) reads phone accelerometer x,y,z values.
- Accelerometer values are sent out through phone Bluetooth to the car Bluetooth (HC06) module using serial communication (RS323).
- Arduino UNO reads accelerometer values received and controls two motors connected through a motor driver (LD293D) and also changes the speed by altering PWM duty cycle.
Bluetooth (HC06) and Arduino
VERY IMPORTANT: connect bluetooth (HC06) to +3.3VDC at 50mA, else be prepared to go shopping again.
When powered up the LED status on the bluetooth will blinks fast. Firstly "pair" your mobile phone with the bluetooth (HC06)...standard name "itead" password "1234" and this needs to be done only once.
Android app development
I used MIT App inventor 2, quick easy and fun.
Building code for bluetooth connection
When you select connect (ListPicker1) will show all the bluetooth devices the mobile phone is previously "paired" with then select "itead" and the bluetooth LED status will stop blinking and now be solid.
Building code for obtaining accelerometer values
Building blocks for sending obtained values via bluetooth
Testing the initial app
Initial app screen
Results of the accelerometer values sent to the arduino
Pending upgrades:
Project is currently been upgraded to use an ESP8266 wifi module instead of Bluetooth HC06 for range and video streaming.
Final design:
Final functional block diagram
Schematic designed with Proteus software
Simulation design on Proteus software
Final PCB designed with Proteus software
Android App screen
Final sketch:
The full Arduino sketch and editable MIT app I uploaded it on Github
Feel free to use it and have fun with it
Kindly upvote and follow me: @mokluc….I will upload another project soon: My Arduino fun projects