Everyone loves remote-controlled cars, which is the reason one family thought it would be interesting to use the Raspberry Pi to resurrect some of their old toys. They’ve hacked the controllers and connected them to the Raspberry Pi. It’s been a useful introduction to programming for their five- and six-year-old boys, who now enjoy setting the cars to skid from within Scratch. This project requires some technical skill because the radio controller unit needs to be opened up and connected via a suitable cable to the GPIO pins on the Pi.
You must take two steps to enable the car to be controlled from Scratch. Firstly, you need to have a script running on the Raspberry Pi to listen for Scratch commands and send them on to the GPIO pins. The result is that setting different pins on the Pi exercises different functions on the car.
Secondly, within Scratch, you need to enable remote sensing and create variables for each action that’s supported by the car’s remote control — for example, left, right, forward, backwards, turbo boost, and so on — matching the variable names to those used in the listening script. These variables are given values of 1 or 0 to turn the GPIO pins on or off.
After this is done, it’s easy to use the Scratch interface to create a sequence of commands and set them running. You can see more information and videos about creating a pi-car, as well as racing results, at