Introduction: Arduino Dual Controlled RC Car (Bluetooth and WiFi)

Picture of Arduino Dual Controlled RC Car (Bluetooth and WiFi)

This project will combine software and hardware using an Android app and Arduino module.

Things you will need to complete this project:

1. Any old, second hand or junk RC Car

2. Arduino nano

3. HC-05 / HC-06 Bluetooth module

4. ESP8266 WiFi module

5. L928N H-Bridge Motor Driver

6. 3.3V Regulator

7. Servo Motor for turning the wheel

8. FTDI232 USB to TTL Serial Converter Adapter Module 3.3V 5V FT232RL

Step 1: Flashing Esp8266

Picture of Flashing Esp8266

Download all the necessary files for flashing the esp8266 module here:

And follow the steps from this instructables.

Step 2: The Connection

Picture of The Connection

To put all the modules in RC car, I've cleaned the chassis to make room for the electronic devices.

You can now follow the connection from the image. Then download this app to control the RC car:

https://play.google.com/store/apps/details?id=com....

Arduino code is available on the app.

To see how this actually works:

Thanks and enjoy!.

Step 3:

Comments

Профильз (author)2017-08-01

where is source code of Android App???

Martin17 (author)2016-07-26

hi josapedm

could you please leave the full Arduino code here?

or it will be wonderful if you could email it to me.

i wasn't able to copy the arduino code from the mobile app and I wasn't able to extract it at all.

thanks.

josapedm (author)Martin172016-07-26

Sure. I'll paste it here. I can also send it to you if you want. Just give me ur email so I can give u the .ino files, it would be more convenient.

alifn7 (author)josapedm2017-06-14

hey can you send the ino file to me?? please

josapedm (author)alifn72017-06-14

Hi, it's in the comment below. Try to look at it.

alifn7 (author)josapedm2017-06-15

Its different from code in your app...
And you have video can make it easier in flashing esp8266 or sugestion video from youtube may be..

josapedm (author)alifn72017-06-16

What exactly you need? The ino file or how to flash esp8266?

You can give me your email by the way if you need the ino sketch.

alifn7 (author)josapedm2017-06-18

Both of them ..

Martin17 (author)josapedm2016-07-27

thanks a lot

could you please just paste it here.

I really thank you

semitronics (author)2017-02-16

Sir you can send arduino full code this app

SAKIBH96 (author)2016-11-14

hello Mr. josapedm.

I hope you are fine. I want to make a both bluetooth and arduino controlled car.

and let me tell you that its my first arduino project.

it seems from your avobe soft that you are controlling your car only by wifi.

can you tell me how can I controll it with bluetooth also???

josapedm (author)SAKIBH962016-11-15

Bluetooth controlled is easy to do, just follow the wiring diagram i have posted here.

Adi kush (author)2016-08-05

i want to use simple motor instead of servo motor so what to program for working of simple motor

josapedm (author)Adi kush2016-08-06

You mean arduino sketch?

ISO-JAS (author)2016-03-02

I cant seem to find the code for the Arduino, the app doesn't seem to have the provision for loading it. I'm using a Galaxy S5 and the app looks much different than the example.

josapedm (author)ISO-JAS2016-03-03

Arduino code

#include
#include

// servo
Servo myservo;
SoftwareSerial esp(5,6);
int pos = 45;
const int analogpin = A0;
const int pinForward = 3;
const int pinReverse = 4;
const int BTState = 7; // Bluetooth state on pin 7 of arduino

// byte to receive from android
byte cmd;
char c;
int motorSpeed = 0; // default speed, from 0 to 255

void setup() {
// setup connection
Serial.begin(9600);
esp.begin(115200);
myservo.attach(9);

// setup pin mode
pinMode(analogPin, OUTPUT);
pinMode(pinForward, OUTPUT);
pinMode(pinReverse, OUTPUT);
pinMode(BTState, INPUT);
}

void loop() {
myservo.write(pos);
motorSpeed = 100;

// stop car when connection lost or bluetooth disconnected
if (digitalRead(BTState) == LOW)
{
c = 'S';
myservo.write(pos);
}

if (Serial.available() > 0)
{
cmd = Serial.read();

if (cmd == 'A')
{
motorSpeed = 100;
}
else if (cmd == 'B')
{
motorSpeed = 150;
}
else if (cmd == 'C')
{
motorSpeed = 200;
}
else if (cmd == 'D')
{
motorSpeed = 255;
}
} else if (esp.available() > 0) {

cmd = esp.read();

if (cmd == 'A')
{
motorSpeed = 100;
}
else if (cmd == 'B')
{
motorSpeed = 150;
}
else if (cmd == 'C')
{
motorSpeed = 200;
}
else if (cmd == 'D')
{
motorSpeed = 255;
}
}

analogWrite(analogPin, motorSpeed);

c = cmd;
Serial.println(c);

// FORWARD
if (c == 'F')
{
digitalWrite(pinForward, HIGH); digitalWrite(pinReverse, LOW);
}
// REVERSE
else if (c == 'G')
{
digitalWrite(pinForward, LOW); digitalWrite(pinReverse, HIGH);
}
// STOP
else if (c == 'S')
{
digitalWrite(pinForward, LOW); digitalWrite(pinReverse, LOW);
}
// RIGHT
else if (c == 'R')
{
pos = 90;
myservo.write(pos);
}
// LEFT
else if (c == 'L')
{
pos = 0; myservo.write(pos);
}
// STRAIGHT
else if (c == 'I')
{
pos = 45; myservo.write(pos);
}
}

zeesh1979 (author)josapedm2016-06-02

such a clever and simple approach you used to do this amazing task. i need some help on below:

1. you used ESP in your project but i couldnt see how you are using it in code. are you receiving commands from mobile via bluetooth or wifi?

2. I have HC-06 module. its STATE pin will tell me its connectivity status too or its only HC-05 who does this?

3. can i have android source code for mobile app?

i am working on similar project but to control my quadcopter. i used HC-06 succesfully but i can do good test coz i fear if BT is disconnected then i will loose my quad. i am not sure if HC-06 STATE pin really gives status of BT or no.

waiting for your support. God bless you.

josapedm (author)zeesh19792016-06-02

Question 1: I'm using ESP to receive command from my Androuino App.

Question 2: HC-06 has to state pin. You can do this using HC-05 module only.

Question 3: Sorry it's pretty complicated to give you my Android source code.

HC-06 state pin is not functioning. I've tried that before. You can only succeed using the HC-05 bluetooth module. It's the module I know that has a state capability in case you loose connection.

Let me know if you have more questions. I'll be happy to response and help you. You can also check my Android App if you want to make or suggest an improvement of if you want me to add more functionality to the app so that your need will be met using my app. I'm frequently updating my App based on the demand of my users. Thank you.

Good luck and God bless also...

All the best,

zeesh1979 (author)josapedm2016-06-02

Thanks Josapedm for your quick response which usually lacks on such forums. i totally agree with the complexity of your sharing android code but can you just tell me which java class you used for sending data?

for HC-06, you are right that state pin doesnt help u but were u able to find out what is the purpose of this STATE pin?

from your article, i can summarise the steps as below:

1. flash ESP with nodemcu_integer_0.9.6-dev_20150406.bin you put on github

2. connect ESP with pin 5 and 6 (skip BT part as main communication is via wifi)

3. send output to ESC to run motor

4. send control commands from android app

5. you are using BT just to make sure the connection with app is alive (dont we have similar function in ESP?)

josapedm (author)zeesh19792016-06-02

Hi,

BT state usually work when the connection is lost or there's no live connection between two devices. It work like a continuous talking of two devices once established the connection.

For the complete documentation or example code of java class. If you're familiar with Android Studio, you can view the example Bluetooth chat app from the IDE. I have used most of my java codes from this example. This is a very good starting point and I recommend it to you.

We can achieve the same functionality using esp and this will be implimented starting from my next updated lua script.

josapedm (author)ISO-JAS2016-03-03

The source code for arduino is available on the app in arduino code menu.

However if there's something wrong with the app. Could you take screen shots of the problem you're having with the app and kindly send it to me in this email: androuino.info@gmail.com.

I'll do my best to solve this issue.

Thanks‥.

zeesh1979 (author)josapedm2016-06-02

can you please share the ESP8266 library you used here and also did you programme it as well?

josapedm (author)zeesh19792016-06-02

Hi this is the link for my lua script: https://github.com/androuino/esp8266-files-for-fla... Yes I wrote it myself.

josapedm (author)ISO-JAS2016-03-03

Could you also provide me the Android Version of your Galaxy S5? Thanks.

sanchitgupta456 (author)2016-02-18

pls give better documentation with everything concerned.

thanks for idea, but i already had it.

josapedm (author)sanchitgupta4562016-02-18

Glad you had it working.

I will update this post with proper and detailed documentation after I finish my new android application that I'm currently working on. Also I'm updating my Androuino app to recieve data from arduino and display it and also enabling the app to connect both wifi and bluetooth connection at the same time. I'm also giving the user to send what data they want to send to arduino.

Dushyanta (author)2015-10-30

The idea is great but it would be good if you give a better documentation.

About This Instructable

16,741views

65favorites

License:

More by josapedm:Arduino Dual Controlled RC Car (Bluetooth and WiFi)
Add instructable to: