Product Code: 48

Buying Links:          


The RasPiRobot Board V3 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 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 power using a cool and efficient switch mode power supply, allowing you to run a fully-loaded Pi and the robot from 6xAA batteries (not included!)


The main features of version 3 are listed below.

  • Compatible with Raspberry Pi models 3, 2, 1, Zero, A, A+, B and B+
  • Extensive Open Source Python library with examples – download from Github
  • 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 power – 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
  • 5V I2C header, pin compatible with Adafruit displays
  • Two buffered open collector outputs capable of 2A each
  • Two LEDs
  • Two switch inputs
  • Screw terminals for motors and battery
  • Through headers allowing access to all GPIO pins (although the RRB3 uses many of them)


finished_kit copy

The RRB3 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 RRB3 will provide enough power with ease to the Raspberry Pi. However, it is perfectly OK to power your Pi over USB even while the batteries to the RRB3 are connected.

The RRB3 provides power to the motors direct from the battery pack.


Getting Started

On your Raspberry Pi, issue the following commands in a Terminal window:

$ cd ~
$ git clone
$ cd raspirobotboard3/python
$ sudo python install

Attach the RRB3 to your Raspberry Pi. You do not need to attach batteries, motors or anything else to the RRB3 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 RRB3, 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 rrb3 import *
rr = RRB3(9, 6)

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 library implements a class called RRB3. This is only available for Python 2 and any Python programs that you write that use the library must be run as a super user.

To import the library and create an instance of the class, put this at the top of your Python program.

from rrb3 import *
rr = RRB3(9, 6)

The first parameter ‘9’ is the battery voltage (6 x 1.5V AA batteries). The second parameter (‘6’) is the motor voltage (6V for most low cost robot chassis motors). It is important to set these values correctly, as the library will manage the voltage supplied to the motors, to prevent them burning out or running too fast.

The rest is pretty straightforward, there are just a load of useful methods on the class that you can use.


There are two LEDs built-in to the RaspiRobotBoard, called LED1 and LED2. Both of these can be turned on and off using the following methods:

To turn LED1 on just do:


To turn it off again do:


To control LED2 just do the same thing but using set_led2.

Switch Inputs

The sw1_closed() and sw2_closed() functions return true if the contacts for that switch are closed. By default, the switches are open. You can test out closing the switch by shorting the two contacts with a screwdriver.

The following test program will show you the state of each of the switch contacts.

from rrb3 import *

rr = RRB3()

while True:
    print("SW1=" + str(rr.sw1_closed()) + " SW2=" + str(rr.sw2_closed()))
    raw_input("check again")

Open Collector Outputs

The RRB3 has two high-power open collector outputs. These can each provide up to 2A and so are suitable for driving loads at the battery voltage, such as high power LEDS, IR senders, alarm bells, relays etc.

Each OC output has a pair of screw terminals. Once screw terminal is marked + and this is connected to the positive power input from the batteries. The other connection is the open collector output.

This means that you can just connect your load (say a 12V siren) across the two screw terminals and then control it as described below. If the load you are using has a positive terminal then this needs to be connected to the screw terminal marked +.

To turn the Open Collector OC1 output on just do:


To turn it off again do:


To control OC2, substitute set_oc2 in place of set_oc1 in the examples above

Motor (High Level Interface)

There are two levels of command for controlling the motors. There is a high level interface that assumes that the motors are connected to wheels on a rover. These commands are forward, reverse, left, right and stop.


… will start both motors running in the same direction to move the robot rover forwards. They will continue in this direction until another command is issued.

If you want to move forward for a certain amount of time, you can specify a number of seconds as an optional first argument. If you supply a second parameter between 0 and 1 this will control the speed of the motor. This is set to 0.5 as a defaut. If you want the motors to run indefinately, but also want to control the speed, then use 0 as the first patrameter.

Some examples:

rr.forward()       # forward half speed indefinately
rr.forward(5)      # forward for 5 seconds at half speed
rr.forward(5, 1)   # forward for 5 seconds at full speed

The commands left, right and reverse all work in the same way.

The stop command stops all the motors.

Stepper Motor Interface

There RRB3 can be used to drive a single bipolar stepper motor with one coil connected to the L motor driver and the other to the R terminals.

Two commands are available to make the motor step in one direction or the other:

rr.step_forward(5, 200)  # step in one direction for 200 steps with a 5ms delay between each phase change
rr.set_reverse(5, 200)   # other direction

Motor (Low Level Interface)

The low level interface is intended for control of the motors directly. It allows you to control the speed of each motor and its direction independently.

The method for this (set_motors) takes four arguments: the left speed, left motor direction, right spped and direction.

So to set both motors going forward at full speed, you would just use the following:

rr.set_motors(1, 0, 1, 0)

.. and half speed would be:

rr.set_motors(0.5, 0, 0.5, 0)

to send the motors both at half speed in opposite directions is:

rr.set_motors(0.5, 1, 0.5, 0)

Range Finder

If you fit the RRB3 with an SR-04 ultrasonic rangefinder, then you can use the following call to measure the distance to the enarest obstacle in cm.



You can download the schematic here.

Absolute Maximum Ratings

Input Voltage: 6-12V (9 recommended when driving motors)

Motor Current total average: 1.2A Motor Current total peak: 3.2A (built-in thermal shutdown)

OC1 and OC2 output currents: 2A at battery voltage (unprotected)

Max current supplied to Pi (excluding motor current): 1.5A

Using I2C Displays

The I2C socket is pin compatible with these Adafruit displays:

To use these you will need to download Adafruit’s Python library for the Pi from here.

Make sure that you plug the display in the right way around. The socket pins are labelled on the RRB3, make sure they match up with the labels on the display. You can use male to female jumper wires if you wish to put the display further away or its too big.

Battery Power

7.4V LiPo racing packs, although not 9V, have the advantage of being able to supply high currents without losing much voltage either through ‘internal resistance’ of the batteries or resistance in the leads from the battery box to the RRB3. The LiPo packs tend to have good thick leads and very low internal resistance. The 9V is necessary with AA batteries, because they have more voltage losses at high current and so when the motors start up, the voltage arriving at the RRB3 can drop below the 6V or so needed to stop the Raspberry Pi rebooting.
If you are not keen on single use AA batteries, then powering the Pi separately from a 5V LiPo phone battery backup means that the Pi won’t reset itself even if the motors do cause the voltage supplied by the ‘motor’ battery to drop below 6V. This also means that you could use rechargeable AA batteries in the AA battery box, or even use a 4 x AA battery box rather than the 6 x AA box suggested. You only need the 6 x AA battery box if also powering the Raspberry Pi from the batteries.


@rosie_red_robot has created a Fritzing part for the RRB3 board that you can download from here.


Problem: I can’t install the raspirobotboard3 library

Make sure that your Raspberry Pi’s internet connection is working ok. If you get an error running the ‘git’ command, then it probably means you are using an old version of Raspbian that does not include ‘git’. The best thing to do is to download NOOBs and install the latest version of Raspbian from


Problem: One of the motor channels doesn’t work.

* Try swapping the polarity of the motor leads over on the same L or R channel. Is it now the forward command that works?
* Try the motor connected directly to a a battery. Does it rotate in both directions when you swap the polarity of the leads.
* Does the Pi reset when you do ‘forward’? This could indicate a power source that’s too weak.
* Do you have a multimeter to test the outputs?
* Make sure that NONE of the motor leads are connected to GND.
* Make sure that no other software is using the GPIO pins. If this isn’t a ‘fresh from the box’ pi there is every likelihood that something else is using one of the GPIO pins you need so if you re-install Raspbian it should clear this up.  The most likely culprit for the problem of one channel not working is that some other software is using that pin. This could be because either the SPI or 1-wire interfaces are enabled. You can check this by opening the Configuration tool from your Raspberry Pi menu. (See step 4 here: Make sure 1-wire, SPI and remote GPIO are all disabled, then reboot your Pi. The other things that will override the pins used by the RRB3 are the ServoBlaster, ServoSix and Lirc libraries / software.



50 thoughts on “RasPiRobot Board V3

  1. admin Post author

    The board uses this driver chip:

    The problem will be the inrush current dropping the supply voltage and crashing your Pi, unless you use very short thick leads to batteries with low internal resistance. So you would probably need to supply the Pi from a separate battery.

  2. Demian Clements

    I picked up the RasPiRobot Rover Kit recently and after rebuilding it from scratch 3 times, reformatting with a fresh OS 3 times, and testing all motors and outputs I am at a total loss as to why it isn’t driving the motors. I’ve played with the code, but I assume all git sources should work without modification assuming directions are followed.

    LEDs work, the rangefinder works, nothing seems to be awry with the Pi itself.

    None of the searches or forums I scoured through have provided me any progress on this.

    Is it possible the outputs are not functioning correctly despite registering a change in resistance when the code for engaging the motors is run?

    This is my first foray into actual electronics despite decades of computer use.

  3. admin Post author

    Hi Demian,
    The first thing to note is that the motors will only be active if the RRB3 has a battery pack attached. That is powering the RRB3 from the Pi’s USB power will allow all functions to work except the motors.

    Could this be your problem?


  4. otto-mated


    You have spec’d upto a 12v input. Can this be higher?
    From the schematic, I see you use an MP1496 step down converter. MPS spec sheet,, shows an input range of 4.5-16v input range.

    So if one connected this to a 12v power system, such as a car, or other mobile platform, that is then recharged, then it should be able to run during recharging? Charging of such items such as lead acid, run at about 13.8v, and could peak as high as 16v.

    I’m going to speculate that MPS designed the chip for the mobile market and should be able to handle the higher recharge voltage.

    Is there anything on the board that would prevent this from being used in the 12v mobile environment?

    Another question, the MPS spec suggests this is 2A. The Raspberry Pi 3 spec,, suggests a recommended power of 2.5A. So if you are driving motors and proximity sensor, is this driver a bit under powered for continuous operation?

    Best regards,


  5. admin Post author

    Hi Otto,
    While, as you say, the switching PSU can cope with an input up to 16V, the maximum input voltage for the motor controller IC (TB6612FNG) is 15V. The large electrolytics are rated at 16V – so in short – yes you should be fine at 13-14V.
    As for the supply current to the Pi, a Pi B+ to Pi3 rarely draws more than 1A and the power to the motor comes from the unregulated side.
    Hope this helps.

  6. Demian Clements

    Unfortunately not, I am powering the board from the 6 batteries from the battery pack. They are fully charged and the outputs appear to be producing a sustained voltage. To limit power draw I have made sure to have nothing else connected (including the rangefinder) and am using SSH to interact with the device.

  7. Demian Clements

    Would email be better? Inclusion of photos and such?

  8. Steve MacDougall

    Which of the GPIO pins connected via the GPIO passthrough are spare and available to be used for other things. Also, is it possible to use the I2C header for other devices such as the Adafruit servo module 815.

  9. Lyle

    After entering git clone……. In terminal it asks for username for ‘https: //’: then a password??
    Is this normal? If so what is the username and password?

  10. Demian Clements

    Should I just junk this board as faulty or ineffective support? I have patience but this is kind of boggling.

  11. Imran

    Quick question, does the kit include an odometer?

  12. jONATHAN

    hit a snag on the first line


  13. Linda Taylor

    Hi Jonathan, first line of what please?

  14. jim kski

    I am using the raspirobot v3f board to control a sm-42byg011-25 1.8 degree stepper motor. It works but…
    rr.step_forward(5, 200) . yields 1 step every 5 seconds – 200 steps takes a long time. Changed 5 to .05.
    Also despite being a 1.8 per step motor, 50 steps makes a full 360 – so it’s actually moving the equivalent of 4 steps per ‘step’. Have reversed polarity, clean install etc with no change in behavior. Any hints would be most appreciated.

  15. Vic

    I’m running into the same issue as Demian. I’ve tested the motors directly, they pass. I’m able to power the Pi via the Raspirobot. I’m also able to get my the LEDs to turn on and off on the Raspirobot hat. I’m also able to get data off the ultrasonic sensor. I have not only reinstalled the IS twice, I’ve also tried a different MicroSD card and tried direct command to the board rr.forward() – all to no avail. The board will simply not respond to any code that relates to motor movement. Do I have a defective board? What was Demian’s resolution? Please help.

  16. Linda Taylor

    @Vic, its possible you have a defective board. You do have batteries fitted and the right way around? Does the Pi boot up just from battery power? I ask because the RRB3 features all work except the motors when the Pi is powered by USB. The motors will only work if there are batteries installed.

  17. Vic

    @Linda. Yes, I do have the batteries fitted and oriented properly. They are Amazon 1.2V NiMh rechargeable batteries in an 8 battery holder producing 9.6V. It powers the Pi adequately through the Raspirobot. Im hoping its not defective as it will take a while to get a replacement.

  18. Linda Taylor

    @vic does the Pi reset itself when you issue a motor command like forward?

  19. c0d3r

    Can the board be stacked on a Raspi B2+ with the Sense HAT? Either by directly stacking on the connector or by bypassing/soldering a certain few connectors?

  20. Tom Ferguson

    Hello folks:

    My robot’s neural network libs are only compatible with Python 3. The RaspiRobot v3 libs are apparently only compatible with Python 2. The RaspiRobot board provides so many advantages over the likes of L298N boards and I’d hate to take a step backward… Any chance you’re working on Python 3 libs for the RaspiRobot board?

  21. Linda Taylor

    @Tom – its a while since I looked at it and I must admit I thought it did work on Python 3. Have you tried installing it with:

    $ python3 install

    Then using it from Python 3.

  22. Graham

    Having similar problems with Python 3. I’m trying to combine

    with your excellent linear actuator tutorial from MagPi with no luck. Essentially I want to use an Echo Dot to extend or retract the linear actuator with voice commands. My code is falling over because the RRBv3 libraries dont seem compatible with Python3. I am new to Python but any tips of guidance to get this working would be really appreciated.

  23. Linda Taylor

    The library itself should be ok under Python3. You need to install it using:

    $ python3 install

    But you will get errors if you try and run the programs in the examples folder that use “raw_input”. I’ve made a new folder “examples_python3” with raw_input replaced with “input”.

    If you are getting any other errors running the library under Python3, please let us know.

  24. TROC

    Received my RaspiRover with the RaspiRobot V3- Everything assembled OK, great all around. Two things:

    1) In the rev I received the battery pack wedges against the motor housing and causes the wheels to ‘toe-in’, you might want to move the motor mounts out 2mm, also with the bolts in the housing the batteries on the end get pushed up slightly and might be prone to fall out if jarred.

    2) All the Python examples worked great, but I’m trying motor functions in C, and am having a hard time with it. Do you (or anyone) have a very simple motor control example in C/C++?

    Nice Rover all around, thanks!

  25. Denis

    Is there a way to monitor input voltage? I want to make sure that I shutdown the Pi when battery voltage starts to drop to dangerous level. (I will be controlling my rover via web interface, so I’d like to see battery voltage readings there)

  26. Mark Davison

    Bought one of these kits for my son for Christmas. We’ve been trying to get it work for a few days. Looks like I’ve got the same problem as a couple of other people. All functions work but cannot get the motors to work

    Driving off the batteries (not USB), we’ve reformatted and reinstall the SD card a couple of times (and tried different SD cards). I can see 8.5V across the power input terminals, but never any voltage across either of the motor terminals no matter which of the motor commands we try.

    Looking deeper, at the control chip – I can see ~8.5V on the motor power inputs (VM1, VM2 & VM3) but nothing on the outputs (A01, A02, B01, B02).

    Please advise – thanks

  27. Chris Bell

    Hi sry if this question seems dumb but I have an early raspirobot board will it work on raspi 3 board?

  28. Shane Wilson

    Can an Adafruit servo driver be used with this? Or any other kind of servo driver?

  29. Jim

    Is there a way to “trim” out the motors to balance when they don’t drive exactly the same, causing a robot to veer right (or left) from a straight line? Assuming it’s the motor’s fault.

  30. Linda Taylor

    @Shane – yes, I haven’t tried it, but the Adafruit I2C servo board should work fine conneced to the I2C connector of the RRB3.

  31. Linda Taylor

    @JIM, yup no two motors are exactly the same, hence the veering. You can adjust the power to each motor if you use the set_motors method which allows different speeds to be set for the two motors. The documentation for this is here:

  32. Vince Kondracki

    I am having a problem running Python programs for the rapirobotboard3 v3 with the RasPiRobot Rover Kit.
    The raspberry pi was configured for remote user, camera turned off, etc.. per the website instructions.
    When I use the command terminal the LEDs and both motors are functional. So all the hardware is functional with the proper connectivity. Next when I tried to run the example programs that were downloaded from the github site but nothing worked. I also tried a simple program with my own source code without any luck. See below for provided programs via download with the error code:
    Import Error: No module named rrb3.

    All the module library files are listed in the Rasprirobot.
    I used your Hacking Electronics book as a resource along with this website.

    Not sure how to resolve this.
    Any help would be appreciated. Thanks in advance.

    Vince K.

  33. Steve Goral

    Hi there,

    I am looking to build a smart tank with my son using one of these boards and the DFRobot chassis, I notice you can attach one distance sensor directly to it but can you attach a further 3? So I could get almost a 360′ distance measurement and make the robot negotiate issues when reversing and turning.

  34. Linda Taylor

    Hi Steve,

    As long you stay away from the other pins used by the RRB3, you can attach more rangefinders. You will need to find code for getting readings from them. Female to female jumper wires are a good way of attaching extra rangefinders.


  35. Steve Goral

    Thanks for the reply, I think that might be a little too in depth for myself and a 9 year old so I’ll stick to the one on the front.

  36. Steve Goral

    Just out of interest, is there a remote control that you would recommend to actually operate the robot? Either a Windows program for my laptop or maybe for my Android tablet would be ideal.

  37. Kevin

    It looks like BCM 18 is being used for the trigger on the rangefinder. This is a PWM pin. Is there any problem hooking up the rangefinder to to say BCM 16 (Raspberry Pi 3 B) and Hooking up to BCM 18 through range finder connector on the PCBA to run a servo?

  38. Steve

    Is there a case for this? I really want to build it into my rover but I’d like to protect it.

  39. Gareth Watkins


    I’ve got a Raspirobot fitted on a RasPi3 and the motor terminals don’t have any voltage across them when I’m doing basic commands such as rr.forward()
    Is there any way of working out whats going wrong? All the LED tests work fine and I’m powering the RaspPi of a DC power supply providing 11.16 V ( I just measured it..)

  40. Liam


    Is this compatible with a Rasberry Pi 3B+? When installed I get a low voltage alert from the 3B+. It is only supplying 4.5V not 5V to the 3B+ Is there a similar product (can drive linear actuator, take in 12V while powering Pi with 5V) for a 3B+ Raspberry Pi?


  41. Simon King

    Which of the GPIO pins connected via the GPIO passthrough are spare and available to be used for other things. Also, is it possible to use the I2C header for other devices such as the Adafruit servo module 815.

  42. Mike Kopack

    Any idea what the power output limit is? I’d like to use this board in conjunction with an Up2 computer (rather than a RasPi) which has the same GPIO pinout. It also uses 5V but 4-6Amp, which is way more than the Pi usually needs. Just wondering if the pass-through power can supply that or whether I’ll need to power the Up2 separately…

  43. Mo

    I need to drive two stepper motors independently using a RPiB3+, can I use two RRB3s on one board? Or do you have a suggestion how I might be able to do this?

Leave a Reply

Your email address will not be published. Required fields are marked *