Self-driving RC Car using Tensorflow and OpenCV
By Russell Barnes. Posted

Build a Raspberry Pi self-driving RC car using TensorFlow, and OpenCV
Advertisement
Starter electronics: how to build and program circuits with a Raspberry Pi or Raspberry Pi Pico.
Self-driving cars are the hottest piece of tech in town. And you can build your self-driving RC car using a Raspberry Pi, a remote-control toy and code.
Hungry Man, who describes himself as "An engineer" demonstrates this RC car.
It uses the following equipment:
- Raspberry Pi
- Pi Camera Module
- PWM Motor Control
- TensorFlow
- OpenCV
The two key pieces of software at work here are OpenCV (an open-source computer vision package) and TensorFlow (an open-source software library for Machine Intelligence).
OpenCV can be trained to detect objects in images (or video). Such as a cat, or dog, or in this case pieces of paper making up a track.
TensorFlow is used to make smart decisions based upon the Neural Network. In this instance, it's being used to steer the car.
The project is a "self-driving car running a convolutional neural network, or CNN, on a Raspberry Pi with a Pi Camera," explains "Hungry Man" on YouTube (the engineer behind the project).
Self-driving car technology is all the rage, with Google engineers repeatedly demonstrating the technology in public. Nissan, Toyota and Tesla are all reported to be building self-driving cars.
Automated cars are appearing on roads across Europe and The United States, as engineers test out the technology.
For most people, self-driving cars are technology from the future, that is "indistinguishable from magic," according to Arthur C. Clarke's third law.
Self-driving RC car built using a Raspberry Pi
Behind the self-driving magic is down-to-earth code accessing sensor data. In the self-driving RC car, the sensor is a Pi Camera that looks at a road made from paper.
It can also detect Stop signs and automatically come to a halt.
In case you're wondering, the stick protruding from the front is a light (it can drive in the dark).
Commercial automated cars use a combination of sensors. The upcoming Tesla Model 3 will have eight cameras, one radar and ultrasonic sensors.
At the heart of the RC car is just a Raspberry Pi. The car is independent and does not connect to another computer.
We think this project is super smart. Hungry Man says that the code will be placed on GitHub soon. We look forward to testing it out.

Russell runs Raspberry Pi Press, which includes The MagPi, Hello World, HackSpace magazine, and book projects. He’s a massive sci-fi bore.
Subscribe to Raspberry Pi Official Magazine
Save up to 37% off the cover price and get a FREE Raspberry Pi Pico 2 W with a subscription to Raspberry Pi Official Magazine.
More articles

Starter Electronics in Raspberry Pi Official Magazine 157
After you’ve built your own simple circuit, why not think a little bit bigger – like building a product, and getting that product verified as officially Powered By Raspberry Pi? We take a look at some of the brilliant gadgets with Raspberry Pi at their heart. If you want to build a submarine, you might […]
Read more →

Win one of three Raspberry Pi 500 desktop kits
Everything you need for a PC, add your own monitor
Read more →

Picocomputer 6502
The Picocomputer 6502 is truly open-source hardware.
Read more →
Sign up to the newsletter
Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.