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
Introducing the smarter desktop: use cloud apps, thin clients, and get real work done on a Raspberry Pi. Also in the magazine we’re building a digital jukebox, controlling a robot arm, storing…
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

Raspberry Pi camera tripod mount review
The easy way to mount a Raspberry Pi Camera Module.
Read more →

Cassette MagSafe stand
This is one of those builds that straddles the line between silly and brilliant.
Read more →

The Smarter Desktop in Raspberry Pi Official Magazine 156
3D printing has come a long way. Once upon a time you’d have to spend countless hours sanding everything that came off your print bed, and you could have any colour you wanted as long as it was beige. Now you can send a design off to a factory and get industrial-quality prints for pocket-money […]
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.