Raspberry Pi Smartphone Controlled Rc Car
Use your raspberry pi to control a 1/10 scale RC car via a web page hosted wirelessly on your PI. All you need to do is set up your PI to use your mobile as a hotspot then log onto the appropriate web page (hosted by the Pi) and tilt your phone to control your car like a Wii Remote. I’ve used an old Tamiya hornet in this example; any car will do but if you are buying one try and get one with enough space under the bodyshell to fit all your electronics. This is a fork of an existing github project that I’ve modified to make easier to install and to get rid of some components. It’s also possible to add a video camera but I didn’t do this.
The main project page is hosted here if you need more information:
Step 1: Step 1 Measure servo signal levels.
We’ll be using PWM to control the servos which will be capable of driving 0-3.3V in 3.3mv steps; it is therefore necessary first to measure what your servo command signal voltage levels are and check they fall within this range. You can do this with a multi-meter connected to the receiver pins. On my car speed and steering both use 3 pin headers which are wired:
- Gnd – Black
- Power – Red
- Throttle / Steer – Orange or White
For my car the throttle voltages were:
- Full Fwd: .19
- VIdle: .28V
- Full Reverse: .36V
The steering voltages were:
- Full Left: .19V
- Fwds: .28V
- Full Right: .355V
Once you are happy about how you are going to power your PI and that the GPIO are up to the job you can start thinking about wiring it up.
Step 2: Step 2 Wire up your car
For the servo 3 pin headers I used 2.54mm PCB header and soldered wired direct. I then used superglue to stop the pins moving about. You’ll also need heat-shrink or equivalent to cover over the solder joints. To power the PI I chopped a micro USB cable and used the black and red wires from that as my 5V supply. For my linear power supply I used an LM7805 circuit and put a heatsink on it to keep it nice and cool.
I then attached a PP3 battery clip and 6xAA pack with a PP3 connector on it. I’ve also used a 26w header socket to attach to the raspberry PI GPIO lines; I like this method as it means it’s hard to mis-wire when re-connecting plus you can quickly remove you Pi as required.
Note – See the github page for details on running without the extra battery pack and linear regulator.
Step 3: Step 3 Check everything fits in your car
The Pi Is placed in a plastic bag for protection; it’s worth putting piece of card underneath it to make sure the PCB doesn’t poke through the plastic.
Step 4: Step 4 – Setup the Pi software
The Pi uses node.js to run a web server; a wi-fi dongle on the PI uses your phone as a wireless hotspot to enable wifi communications. Once you enter the web address of the PI a dialog box appears prompting you to begin racing; at that point you can control your car by tiliting oyur phone. An emergency stop is built into the app so if it loses comms to your phone the vehicle stops accelerating and steers forwards. The Pi-Blaster program allows pins 17 and 18 of the PI to act as PWM outputs and control steering and throttle.
For more detail: Raspberry Pi Smartphone Controlled Rc Car