Introduction: Accelerometer Bluetooth Controlled Mini Car
Hi Folks,
I just recently entered into the world of arduino and its amazing open source programming and developing.So i decided to make a cool accelerometer controlled Bluetooth mini car . This Sounds amazing but the concept is simple it is controlled by your android device (uses accelerometer and gyro sensor) via Bluetooth. So let's make it! and i call this mini bot as spoke runner.
EDIT: NOW IT CAN BE HAND CONTROLLED!
Step 1: What Are the Required Parts?
Now , that's really simple and quite low expensive materials you can get easily on eBay, dealxtreme,etc...
Electronics:
2x 500 rpm geared dc motors (minimum 100 rpm.)
1x Hc-05(The cheap bluetooth module available for arduino.)
1x Arduino Uno R3
1x L293D IC (Or the h bridge driver will do.)
1x mini breadboard.
Get some bunch of jumper wires.
Some 2-way tape required .
Get a base for you mini car! ;)
1x LED
1x 9v clip and battery.
Skills required:
Its nothing but to:
know how to use the Arduino board.(Don't worry about the codes . i will provide them ;) )
know how to use breadboard.
Step 2: Getting Started With Concepts....(The Schematic)
The concepts are very simple or to say really simple and cool for spoke runner.
I believe that concepts must be clear and concepts are very important in life so i have also included a white board schematic.
What we do here is just connect the two dc motors to the L293d IC or to the H bridge driver so that we can make motors to spin both the ways we want ie..Clockwise and anti-clockwise.
The H bridge sends 4 pins to arduino ie..2 pin for each motor. To make this car run we require a transmitter (tx) but here we wont use a transmitter but we will use our android device as our transmitter and connect it to our car via the HC-05 module (via bluetooth basically).
Many people make these mistakes but be sure that you connect HC-05 Tx to arduino RX and HC-05 RX to arduino TX.
Note:In the breadboard the fritzing didnt have power rails so i took the first one from above as positive and the second from above as negative in the mini breadboard
Step 3: Take You IC Into Some Action...
So now nothing but just wire u the L293D Ic either on a mini breadboard or on a PCB . If you dont know how to use the L293D IC then visit my another instructable "Working with H bridge" .This will guide you through how to wire the IC and stuff.IF You have the H bridge then skip this step and proceed.
Step 4: Code It Up!
As i promised you before , I will provide you the code and yes don't forget to change the baud rate according to your HC-05 module's baud rate the default baud rate is 9600, but mine was 38400, so i had to change it and i recommend you all to go through the comments in the code.
The code:
// This Code is developed by Hemanth Krishna for educational
purposes only.
// Spoke Runner.
int M1P1 = 10; // Declaring all variables for the L293D Ic pins.
int M1P2 = 11;
int M2P1 = 5;
int M2P2 = 6;
int LED = 3; // A LED pin declaring.
void setup() {
// put your setup code here, to run once:
pinMode(M1P1, OUTPUT);// Setting the pin as output for all pins.
pinMode(M2P1, OUTPUT);
pinMode(M1P2, OUTPUT);
pinMode(M2P2, OUTPUT);
pinMode(LED, OUTPUT);
Serial.begin(38400);// Begins the serial communication at 38400 baud, but the default is 9600 baud.
// Change the baud rate according to yours.
}
void loop() {
// put your main code here, to run repeatedly:
if (Serial.available()); // We command the arduino that if there is a some command incoming.
char val = Serial.read(); // Then store the incoming command into the char 'val'
digitalWrite(LED, HIGH);
if (val == '1') { // If the command is 1 then do this.(the below command.)
digitalWrite(M1P1, HIGH);
digitalWrite(M2P1, HIGH);
digitalWrite(M1P2, LOW);
digitalWrite(M2P2, LOW);
delay(200);
digitalWrite(M1P1, LOW);
digitalWrite(M2P1, LOW);
Serial.println('Forward'); // GO Forward
}
if (val == '2') {//If the command is 2 then do this.(the below command.)
digitalWrite(M1P1, HIGH);
digitalWrite(M2P1, LOW);
digitalWrite(M1P2, LOW);
digitalWrite(M2P2, LOW);
delay(200);
digitalWrite(M1P1, LOW);
Serial.println('Left'); // GO Left
}
if (val == '3' ) {//If the command is 3 then do this.(the below command.)
digitalWrite(M2P1, HIGH);
digitalWrite(M1P1, LOW);
digitalWrite(M2P2, LOW);
digitalWrite(M1P2, LOW);
delay(200);
digitalWrite(M2P1, LOW);
Serial.println('Right'); // GO Right
}
if (val == '4' ) { //If the command is 4 then do this.(the below command.)
digitalWrite(M1P2, HIGH);
digitalWrite(M2P2, HIGH);
digitalWrite(M1P1, LOW);
digitalWrite(M2P1, LOW);
delay(200);
digitalWrite(M1P2, LOW);
digitalWrite(M2P2, LOW);
Serial.println('Backward'); // GO Backward
}
if (val == 's') { //If the command is s then do this.(the below command.)
digitalWrite(M1P1, LOW);
digitalWrite(M1P2, LOW);
digitalWrite(M2P1, LOW);
digitalWrite(M1P2, LOW);
Serial.println('Stop!'); // STOP
}
}
So now i suppose , we are ready to go and lets proceed!
Attachments
Step 5: Spoke Runner Assemble!
I just assembled it just simply and i also included a motor guard which you can see using a cardboard so that my motor doesn't get damaged in any way . Designing the body is all you choice , your creativity , your work and stuff but i just made spoke runner simple.
Step 6: The Android Device ...
Go and download the app ArduinoRC this is a real cool app from Estacado's ltd. This app is really great and simple to use and setup is awesome
Steps for installation:
1. Go to the app and click proceed.
2.Then select your Hc-05 device Make sure your arduino is turned on.
3.Then select vehicle mode once it is successfully connected.
4.Then you press your menu button./settings button.
5.Then you set your commands as per the picture.
Gesture_Front= 1
Gesture_Left= 2
Gesture_right= 3
Gesture_Back= 4
stop_button= s
6. Go back .
7.Now Enjoy!
Step 7: Let Us Make It Hand Controlled!!
Creativity always welcome!
We are going to make spoke runner hand controlled!
What you need is:
1x rubber band
your device
1x tissue paper
Your hand.
Just wrap your device to your hand using your rubber band and tissue to protect your devices screen.
Make sure you keep you device horizontal.
Now we are ready to go!
Step 8: Thats All Folks!
So now I hope you have made your own accelerometer mini car. So enjoy guys, and if any problems persists just leave a comment i will try to resolve it . I will assure you that i will posts more interesting instructables. I am joining for the mind for design contest and move it contest. So if you really like this instructable just Vote for me
Thanks for reading !!

Participated in the
Mind for Design

Participated in the
Move It
8 Comments
8 years ago on Step 8
PLZ CA U ANSWER FAST
8 years ago on Step 8
DUDE WHERE SHOULD I CONNECT THE BATTERIES
8 years ago on Introduction
Oh , i am really sorry i misunderstood it . Okay as in fritzing i choose the mini breadboard. The breadboard(mini) by default didnt have the power rails so i took the power rails as the first two rows the first row from above as positive rail and the second row from above as negative rail in the breadboard , oherwise the breadboard would not make sense
8 years ago on Introduction
Oh Hi The Pencil Guy , Thanks for voting me and i am really sorry for not replying quick. Actually you can see, here the power is a 9v battery you can use by connecting it your arduino and yeah you can see that i have connected the arduino's 5v and GND which gives power so that technically means you have just power the arduino.
Regards,
HKPNSS
Reply 8 years ago on Introduction
You didn't understand.
I am saying about whole of the power rails missing from the breadboard schematics.
Don't I have to connect anything to the +ve and -ve rails?
8 years ago
Excuse me, i am new, but why arent there any schematocs for the power rail connections in the fritzing picture?
If there is, could you help me find it and help me make it?
Already voted, nice instructable...!
8 years ago
Hi maheshs3, I see that you have some problem in your code and no need to call me sir, I am just a kid . Did you post this comment by mistake or you want me solve your problem in your code? (If that's the case I am new to arduino but still try to solve it). So I need your reply,
Thanks and regards,
HKPNSS
8 years ago on Introduction
there is coding
and sir problem is that
the if else loop
and condition where the value of sensorValue is less than 400 ..
in that condition there ultrasonic sensorvalue work.... and sir when sensor value greater than 400 in that condition rain drop detector is work only.....
these both sensor is not work in same time
raindrop detector is sensorvalue
please checked it...
#include<Servo.h>
#include <NewPing.h>
#define trigPin 9
#define echoPin 8
#define motor1 4
#define motor2 3
#define sensorValue A7
void setup() {
//set a pin as output
Serial.begin (9600);
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(motor1, OUTPUT);
pinMode(motor2, OUTPUT);
pinMode(sensorValue ,INPUT && OUTPUT);
pinMode(pin , OUTPUT);
}
void loop() {
// read the input on analog pin 7:
int sensorValue = analogRead(A7);
long duration, distance;
digitalWrite(trigPin, LOW); // Added this line
delayMicroseconds(2); // Added this line
digitalWrite(trigPin, HIGH);
// delayMicroseconds(1000); - Removed this line
delayMicroseconds(10); // Added this line
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
distance = (duration/2) / 29.1;
if (distance < 20 && sensorValue < 400 ) { // This is where the moter On/Off happens
digitalWrite(motor1,HIGH); // When the Red condition is met, the Green LED should turn off
digitalWrite(motor2,LOW);
}
else {
digitalWrite(motor1,LOW);
digitalWrite(motor2,LOW);
}
if (distance >= 250 || distance <= 0){
Serial.println("Out of range");
}
else {
Serial.print(distance);
Serial.println(" cm");
delay(1000);
}
}
sir after all i work hard on it i'm still not get solution of this problem
in this project i used
arduino mega2560
ultrasonic sensor
rain drop detector
and servomotor and robot kits
working of this project is that
and the rain drop detector sensor used in downside of robot so it sense water and change its direction when water density increase....