This post is about my self-driving robot car project. The idea was to build a robot which is able to drive around without crashing into the walls and furniture of my flat. The robot uses a Raspberry Pi 3 as control unit and sensors to scan the environment. All the Python programs developed to steer and control the robot are published here on my website.
Software download: robot software
In the actual phase I am trying to get everything working from the software perspective. The hardware and sensors are running very well. So far the robot car could be controlled by a web interface with live video streaming or drive autonomously around but avoiding objects.
I presented my DIY robot project in January 2016 on the MakeMunich fare in Munich. I had a lot of very interesting discussions about the small robots, the electronics and the software used to interact with the environment.
The picture below shows the fully assembled robot car with all sensors mounted.
The Python program for self-driving is now working very well as shown in the video below.
The video below shows the latest self-driving software release running on my Raspberry Pi 3. The program uses the Sense-HAT Gyroscope and one of the two ultrasonic sensors to measure the distance in the front of the robot to the next object.
The next chapter explains which sensors and technical components are used to enable the robot car to drive autonomously around.
Self-driving robot – technical specification
I tried to use not too expensive electronic components to ensure that everybody could build this tiny robot. Especially for kids and their pocket money it is important not to use the best and typical very expansive electronic components available for robots.
The list below is a summary of the basic main components used to build the robot car.
- 1 x Raspberry Pi 3 (because of the integrated WIFI module)
- 1 x Raspberry Pi camera module with wide angle lens (the one with the normal lens works as well)
- 2 x micro servo motors (very cheap servo motors from China)
- 1 x l298 N motor driver
- 1 x step-down converter
- 1 x I²C level shifter
- 4 x DC motor
A component list with links where to buy the electronics is available and updated frequently here on my blog and you will find the list here list
An ebook which explains step by step how to build a robot is also available here.
E-Book “How to build a remote controlled robot”:
I learned a lot during my test runs I did during the last months and this is the latest list of sensors I actual use in my robot car. I know especially the ultrasonic sensors are not very cheap but I need the I²C bus to get them working. The GPS module is optional and only used to drive around in the garden. You will only need the GPS module for outdoor activities to drive from one waypoint to another. Inside your flat you do not need a GPS receiver and the received signal will be probably very weak.
List of installed sensors:
2 x SRF08 ultrasonic sensors
1 x GPS Navilock NL-602U USB 2.0 GPS u-blox 6
1 x Raspberry Pi Sense HAT
- Barometric pressure
To get all the sensors work together controlled by a Python program was no easy but it is feasible.
The software used to program the robot was written by myself or is available as open source like the mjpg-streamer. All the programs to read the data generated by the sensors or to control the L298n motor driver were written by myself. The mjpg-streamer is for example an open source program I used to integrate a live video stream into my robot control web interface. With this web interface it is possible to remote control the robot over WIFI without a visual contact to the robot. To control the GPIO pins via the web interface I used WebIOPi which is a very cool open source project.
- self developed Python programs (Download)
- mjpg-streamer for the live video streaming (mjpg-streamer homepage)
- WebIOPi for the web interface (WebIOPi homepage)
The picture below shows the robot from the left side.
Not all programs for the self-driving robot are published yet. Actual I am working hard to get everything running. After I finished a first working version of my programs I will publish them here.