Internet-Controlled RC Car

by randofo in Circuits > Arduino

173232 Views, 776 Favorites, 0 Comments

Internet-Controlled RC Car

main.jpg

The Internet Controlled RC Car allows you to remotely drive around a small rc car from wherever you may be and see where it is going. This is fun because you can remote explore whatever space you leave it in, or hand over the keys - so to speak - and allow someone to drive around your space. This is also a great building block for a telepresence robot.

This project is also a great beginner project for someone who has made a few simple things and is looking to get slightly deeper into the world of microcontrollers. It starts to incorporate more advanced skills like circuit building and networking, but is not dauntingly complex.

Materials

1A.jpg

You will need:

(x1) RC car
(x1) Wireless camera
(x1) Arduino Uno
(x1) Ethernet Shield
(x1) Rectangular PCB
(x1) 1" round PCB
(x1) 7805 5V regulator
(x1) 10uF capacitor
(x1) 0.1uF capacitor
(x1) Power jack
(x1) Power plug
(x4) 5V SPST relays
(x1) 6" x 4" x 2" project enclosure
(x1) 7.2V rechargeable battery
(x5) AA batteries
(x1) Ethernet cable
(x1) USB cable
(x1) Assorted zip ties
(x1) Shrink tube
(x1) M3 nut, bolt and washer

(Please note that some of the links on this page contain Amazon affiliate links. This does not change the price of any of the items for sale.)

Insert the Shield

3A.jpg
3B.jpg
3C.jpg

Insert the shield's male header pins in the matching female header pins on the Arduino.

Remove the Cover

2A.jpg
2B.jpg
2C.jpg

Remove the four screws from the bottom of the RC car keeping the top plastic cover in place, and put the screws aside for later reassembly.

Remove the top cover.

Power Conversion Circuit

4A.jpg
4B.jpg
RCpowerSchematic.png

Build the circuit to convert 7.2V to 5V on the 1" round PCB as specified in the schematic.

Plug

5A.jpg
5B.jpg

Attach a red wire between the 5V output on the power conversion PCB and the K-type plug's center pin.

Attach a black wire between ground and the outer jack connection.

Twist the cover on the jack shut to insulate it.

M-type Socket

6A.jpg
6B.jpg
6C.jpg

Connect a black wire between ground on the round power conversion PCB to the center pin on the M-type jack.

Connect another black wire to the pinon the M-type jack to the left of center.

Connect two red wires to the pin to the right of center. Connect one of these red wires to the power input pin of the LM7805 voltage regulator.

Connect a Battery

7A.jpg
7B.jpg
7C.jpg
7D.jpg
7E.jpg
7F.jpg

Cut the power connector off of the 7.2V rechargeable battery.

Solder the red wire from the battery to the unused red wire from the M-type jack.

Solder the black wire from the battery to the unsused black wire from the M-type jack.

Insulate any exposed connections with shrink tube.

Remove the Circuit Board

8A.jpg
8B.jpg
8C.jpg
8D.jpg
8E.jpg
8F.jpg

Remove the screws from the remote control and open the case.

Next, remove the screw securing the circuit board in place, and cut the wires going to the battery compartment to free it from the case.

Clean the Contacts

9B.jpg
9A.jpg

Use a Q-tip covered in rubbing alcohol to clean any grease that may be on the contacts for the joystick controls.

Solder Wires

10A.jpg
10B.jpg
10C.jpg

Solder wires to each of the contact pads for the remote control's joysticks.

Relays

11A.jpg

Solder four relays to the rectangular PCB board.

Wire It Up

12A.jpg
12B.jpg
12C.jpg

Wire the remote control board to the relay board as specified in the wiring diagram.

Connect the Arduino

14A.jpg
13A.jpg

Connect the Arduino to the relay board as specified in the circuit diagram.

Program

15A.jpg

Setting up the wifi camera could be an Instructable unto itself, and I am not going to go over it here. That said, it comes with a pretty thorough instruction booklet for getting it configured. To get it running, just follow along with the instruction booklet that came with the camera.

What I will go over is the Arduino program.

Fortunately, there is not much to cover. The Arduino will be used to load a website at specific IP address. When you click on the links on this website, it will send HTTP requests back to the Arduino. These requests are then processed by the Arduino to trigger the relays connected to the car's remote control. When the relays are toggled high, the remote is activated and the car moves around. You can then see where it moves by loading the web interface for the IP camera in the background.

To prepare the Arduino, simply program it with the following code:

  /*********************************

  Internet Controlled RC Car    

  For more info visit:
  <a href="https://www.instructables.com/Internet-Controlled-RC-Car/"> https://www.instructables.com/Internet-Controlled-...</a>

  Code is in the public domain

  ***********************************/



  //include necessary libraries
  #include <SPI.h>
  #include <Ethernet.h>

  //mac address does not change
  byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; 
    
  //change this to your IP address
  //this can be found by running the program
  //File --> Examples --> Ethernet --> DhcpAddressPrinter
  IPAddress ip(192,168,2, 7);

  // Initialize the Ethernet server library
  // with the IP address and port you want to use 
  // (port 80 is default for HTTP):
  EthernetServer server(80); 
     
  String webClickRequest;
     
     
  void setup(){
    
     // initialize the digital pin as an output.
     pinMode(4, OUTPUT); 
     pinMode(5, OUTPUT); 
     pinMode(6, OUTPUT); 
     pinMode(7, OUTPUT); 
     
     
     // Open serial communications and wait for port to open:
     Serial.begin(9600);
     while (!Serial) {
       ; // wait for serial port to connect. Needed for Leonardo only
     }
     
     
     // start the Ethernet connection and the server:
     Ethernet.begin(mac, ip);
     server.begin();
     Serial.print("server is at ");
     Serial.println(Ethernet.localIP());
   }
   
    
    void loop(){
      // Create a client connection
      EthernetClient client = server.available();
      if (client) {
        while (client.connected()) {
          if (client.available()) {
            char c = client.read();
     
            //read the incoming HTTP request
            if (webClickRequest.length() < 100) {
     
              //store the request to a string 
              webClickRequest += c;

            }
     
            //check to see if the request has come to an end
            if (c == '\n') {
     
              //Begin drawing out the website using
              //using basic HTML formatting with some CSS
              client.println("HTTP/1.1 200 OK"); 
              client.println("Content-Type: text/html");
              client.println();
              client.println("<HTML>");
              client.println("<HEAD>");
              client.println("<TITLE>Internet Controlled RC Car</TITLE>");
              client.println("<STYLE>");
              client.println("body{margin:50px 0px; padding:0px; text-align:center;}");
              client.println("h1{text-align: center; font-family:\"Trebuchet MS\",Arial, Helvetica, sans-serif; font-size:24px;}");
              client.println("a{text-decoration:none; width:75px; height:50px; border-color:black; font-family:\"Trebuchet MS\",Arial, Helvetica, sans-serif; padding:6px; background-color:#aaaaaa; text-align:center; border-radius:10px 10px 10px; font-size:24px;}");
              client.println("a:link {color:white;}");
              client.println("a:visited {color:white;}");
              client.println("a:hover {color:red;}");
              client.println("a:active {color:white;}");
              client.println("</STYLE>");
              client.println("</HEAD>");
              client.println("<BODY>");
              client.println("<H1>Internet Controlled RC Car</H1>");
              client.println("<br />");
              client.println("<br />");        
              client.println("<a href=\"/?left\"\">LEFT</a>");
              client.println(" ");
              client.println("<a href=\"/?forward\"\">FORWARD</a>");  
              client.println(" ");      
              client.println("<a href=\"/?right\"\">RIGHT</a>");
              client.println("<br />");
              client.println("<br />");
              client.println("<br />");            
              client.println("<a href=\"/?backleft\"\">BACK LEFT</a>");
              client.println(" ");
              client.println("<a href=\"/?back\"\">BACK</a>");
              client.println(" ");  
              client.println("<a href=\"/?backright\"\">BACK RIGHT</a>");
              client.println("</BODY>");
              client.println("</HTML>");
     
              //Stop loading the website     
              delay(1);
              client.stop();
     
     
     
            //check to see if any of the drive commands have been sent
            //from the webpage to the Arduino
            
            if(webClickRequest.indexOf("?left") > 0){
              Serial.println("hello");
                  left();
                  delay(1000);
                  brake();
            }

            else if(webClickRequest.indexOf("?forward") >0){
                forward();
                delay(1000);
                brake();
            }
            
            else if(webClickRequest.indexOf("?right") >0){
                right();
                delay(1000);
                brake();
            }
            
            else if(webClickRequest.indexOf("?backleft") >0){
                left();
                reverse();
                delay(1000);
                brake();
            }
            
            else if(webClickRequest.indexOf("?back") >0){
                reverse();
                delay(1000);
                brake();
            }
            
            else if(webClickRequest.indexOf("?backright") >0){
                right();
                reverse();
                delay(1000);
                brake();
            }
            
            
            //clear the string for the new incoming data
            webClickRequest="";
     
            }
          }
        }
      }
    }

  //drive functions
  //here on down
  
  void reverse(){ 
    digitalWrite(4, LOW);
    digitalWrite(5, HIGH); 
  }

  void forward(){
    digitalWrite(4, HIGH);  
    digitalWrite(5, LOW);   
  }

  void right(){
    digitalWrite(6, HIGH);  
    digitalWrite(7, LOW);  
  }

  void left(){
    digitalWrite(6, LOW);   
    digitalWrite(7, HIGH);  
  }

  void brake(){
    digitalWrite(4, LOW);    
    digitalWrite(5, LOW);
    digitalWrite(6, LOW);   
    digitalWrite(7, LOW); 
  }

Reattach the Antenna

16A.jpg
16B.jpg

Attach the antenna back to the appropriate part of the remote control board using a nut, bolt and washer.

Drill

17A.jpg
17B.jpg
17C.jpg

Drill a 1/4" hole near the corner on the front face of the project enclosure.

Drill a 3/4" hole on the side of the enclosure.

Insert Wires

18A.jpg
18B.jpg

Insert an ethernet and USB cable through the 3/4" hole.

Note: If you don't have a computer to keep this powered up, you can replace the USB cable with a 9V power plug for the Arduino's m-type power jack.

Put It Together

19A.jpg
19B.jpg
19C.jpg
19D.jpg
19E.jpg

Plug the ethernet cable into the Ethernet Shield and the USB cable into the Arduino.

Place the Arduino and related circuitry inside of the enclosure, and pass the antenna through the 1/4" hole in the enclosure.

Finally, close the case using the lid and mounting hardware.

Batteries and Zip Tie

20A.jpg
20B.jpg
20C.jpg
20D.jpg

Remove the battery compartment lid from the RC car and insert five AA batteries.

Weave a zip tie through the holes in the lid and fasten it shut.

Drill

21A.jpg
21B.jpg

Drill a 3/8" hole through both of the plastic tabs protruding from the center-top of the RC car frame.

Attach the Camera Stand

22A.jpg
22B.jpg
22C.jpg
22D.jpg
22E.jpg

Pass a zip tie through the holes drilled through the tabs in the top of the case and use this to secure the camera mount in place.

Next, attach another zip tie to the one already woven through the battery compartment and use this to hold down the camera mount.

Tighten the zip ties and add additional ones as necessary to make sure that the camera mount is held securely in place.

Remove the Mount

23A.jpg
23B.jpg

Remove the camera ball-socket mount (if you have not done so already).

Drill the Car

24A.jpg
24B.jpg
24C.jpg

Drill a 1/2" hole in the top of the RC car frame at the point the camera mount will pass through.

Drill 1/8" holes near each of the four corners of the back windshield.

Attach the Battery

25A.jpg
25B.jpg
25C.jpg
25D.jpg

Using the four holes drilled in the corner of the windshield, zip tie the 7.2V rechargeable battery in place on the inside of the case.

Mount the Jack

26A.jpg
26B.jpg
26C.jpg

Drill a 1/4" hole in the car's rear bumper and mount the M-type jack using its mounting hardware.

Pass the Plug

27A.jpg
27B.jpg

Pass the K-type plug through the hole in the roof of the car.

Hot Glue

28A.jpg
28B.jpg

Hot glue the 5V regulator board somewhere safe and out of the way on the inside of the frame.

I found that the between the two protruding tabs on the top of the frame worked really well.

Fasten the Lid

29A.jpg
29B.jpg

Fasten the lid and the car's frame back together using its mounting screws.

Mount the Camera

30A.jpg
30B.jpg
30C.jpg

Lock the camera mount back onto the camera's stand, and then fasten the camera in place.

Turn It On

31A.jpg
31B.jpg

To turn on the car, hit the on switch on the underside of its frame and plug the K-type plug into the camera.

internet car.png

To use, simply load the IP address of your ethernet shield in a web browser and in another window load the IP camera.

Did you find this useful, fun, or entertaining?
Follow @madeineuphoria to see my latest projects.