Arduino Dual Controlled RC Car (Bluetooth and WiFi)

19,437

66

27

Intro: 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

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

And follow the steps from this instructables.

Step 2: 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:

Share

    Recommendations

    • Plastics Contest

      Plastics Contest
    • Optics Contest

      Optics Contest
    • Electronics Tips & Tricks Challenge

      Electronics Tips & Tricks Challenge

    27 Discussions

    0
    None
    Martin17

    2 years ago

    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.

    7 replies
    0
    None
    josapedmMartin17

    Reply 2 years ago

    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.

    0
    None
    alifn7josapedm

    Reply 1 year ago

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

    0
    None
    josapedmalifn7

    Reply 1 year ago

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

    0
    None
    alifn7josapedm

    Reply 1 year ago

    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..

    0
    None
    josapedmalifn7

    Reply 1 year ago

    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.

    0
    None
    Martin17josapedm

    Reply 2 years ago

    thanks a lot

    could you please just paste it here.

    I really thank you

    0
    None
    semitronics

    1 year ago

    Sir you can send arduino full code this app

    0
    None
    SAKIBH96

    1 year ago

    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???

    1 reply
    0
    None
    josapedmSAKIBH96

    Reply 1 year ago

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

    0
    None
    Adi kush

    2 years ago

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

    1 reply
    0
    None
    ISO-JAS

    2 years ago

    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.

    5 replies
    0
    None
    josapedmISO-JAS

    Reply 2 years ago

    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);
    }
    }

    0
    None
    zeesh1979josapedm

    Reply 2 years ago

    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.

    0
    None
    josapedmzeesh1979

    Reply 2 years ago

    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,

    0
    None
    zeesh1979josapedm

    Reply 2 years ago

    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?)

    0
    None
    josapedmzeesh1979

    Reply 2 years ago

    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.