Project tutorial
Wi-Fi RC Car - Qi Enabled

Wi-Fi RC Car - Qi Enabled © GPL3+

This is a project that will show you how to create a Wi-Fi controlled RC Car that will recharge wirelessly while it is parked.

  • 10,988 views
  • 6 comments
  • 36 respects

Components and supplies

Necessary tools and machines

09507 01
Soldering iron (generic)
Hy gluegun
Hot glue gun (generic)
Screwdriver
Voltmeter

Apps and online services

About this project

What will you Build in this Project?

This is a project that will show you step by step how to create a Wi-Fi controlled RC Car that will automatically recharge wirelessly while it is parked.

How it works?

The brain of the project is the Arduino MKR1000 and it is connected through Wi-Fi with your mobile device. The Arduino board is powered by a 3.7V Li-Po battery. For the motor control an L293DNE motor driver is used. However it needs at least 4.5V to operate. We will step up voltage from 3.7V to 5V with a Step-up boost Power Converter Module (converts low voltage to higher) and in this way the motor driver will be powered with 5V.

For charging the battery, the Arduino MKR1000 board features an automatic charging system for Li-Po batteries. When an external source (5V DC) of power is connected, the battery that is connected to the board is being charged. So the IDT P9025AC-R-EVK – Qi 5W Receiver will be connected to the Arduino board as an external source (5V DC). When the car parks over the charging station (which is the IDT P9038-R-EVK – Qi 5W Transmitter), the battery will charge.

The control system features two speed modes: Fast and Slow.

How to build it?

Hardware Part

Solder wires on the motor poles and on the IDT Receiver board (Pin OUT with red wire and pin GND with black wire). For this step you will need a soldering iron and 6 wires.

Making the electronic circuit. You can use a breadboard to create your circuit or else you can solder all the connections.

CAUTION: Use a 3.7V Li-Po battery with at least 700mAh capacity! Otherwise the battery may overheat and explode!

Adjusting the CN6009. Step-up power converter module to 5V. To adjust CN6009's output value use a screwdriver. Be sure to check the output voltage (by connecting a Voltmeter to the pins OUT+ and OUT-).

Connecting the IDT wireless power Qi 5W receiver. Take a piece of plastic (e.g. plastic card) to make a base for the Wireless Power Receiver on the bottom of the car. Then glue the piece of plastic as well as the Receiver to the bottom of the car with silicone. Finally, connect the red wire of the IDT Receiver to the VIN pin of the arduino and the black wire to the GND pin.

Making the Vehicle Stable. Fasten with tie wraps the battery and the breadboard to the vehicle.

Software Part – Wi-Fi Connection

For this part just copy the code. In the code file fill in your network SSID and Password (lines 12, 13 in the code file). You need to follow the comment instructions. The code is currently set to work with WPA/WPA2 networks. If you want to connect to a WEP or an open network follow the instructions in the comments of the code (lines 34-37).

How to use it?

Step 1: Connecting to the Arduino MKR1000

Controlling the vehicle requires Wi-Fi connection. You can achieve that with two ways. The first one is to enable Wi-Fi Hotspot on your mobile device and connect the board to the Hotspot. The second one is to connect your mobile device and the Arduino board to the same Wi-Fi router. Be sure to fill in your router’s SSID and Password settings in the code file that will be uploaded to the Arduino board.

Note: It is better to use the first method (Wi-Fi Hotspot) because in this way you can control your vehicle without the need of a router.

Step 2: Getting the IP Address of the Arduino MKR1000

If the Arduino board is connected to the hotspot of your mobile device, go to Wi-Fi Hotspot settings and there you will see the IP address of your board (e.g. 192.168.1.1).

If the Arduino board is connected to a Wi-Fi router then you need to check that from the router settings.

The LED on the car indicates successful connection to the specified network and server activation.

Step 3: Accessing the Webserver of the Arduino MKR1000

Go to your browser and in the URL box type the IP address of your Arduino.

How to connect

Step 4: Connecting the Charging Base

Connect the IDT P9038-R-EVK – Qi 5W Transmitter to a wall socket using a 5V DC Adapter.

Step 5: Have Fun!

Charging Time!!

Wireless Charging
UI

Test Drive:

Gerber files of PCBWeb

Code

Arduino_IDT_Wi-Fi_Car.inoArduino
Replace example and password in lines 12-13 with your ssid and password respectively.
#include <SPI.h>
#include <WiFi101.h>

const int motor1Control = 2; // Right motor
const int motor2Control = 3; // Left motor
const int motor1Input1 = 4;
const int motor1Input2 = 5;
const int motor2Input1 = 8;
const int motor2Input2 = 9;
const int wifiLed = 10; // For indicating successful Wi-Fi connection

char ssid[] = "example";   // Fill in your network SSID (name)
char pass[] = "password"; // Fill in your network password
int keyIndex = 0;          // Fill in your network key Index number (Optional - needed only for WEP)

int status = WL_IDLE_STATUS;
String readString;

WiFiServer server(80); // Define the port of the server

String speedMode = "fast";

void setup() {
  pinMode(motor1Control, OUTPUT);
  pinMode(motor2Control, OUTPUT);
  pinMode(motor1Input1, OUTPUT);
  pinMode(motor1Input2, OUTPUT);
  pinMode(motor2Input1, OUTPUT);
  pinMode(motor2Input2, OUTPUT);
  pinMode(wifiLed, OUTPUT);
  
  // Attempt to connect to Wifi network:
  while ( status != WL_CONNECTED) { 
    // Connect to WPA/WPA2 network. Change this line if using open or WEP network:
    // For WEP network, replace with: status = WiFi.begin(ssid, keyIndex, pass);
    // For open network, replace with: status = WiFi.begin(ssid);
    status = WiFi.begin(ssid, pass);
    // wait 10 seconds for connection:
    delay(10000);
  }

  // Begin the webserver
  server.begin();
  // Indicate that the server is running
  digitalWrite(wifiLed, HIGH);
}

void loop() {
  // Listen for incoming clients
  WiFiClient client = server.available();
  if (client) {
    // an http request ends with a blank line
    boolean currentLineIsBlank = true;
    while (client.connected()) {
      if (client.available()) {
        char c = client.read();
        // If you've gotten to the end of the line (received a newline
        // character) and the line is blank, the http request has ended,
        // so you can send a reply
        
        if (readString.length() < 100) {
          //store characters to string
          readString += c;
        }
        
        if (c == '\n') {
          // send a standard http response header
          client.println("HTTP/1.1 200 OK");
          client.println("Content-Type: text/html");
          client.println();
          client.println("<!DOCTYPE HTML>");
          client.println("<html>");
          client.println("<head>");
          client.println("<style>");
          client.println("a.button {-webkit-appearance: button;");
          client.println("-moz-appearance: button;");
          client.println("appearance: button;");
          client.println("height:400px;");
          client.println("line-height:400px;");
          client.println("text-align:center;");
          client.println("text-decoration: none;");
          client.println("font-size: 100px;");
          client.println("color: initial;}");
          client.println("</style>");
          client.println("</head>");
          client.println("<body>");
          // Button for moving Forwards
          client.println("<a href=\"/?moveForwards\" class=\"button\" style=\"width:100%;\"\">FORWARDS</a>");
          client.println("<br />");
          // Button for turning Left
          client.println("<a href=\"/?turnLeft\" class=\"button\" style=\"width:35%;\"\">LEFT</a>");
          // Button for Stopping the car
          client.println("<a href=\"/?stopMoving\" class=\"button\" style=\"width:29%;\"\">STOP</a>");
          // Button for turning Right
          client.println("<a href=\"/?turnRight\" class=\"button\" style=\"width:35%;\"\">RIGHT</a>");
          client.println("<br />");
          // Button for moving Backwards
          client.println("<a href=\"/?moveBackwards\" class=\"button\" style=\"width:100%;\"\">BACKWARDS</a>");
          client.println("<br />");
          client.println("<br />");
          // Button for moving Backwards
          client.println("<h1 style=\"text-align:center;\">SPEED MODES</h1>");
          client.println("<a href=\"/?fast\" class=\"button\" style=\"width:45%;\"\">FAST</a>");
          client.println("<a href=\"/?slow\" class=\"button\" style=\"width:45%;\"\">SLOW</a>");
          client.println("</body>");
          client.println("</html>");
           break;
        }
        
        // Decide which button was clicked (if any)
        // Fast Mode button
        if (readString.indexOf("?fast") > 0){
          speedMode = "fast";
          // Clear the readString to be able to get the next command
          readString = "";
        }
        // Slow Mode button
        if (readString.indexOf("?slow") > 0){
          speedMode = "slow";
          // Clear the readString to be able to get the next command
          readString = "";
        }
        // Fast Mode
        if (speedMode == "fast"){
          if (readString.indexOf("?moveForwards") > 0){
            moveForwards();
            // Clear the readString to be able to get the next command
            readString = "";
          }
          if (readString.indexOf("?moveBackwards") > 0){
            moveBackwards();
            // Clear the readString to be able to get the next command
            readString = "";
          }
        } else if (speedMode == "slow"){
          // Slow Mode
          if (readString.indexOf("?moveForwards") > 0){
            moveForwardsSlow();
            // Clear the readString to be able to get the next command
            readString = "";
          }
          if (readString.indexOf("?moveBackwards") > 0){
            moveBackwardsSlow();
            // Clear the readString to be able to get the next command
            readString = "";
          }
        }
        if (readString.indexOf("?turnLeft") > 0){
          turnLeft();
          // Clear the readString to be able to get the next command
          readString = "";
        }
        if (readString.indexOf("?turnRight") > 0){
          turnRight();
          // Clear the readString to be able to get the next command
          readString = "";
        }
        if (readString.indexOf("?stopMoving") > 0){
          stopMoving();
          // Clear the readString to be able to get the next command
          readString = "";
        }
      }
    }
    // Give the web browser time to receive the data
    delay(1);
    // Close the connection:
    client.stop();
  }
}

// Commands for moving forwards
void moveForwards(){
  digitalWrite(motor1Control, HIGH);
  digitalWrite(motor2Control, HIGH);
  digitalWrite(motor1Input1, LOW);
  digitalWrite(motor1Input2, HIGH);
  digitalWrite(motor2Input1, LOW);
  digitalWrite(motor2Input2, HIGH);
}
// Commands for moving backwards
void moveBackwards(){
  digitalWrite(motor1Control, HIGH);
  digitalWrite(motor2Control, HIGH);
  digitalWrite(motor1Input1, HIGH);
  digitalWrite(motor1Input2, LOW);
  digitalWrite(motor2Input1, HIGH);
  digitalWrite(motor2Input2, LOW);
}
// Commands for turning right
void turnRight(){
  // Lower voltage is provided to turn slower - better control
  analogWrite(motor1Control, 0);
  analogWrite(motor2Control, 200);
  digitalWrite(motor1Input1, HIGH);
  digitalWrite(motor1Input2, LOW);
  digitalWrite(motor2Input1, LOW);
  digitalWrite(motor2Input2, HIGH);
}
// Commands for turning left
void turnLeft(){
  // Lower voltage is provided to turn slower - better control
  analogWrite(motor1Control, 200);
  analogWrite(motor2Control, 0);
  digitalWrite(motor1Input1, LOW);
  digitalWrite(motor1Input2, HIGH);
  digitalWrite(motor2Input1, HIGH);
  digitalWrite(motor2Input2, LOW);
}
// Commands for stopping the car
void stopMoving() {
  digitalWrite(motor1Control, LOW);
  digitalWrite(motor2Control, LOW);
  digitalWrite(motor1Input1, LOW);
  digitalWrite(motor1Input2, LOW);
  digitalWrite(motor2Input1, LOW);
  digitalWrite(motor2Input2, LOW);
}
// Commands for low speed forward moving
void moveForwardsSlow(){
  analogWrite(motor1Control, 200);
  analogWrite(motor2Control, 200);
  digitalWrite(motor1Input1, LOW);
  digitalWrite(motor1Input2, HIGH);
  digitalWrite(motor2Input1, LOW);
  digitalWrite(motor2Input2, HIGH);
}
// Commands for low speed backward moving
void moveBackwardsSlow(){
  analogWrite(motor1Control, 200);
  analogWrite(motor2Control, 200);
  digitalWrite(motor1Input1, HIGH);
  digitalWrite(motor1Input2, LOW);
  digitalWrite(motor2Input1, HIGH);
  digitalWrite(motor2Input2, LOW);
}

Custom parts and enclosures

PCBWeb
Arduino%20IDT%20Wireless%20charging%20wifi%20car.cad

Schematics

Schematic
Wifi car 4

Comments

Similar projects you might like

Turn your RC Car to Bluetooth RC car

Project tutorial by Prajjwal Nag

  • 11,981 views
  • 1 comment
  • 11 respects

Arduino 4WD RC Car

Project tutorial by Andriy Baranov

  • 13,133 views
  • 3 comments
  • 43 respects

Smartphone Controlled Arduino 4WD Robot Car

Project in progress by Andriy Baranov

  • 53,239 views
  • 43 comments
  • 98 respects

RC Toy Car Using nRF24L01

Project tutorial by Jayraj Desai

  • 3,309 views
  • 0 comments
  • 9 respects

Make your first Arduino robot - The best beginners guide!

Project tutorial by Muhammed Azhar

  • 44,085 views
  • 15 comments
  • 98 respects

Android Arduino RC Car

Project tutorial by RAFI RASHEED T C

  • 15,340 views
  • 2 comments
  • 38 respects
Add projectSign up / Login