If you told me a few years ago that you would be able to modify a RC Car to give it WiFi so you could control via a webpage using your phone, and that the cost to do it would be less than €8, I would not have believed you! But this is an amazing time to be a maker!
Not only is the above very possible, it is also quite a straight forward project! A while back I did a live stream of adding WiFi controls to a toy car, and although I'm happy with how the stream went, I was thinking that i could make the project even simpler.
So I tried to make this tutorial as simple to make as possible, there will be no soldering required and I will provide all the code and steps to make this project for yourself.
Let's get started!
As mentioned, I wanted to make this project as easy to make as possible so actually don't need a whole lot.
Obviously first we are going to need a car. If you are in the UK or Ireland,You can get the exact car I got from Smyths Toys (€10 @ time of writing). They also have a Subaru that I used on the livestream that is the same car except for the shell.
Basically any remote control car should work, but the bigger the better (so we can fit everything inside). Also make sure that it has full range of motion (steering and driving). Second hand shops might be a good place to look for unwanted RC cars. Note: to keep it a solder free project you probably do need to get a car with a wired remote control!
For the insides of the car we need the following
- NodeMCU ESP8266 Development board* - If you aren't familiar with the ESP8266, it's an Arduino compatible board that has built in WiFi, I love it! There are several types of NodeMCU boards, the two common ones are in the 3rd picture make sure you get the right one! (the smaller one).
- NodeMCU Motor Shield* - This is a really nice board that has a L293D motor driver chip on it that the NodeMCU just slots into. There are screw terminals for connecting to the motors and there is a button to turn it on and off
- 6 X AA battery case* - You could also use some other form of power source (such as an RC battery), but just make sure it's less than 10V fully charged. This battery pack is also quite big, if your car is smaller you could try a 4x AA case instead. You may be able to reuse the existing battery slot of the car if you use a car with a non wired remote.
- Jumper Block* - Before buying these, check if you have any old IDE hard drives or CD drives as they will have one of these. If not you can buy this pack of 60 for €1 delivered!
* = Affiliate links
First thing we want to do is open the car up. This will obviously be different if you get a different car than mine!
On mine there were 4 screws on the bottom of the car, two at the back and two at the front. Unscrew these. After lifting off the shell you should now be able to see the two motors.
If you have a wired remote like mine you should also see 4 wires, cut this leaving quite a bit of slack, maybe 6-8 inches or so (It's easy to cut more off later, it's harder to put it back on!).
You then want to strip half an inch or so off the end of all 4 of the wires.
Non wired remote cars will have two motors the same as the wired ones, but the wires attached to them are probably too short to be useful. You may need to solder new longer wire to the two terminals of each motor. I haven't personally done this so I can't really offer any suggestions or tips. You can also try remove as much of the circuitry other than the motors as possible. Note: It may be possible to re-use the battery slot of the car to save space (also makes it easier to change batteries)
And now for the brains of the operation, the circuitry!
Slot the NodeMCU board into the motor shield, note the direction though. There is a antenna drawn on the motor shield, ensure the the NodeMCU's antenna (the gold lines) are lining up with marking. If inserted correctly the micro USB slot should be beside the screw terminals
Next we need to attach the little jumper block. There is jumper pins between the power button and the screw terminals, you need to connect the two pins labeled VIN and VM. See the second photo for more details.
Now we want to connect up the battery case. Take the red wire from the battery holder and connect it to the VIN screw terminal. (The reason we use the VIN terminal is because the power button switches this on and off). Connect the black wire to either of the GND terminals.
If you load batteries into the battery holder and make sure everything is switched on, you show now see some LEDS on the NodeMCU and Motor Shield.
Put the motor shield on the side of the battery back that slides open. I recommend attaching it with blu-tac or some other non permanent way of getting it to stay put. Then attach the battery pack onto the car using blu-tac again. (When you are happy with the car you could use hot glue to hold everything down.)
Next we want to connect the motors to the motor shield. Connect the wires from the steering motor to the screw terminals marked A+ and A-, It doesn't matter which wire goes to the + or the - for the moment (we will come back to this). The drive motor is obviously then connected to the B+ and B- terminals.
If you are finding it hard to push the wire into the terminal, try inserting the screw driver head into where the wire will go, there is a metal piece that can sometimes can be a bit stuck down. (See the 5th picture for more details)
And that's pretty much construction finished! Next we will program the board so we can start testing it out!
If you have never used the ESP8266 or Arduino before, we will need to a little bit of software setup. I have a dedicated video for this. It's only 5 minutes long and goes through everything you need to setup. When following this video, its the CP2102 driver that you want to install.
If videos are not really your thing, check out lesson 2 of Becky's awesome IoT Class, it goes over everything you need as well.
Before you move to the rest of this step you should be able to upload a simple sketch to your ESP8266 (such as the blink example mentioned in both the video and Becky's lesson)
First you want to turn off the power to the board from the batteries (press the button on the motor shield, the lights should be off). You then want to plug your micro USB cable into the NodeMCU board as shown in the picture.You then want to download the code for this project off my Github. Click on the Clone or Download button and then Download Zip. Extract this zip file when it is downloaded.Now open the Arduino IDE, then click File -> Open, navigate to where you just extracted the zip from above and open the MotorWeb.ino fileYou will only need to make one change to this file, and that is to update the SSID and Password for your Wifi. When you have made that change upload it to your board.
We are almost ready to test this thing out! For the moment leave the Micro USB cable plugged in.In the Arduino IDE open the serial monitor (if you are not sure how I have marked it in the first photo). Set the Baud rate to 115200. Press the reset button on NodeMCU board, after it connects to the WiFi you should see the IP address of the device displayed on screen.
Either on your phone or a computer, open up a web browser and type the IP address into the address bar. You should see a web page similar to the one in my second picture.We now need to check are the motors wired the right way. First press the Drive and Back buttons, did the car drive correctly? If not you can either swap the wiring around or you can easily fix it in software, search for drive_direction and switch it from HIGH change it so it is set LOW.
The same thing applies to the steering, except you are swapping around the steer_directions variable
Once your are happy with how its working, plug out the micro USB cable and press the white button on the motor shield. Leave it a few seconds and try connect to the same IP address as before. NOTE: your car will be significantly faster when running on batteries because the voltage is much higher, so be careful you don't drive it off your desk!
And that's it! You have successfully made a WiFi controlled RC car! Check out the short video of me trying to annoy my dogs with it! Gaoithe, the black one doesn't like it too much, but Riggins really doesn't care!
I had a tonne of fun with this project and I hope you find it useful or interesting. As always, if you have any questions or comments I would love to hear them!
Happy making everyone!