** Works with the Raspberry Pi2 **
The RasPiRobot Board V2 is an expansion board designed to turn your Raspberry Pi into a robot controller! This board comes fully assembled and includes a switched-mode power supply so you can supply your Raspberry Pi from a variety of battery packs.
The board fits right on top of your Pi’s GPIO socket and allows for bi-directional control of both motors with an L293D H-Bridge motor driver chip. It also allows for control of both motor’s speed independently. The board can also supply the Raspberry Pi with up to 2 amps of power using a switch mode power supply, allowing you to run a fully-loaded Pi and the robot from 6xAA batteries (not included!)
Where to Buy
The RasPiRobot Board is sold in the USA by Adafruit at a price of $29.95
It is also available in the UK and world-wide from Seedstudio for around £15 depending on exchange rates
You can also buy it on Amazon.co.uk for £17.50
The main features of version 2 are listed below.
- Compatible with Raspberry Pi models A, A+, B and B+
- Open Source Hardware
- Extensive Open Source Python library with examples – download from Gitbub http://raspirobot.com
- Supplied fully assembled – no soldering
- Bi-directional control of two motors
- Variable (PWM) power control. This allows you to both control the speed of the motors independently and the use of lower voltage motors than the battery pack.
- Supplies the Raspberry Pi with upto 2A using a switch mode power supply – run a fully loaded Pi and the Robot from 6 x AA batteries
- Rangefinder header socket directly compatible with cheap HC-SR-04 ultrasonic range finders. Just plug them in directly
- 5V I2C header, pin compatible with Adafruit displays
- Two buffered open collector outputs
- Two LEDs
- Two switch inputs
- Screw terminals for motors and battery
- Through headers allowing access to all GPIO pins
Version 2 of the RaspiRobot Board (RRB2) has learnt by the feedback from version 1 and it is a great improvement.
How it Works
The diagram below shows how an RRB2 board is used. The RRB2 is powered from a battery pack that needs to be between 6 and 12V DC. Although using 4 x AA batteries can in theory provide 6V, actually the battery voltage will usually quickly fall below that, so it it better to use at least 6 x AA batteries, either rechargeable or regular heavy duty batteries. A 7.2V LiPo battery pack will also work just fine.
Note that you don’t need a separate power supply for the Raspberry Pi. The RRB2 will provide 5V at 2A with ease to the Raspberry Pi, and motors.
Note that 6V motor will usually work just fine at 5V.
On your Raspberry Pi, issue the following commands in a Terminal window:
$ wget https://github.com/simonmonk/raspirobotboard2/raw/master/python/dist/rrb2-1.1.tar.gz $ tar -xzf rrb2-1.1.tar.gz $ cd rrb2-1.1 $ sudo python setup.py install
Attach the RRB2 to your Raspberry Pi. You do not need to attach batteries, motors or anything else to the RRB2 just yet. For now you can just power it through the Pi’s normal USB power connector.
Lets run some tests from the Python Console now that everything is installed. We can experiment with the RaspiRobot Board v2, even without any motors
Open a Python console (Python2 not 3) by typing the following into a Terminal window:
$ sudo python
Then, within the python console, type the following, one line at a time:
from rrb2 import * rr = RRB2() rr.set_led1(1) rr.set_led1(0) rr.set_led2(1) rr.set_led2(0) rr.sw1_closed()
The last step should display the answer “False” because no switch is attached.
If you prefer, you can use True and False in place of 1 and 0 in the examples above.
The quickest way to use the RRB2 as a roving robot is to buy a robot chassis such as the Magician Chassis (available from many sources) or similar low-cost robot chassis kits from eBay. These kits come as a laser cut body, a pair of gearmotors, often a battery box and nuts and bolts to fix it all together.
Here is one such chassis. The first step is to bolt this all together. Note that these are usually supplied with a 4 x AA battery box. You will need to swap this for a similar 6 x AA battery box or a 7.2V LiPo battery pack. Rechargeable batteries are a good idea when driving motors.
Once the chassis is built, use some of the bolts suppled to fix the Raspberry Pi on the chassis and then attach the RRB2 onto the GPIO connector. Make sure its the right way arround, and that all the pins meet up with the socket.
The leads from the motors will thread up through the chassis and each pair of leads should go to one of the two screw terminals labelled L and R for (left and right). If you put the leads in the wrong way around, the direction of the motor will be opposite to that expected, so just swap them over if this happens.
WARNING: Never power the Raspberry Pi from both batteries and the USB power connector. One or other, but NOT both.
It is a good idea to leave the wheels off the robot chassis for now so that it does not unexpectedly drive itself off your table. One or both of the motors may spin as the Raspberry Pi starts up.
Wire the battery pack into the third pair of screw terminals. +V towards the outside of the board. The Raspberry Pi’s power light should light up and it will start to boot. LED1 and LED2 on the RRB2 will also light up.
Having your Pi set up for WiFi will allow you to connect to it wirelessly over SSH. So, you may want to plug in a USB WiFi dongle.
The library implements a class called RRB2. This is only available for Python 2 and any Python programs that you write that use the libaray must be run as a super user. I.e.
For more detail: RaspiRobot Board V2