In March 2016 I decided to start learning the basics of robotics by building a simple robot. Back then Raspberry Pi 2 was trending. Raspberry Pi is a single-board computer. Basically, it is a computer size of a credit card. I decided to buy an RC Car and use a Raspberry Pi to create an autonomous car. The ultimate goal was that the car moves and when sees an obstacle it changes its path.
I named my project Suphra. I ordered a Raspberry PI 2, 32GB Samsung micro SDHC, and a camera module for the PI. I bought a simple electric RC Car from Target for $24 to be used as the chassis of my autonomous car.
For starter, I installed Ubuntu on my PI. PI has a series of I/O (Input/Output) ports that can be controlled programmatically. For instance, you can write a program that sends a signal to one of the ports. The signal can have a value of true or false. True value can be used to turn on another electric component like an LED or a motor.
The language that is being used to communicate with PI I/O port is Python. Then I started learning Python. I wrote a program that was able to blink an LED with delay. As a beginner that was a big success for me.
After learning how to control LEDs I decided to learn how to control the RC car motor. I removed the default receiver and the motor controller from the RC car. I used an H Bridge as a relay to connect/disconnect the current to the motors. Then I wrote various commands to control the movement of the car. Car was able to go forward, backward, turn right, turn left. Following is the Github repository containing my old code for controlling the motors and LED (Code is in Python): https://github.com/Suphra/suphra1
Back then I was proficient in PHP language. Therefore I decided to write my main program in PHP and then from PHP execute Python commands. From the programming perspective, this was easier for me but it was doubling up the complexity of the project. Using PHP also I could have a web-based dashboard that can be accessed on any device. I installed Apache, PHP, MySQL(LAMP Stack) on the PI.
Following is the Github repository for Suphra 2 project: https://github.com/Suphra/suphra2
robots.php in the Suphra 2 project is the main file that renders the dashboard. The dashboard is a responsive web interface for controlling the RC car. There are controls for steering, acceleration, reverse and stop. The dashboard also shows a live video feed of the RC car camera.
For a few years, I was super busy with tutoring and didn’t get a chance to continue the project. In 2019 I added an HC-sr04 ultrasonic distance sensor. Using this sensor I was able to find close distance obstacles and stop the car. Then steer the car to the left to pass by the obstacle. The following video shows the RC car seeing the obstacles and try to avoid them.
Current status of the project
Suphra was a low budget robotics project. It helped me to learn many things such as working with the Linux command line, configuring a LAMP stack, Python language, & many other things. Suphra project has its limitations. For instance, the CPU and RAM of the Raspberry PI were so limited and working within the PI was very slow. The stock motor on the RC car was very hard to control. For example, when the car had a high speed it was so hard to stop the car fast and the car would hit the obstacle. The car was able to avoid the obstacle only if the speed was low. The motor speed wasn’t high for carrying the weight of batteries, computer, and the interface. The ultrasonic sensor wasn’t very sensitive. It was only able to detect obstacles that are very close.
Suphra was a good beginner project. Today I am planning to start a new well-budgeted robotic project. In this project, I am using an RC car with a brushless motor for movement and a servo for steering. These two motors are going to give me precise control over the movement. For the main computer, I am going to use Nvidia Jetson TX2 Development Kit which is an amazing single-board computer with powerful CPU, RAM, and GPU that allows future expansions.