Introduction: Raspberry Pi 2 WiFi RC Car

About: I am a .NET Developer, Tech Entrepreneur @CouncilSoft and Blogger @CodeRewind which is a place for developers, designers and tech enthusiasts who wants to keep up with new technologies and trends in Web, Apps,…

In this tutorial we will go over how to convert an old RC car to work over WiFi or internet using Raspberry Pi 2. So you put geek hats on and lets get started. I have seen few RC Car projects on the web but they either were ESC (electronic speed controllers) based or 4 motor robotic type projects. This project uses 2 motors, one for throttle and the other for steer. You will be able to control this RC Car from any device (phone/tablet/laptop/desktop).

This is purely based on WebIOPi framework which provides easy HTML/JQuery based implementation to call Python scripts which contains the macros.

Step 1: Components We Need

Step 2: Wiring Pi and Components

In order to correctly complete the wiring we need to understand the Raspberry Pi 2 GPIO pins which are used to connect various components to the Pi. These pins send the signals to the components connected, which could be turning on a light to driving a motor or reading data from a temperature or proximity sensor.

The ones highlighted in green are the 17 basic GPIO pins which is what we are going to use in our project. These pin can be configured in either input or output mode.

I connected the Anode (+ve) of 2 sets of LED’s for left and right turn signals with one 330Ω resistor each. Resistors help keep the amount of current passing through the LED’s at a correct level, otherwise you could burn out the LED very quickly.

Step 3: Connecting Pi and L298N Motor Drive Controller

If you look at the above wiring you will notice that i connected the 9V supply to the L298N Dual H Bridge which will further power up the 9V Motors. Now, you may ask why do i need this additional component to power motors. Can I connect the motors to the Raspberry Pi GPIO pins? The answer is yes and no. The reason why we rely on a motor drive controller is because this can handle two motors up to 35V. Raspberry Pi only sends a maximum of 3.3V as its high signal. It not only provides enough power but controls direction and speed as i explained earlier.

L298N Motor Drive Controller Dual H-Bridge is the key component of my Raspberry Pi WiFi RC Car which powers all the motors and sends signal to controls the direction and speed of the motors. This controller can drive 2 motors with PWM (Pulse Width Modulation) signal. PWM in itself is a vast topic so we won’t cover it here. Think of this as a technique to control the amount of power going through pretty much anything you want.

Step 4: Software Required

Step 5: Installing Prerequisites

Format the SD card and install Raspbian Wheezy using Noobs or directly – https://www.raspberrypi.org/help/noobs-setup/

Update your Raspberry Pi using the script by Rob Seder

Install the WiFi adapter and connect to your wireless network

Now install WiringPi using the following commands

sudo apt-get install git-core
sudo git clone git://git.drogon.net/wiringPi
cd wiringPi
sudo git pull origin
sudo ./build

To use WiringPi to help you make proper GPIO connection type the following commands

gpio -v
gpio readall

To install WebIOPi type the following commands

$ sudo wget  http://sourceforge.net/projects/webiopi/files/Web...
$ sudo tar xvzf WebIOPi-x.y.z.tar.gz
$ cd WebIOPi-x.y.z
$ sudo ./setup.sh

Step 6: Confgiuring WebIOPi and Weaved

The basic configuration required is to tell where our custom python script will reside which can be done by editing the config file under HTTP section using the following command.

$ sudo nano /etc/webiopi/config
//Edit this section of the config, mainly the doc-root and welcome-file attributes. [HTTP] enabled = true port = 8000 doc-root = /home/pi/picar welcome-file = index.html


To start webiopi service with verbose output and the default config file. This is recommended when developing and debugging your scripts.

$ sudo webiopi -d -c /etc/webiopi/config

You can also start/stop the background service, the configuration will be loaded from /etc/webiopi/config.

$ sudo /etc/init.d/webiopi start
$ sudo /etc/init.d/webiopi stop //To check if the service is running or not $ sudo /etc/init.d/webiopi status


Once you are done building your project you should put this service to auto start when the Pi boots. To manage service at boot here are the commands.

//To setup your system to start webiopi at boot:
$ sudo update-rc.d webiopi defaults //To remove webiopi start from boot: $ sudo update-rc.d webiopi remove

Step 7: Building User Interface

To access the pi over local network open a browser and navigate to http://ipAddressOfPi:8000/ from any device in your network. Make sure to type the ip address of the Pi in the url. Default user “webiopi” and password is “raspberry“.

UI is pretty much a basic HTML page with images mapped for directions and stop commands that are wired to the onmousedown event. Those events are then mapped to the python macros which are exposed by the webiopi framework.

Step 8: Conclusion

I hope you enjoyed this tutorial and will try to build something interesting. Let me know what you think about this project. Further I plan add the following features to this project.

  • Adding Telemetry Support – includes reading temperature, speed of the motors, real time battery status
  • Low Battery Notification
  • Integrate Pi Camera Module
  • Remove UI lag and make it more responsive
  • Allow Device Accelerometer