Introduction: A Simple Arduino Bluetooth Car
Hi, This is my first instructable.
This is a simple arduino bluetooth car for beginners.
I am using two continuous rotation servos instead of motors.
So, Let's Start. :)
Step 1: What You Will Need
1)Arduino (I'm using a Mega 2560)
2)Bluetooth Module or Shield (I'm using a shield)
3)9V Battery and Cap
4)4xAA batteries and a holder
5)2x470uf Capacitor (Only if you are using servos)
6)2xMotors or 2xContinuous rotation servos
7)Motor Controller (Only if you are using motors instead of servos)
8)Robot Chassis
Step 2: Arduino and Bluetooth
Connect your bluetooth module to arduino.
Now upload this code to your arduino.
#include <SoftwareSerial.h>
#define rxPin 10 //Change this to your rx pin
#define txPin 4 //Change this to your tx pin
SoftwareSerial myserial(rxPin,txPin);
void setup() {
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
myserial.begin(9600);
Serial.begin(9600);
}
void loop() {
while(myserial.available()){
Serial.print((char)myserial.read());
Serial.print(" ");
}
}
Then you need an application on your phone to communicate with arduino. There are many these apps in play store. So, download one THAT HAS TERMINAL MODE. I'm using "Arduino Bluetooth Controller".
Power on your arduino with bluetooth module connected (or with shield).
Open app and connect to your bluetooth module (PIN is 1234 or 0000)
Open Serial Monitor on your pc.
Go to terminal mode on your phone app and type something.
Serial Monitor will show what you typed on your phone.
Now you know how to connect your arduino to your phone with bluetooth.
If you have any problem, leave it in a comment and I will help you :)
Step 3: Connect Your Motors
If you are using DC Motors :
Connect your dc motors to your arduino with a motor controller.
If you are using Servos:
Connect your first servo's
1)Black Wire to ground of your 4xAA Battery Holder (Don't forget to connect this ground to arduino's ground too)
2)Red Wire to +5V of your 4xAA Battery Holder (Put a 470uf capacitor)
3)White Wire to Digital Pin 9 on your arduino
Connect your second servo's
1)Black Wire to ground of your 4xAA Battery Holder
2)Red Wire to +5V of your 4xAA Battery Holder (Put a 470uf capacitor)
3)White Wire to Digital Pin 8 on your arduino
now upload this code to your arduino
#include <Servo.h>
Servo leftmotor;
Servo rightmotor;
void setup() {
leftmotor.attach(8);
rightmotor.attach(9);
}
void loop() {
leftmotor.write(180); //180 = full speed in one direction, 90 = stop, 0 = full speed in other direction
rightmotor.write(0);
}
Now your servos should rotate.
If you have any problem, leave a comment and I will help you
Step 4: Final Step
Now assemble your robot
and upload code below to arduino
Now open your app and go to terminal mode and type "F" : Robot will move forward.
if you type L it will turn left
if you type R it will turn right
if you type S it will stop
Now you are done :)
Next, Make an android app that sends these commands by taping buttons. if you want I can give you my app. ( You can also add accelerometer support)
If you have any problem, please leave it in a comment. :)