Today, I am going to share the details of my Raspberry pi Robot!
I have the following objectives in mind at the beginning of the project:
1) Construction should be simple, inexpensive and should have room for further development
2) It should have video streaming capabilities.
3) I should be able to control the Robot from any smart device such as mobile, desktop or tablet
4) I should not install any new software on the controlling device
I am pleased that at the end of the project, I am able to achieve all these objectives.
In the following, I will give as many details as possible for the construction of my Raspberry Pi Robot!
1) Raspberry Pi
3) Rechargeable Battery for Pi
4) Rechargeable batteries to drive the Motors
6) L293D- IC
7) Bread board and some jumper wires
8) Wifi dongle
Before going into details, I would like to show my Robot in action.
I disassembled a old RC-car and removed the original controlling circuit inside of it. I just needed the bottom part of the car with motors and battery holder. This bottom part is our Robot Chassis. RC cars have mostly simple toy DC motors. The front motor is used for the left-right movement while the rear motor is used for the forward-backward movement.
I placed a bread board on the Chassis using foam glue tape. Then I placed raspberry pi on this breadboard at the front end of Chassis. I placed a L293D-Chip on the board at the rear end of the Chassis.
In the gap between the breadboard and front of the Chassis, I placed the rechargeable battery and the video camera. That’s it.
Connections between RC-car and L293D
1) I saw the below video for connections from the L293D to the motors.
2) Basically each half of the chip controls one motor. First DC-motor of the RC-car will be connected to Pin 3 and Pin 6 of L293D. Second Motor will be connected to Pin 12 and Pin 15 of L293D.
3) Pin 4,Pin 5, Pin 13, Pin 14 of L293D are connected to the ground line of the bread board.
4) The positive wire from the battery holder of the RC-car are connected to pin 16 of L293D, while the ground wire is connected to the ground line of bread board.
Connections between Raspberry Pi and l293D
Please be careful that I am referring here GPIO pin numbers on Pi, not the actual numbers on the board.
L293D PIN2 =GPIO 9
L293D PIN7 =GPIO 10
L293D PIN1 =GPIO 11
L293D PIN10 =GPIO 23
L293D PIN15 =GPIO 24
L293D PIN9 =GPIO 25
L293D PIN16 = 5V GPIO
Finally, connect ground pin on Raspberry Pi to the ground line of the breadboard.
We may not need to use any solder, just jumper wires will be enough.
I used the Webiopi since it will provide simple interface for both the video streaming and controlling the motors with just a browser.
I followed the instructions from this blog for installing it. You will see pdf files of Mag Pi issue 9 and 10. I adopted the code, according to my RC-car chassis. Also, for some strange reasons, I am not able to get my webcam working with mjpg streamer.
I also set-up the wifi on my Raspberry Pi using this guide.
Once after installing Webiopi, go to the folder where we downloaded the attached files on the Raspberry Pi. Just hit the following command
sudo python cambot.py
Go to the browser on any device on your network, hit
http: //ip address of raspberrypi: 8001
In the above instead of “ip address of raspberry pi” use the actual ip address of your Pi. You should be able to see the video and four buttons to control the robot.
1) Please update your Raspberry Pi software. It drives me crazy with my old installation of Raspbain OS. I had to reinstall the latest version to make my webcam work.
2) Increase the frame rates in the motion software or in mjpg software to get better streaming. Refer to this guide.
3) Make sure all the connections are made according to the GPIO numbers on the board, but not the physical pin numbers.
4) If you are trying to build the Robot from scratch, then try to divide the project into parts. Making all softwares work together on Pi was the difficult step for me.
5) Please save all the settings of Pi, by cloning your SD-card using this guide.
1) I wanna make it autonomous, by using ultra-sonic sensors
3) Use a servo motor to rotate the webcam, so that we can see more area
4) Object tracking using Open CV
5) Using capacitors to have more safe connections.