Introduction: Simple Pi Robot

Simple Pi Robot aims to put robot control in simple form, the robot design is similar to versatile GOPIGO robot built by dexter industries.

The part list

(1) Raspberry pi (Any model) but with the recent launch of pizero or pi 2 shall be a good option, my current model employs B+

(2) 40 pin GPIO cable (if using pi B+ or pi 2)

(3) Breadboard (for quickly assembly various sensors)

(4) A 2wd chassis

(5) Distance sensor (Ultrasonic HC SR04)r

(6) Power bank (for powering up the pi)

(7) Rechargeable batteries AA (preferably 2100 mAH)

(8)Jumper wires both Male & female type, Resistors

(9) WiFi adapter (EDUP/EDIMAX for communicating wirelesly with pi)

(10) Memory card (4GB and higher for running the OS on pi)

(11)Motor drivers (L298 )

(12)servo motor

(13) Miscellaneous - cable ties (for tying the jumper wires) and foam tape (for holding servo or any other sensor where screw assembly cannot be used)

Step 1: Choosing the Motor Drive Shield

Currently there are very few motor drive shield available for raspberry pi, to name some

(1) RTK Motor controller shield - RTK Motor control shield

(2) Pololu DRV8835 Dual Motor Driver Kit for Raspberry Pi - Pololu DC motor shield

(3) Adafruit DC and Stepper Motor HAT for Raspberry P- iDC Motor Hat for Raspberry pi

(4)Raspirobot board made by Adafruit - Raspirobot Board

and recently underdevelopment like ZEROBORG - ZEROBORG

One of the most common problem building any robot is to minimize the wiring requirement and the same can be achieved by using the shields/hat. I tried building my robot first with one of the shield equivalent to Raspirobot from the manufacture ALSROBOT the kits ships from china but the problem was i was unable to increase the motor input voltage from the board the maximum was less than 5 Volts, with slight unbalance between the voltages, still one can check the following link - ALSROBOT - PI Motor driver shield

Anyhow In my current tutorial i have used the cheap and versatile L298 motor driver - L298

The advantage with the above board apart from being cheap is that there is regulated 5Volts output is available.

I have used the L298 board to drive two DC motors and 1 servo motors

Step 2: The L298 Motor Driver

I have Mounted L298 Motor driver at the the bottom of my chassis, now to connect the DC motor and servo motor connect (i) DC Motor -A to output -A (+ & -)

(ii) DC Motor -B to output -B (+ & -)

(iii) Servo motor +ve to + 5V regulated supply of L298 Board & servo motor -ve to GND of L298 Board

keep the enable pin jumper as it is if you don't want speed control else remove the jumper, the jumper in place ensures +5V supply to enable pin which in turn drives motor at rated speed.

Now connect 4 nos jumper wires to the control inputs, connect other end of jumper wires to GPIO pin as designated in next step.

For servo motor connect one no jumper wire for control to GPIO pin as in next step

Step 3: The Servo Motor

The servo has a 3 wire connection: power, ground, and control. The power source must be constantly applied

The control signal is pulse width modulated (PWM), but here the duration of the positive-going pulse determines the position of the servo shaft. For instance, a 1.520 millisecond pulse is the center position for a Futaba S148 servo. A longer pulse makes the servo turn to a clockwise-from-center position, and a shorter pulse makes the servo turn to a counter-clockwise-from-center position.

I have used Futuba s3003 servo - the connection is very simple the "+" & "-" goes to the L298 Board as outlined earlier. Its important to look at the operating voltage of servo ( in my case its 4.8 - 6 V see image above), the signal wire is to be connected to GPIO output , normally its white or orange

Controlling servo motors in raspberry pi might be tricky but then there is very powerful library hosted @ RPIO.PWM ,to install it on pi use the following code

sudo apt-get install python-setuptools
sudo easy_install -U RPIO

To know more about RPIO.PWM and the DMA used , please refer to the link https://pythonhosted.org/RPIO/pwm_py.html

Step 4: The Robot Chasis

I have used Ellipzo Robot chassis with 2wd, 2wd are simple and easy to control to get started with lots of coding.

The kit comes included with DC Motors, pan kit for servo motors and all necessary hardware's to assemble the kit

The detailed link is available at - Ellipzo Robot chaisis kit

Pl refer to video for assembly of Raspberry Pi, along with L298 motor driver, the Breakout board , camera module and the power bank.

Step 5: The Distance Sensor

Integrating the distance sensor is easy and we need just 1k resistor along with jumper wires. Connect VCC & GND to pi +5Volts & GND respectively.

The other two pins TRIG & ECHO are to be connected to GPIO pins as in preceding steps

Remember to connect the resistor as shown in image.

The Python code to measure distance is included in the last step.

Step 6: Raspberry Pi -camera - Video Streaming Using VLC Player

Here I have used Pi camera module , the set up is quite easy and you can refer the link :Raspberry pi Camera setup

For video streaming, with VLC begin with installing VLC on raspberry pi

sudo apt-get install vlc

To start streaming the Camera Video Using RTSP enter following

raspivid -o - -t 0 -n | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

or with proper width & height use following code

raspivid -o - -t 0 -n -w 600 -h 400 -fps 12 | cvlc -vvv stream:///dev/stdin --sout '#rtp{sdp=rtsp://:8554/}' :demux=h264

Now to view the stream over VLC player open VLC on your remote system than open a network stream using

rtsp://###.###.###.###:8554/

where ###.###.###.### is the address of your pi given by the network router.

Now as the pi moves inside your home see the video stream on your remote system.

Step 7: Raspberry Pi Pin-out & Python Code

Step 8: Some Assembly Images

Full Spectrum Laser Contest 2016

Participated in the
Full Spectrum Laser Contest 2016

Raspberry Pi Contest 2016

Participated in the
Raspberry Pi Contest 2016