Tag Archives: RasPiRobot

Driving Steppers with the RasPiRobot Board

The Raspberry Pi or RBPi is an inexpensive, tiny single board computer running the Linux operating system. As such, the standalone RBPi is not suitable for running motors, but when combined with an expansion board such as the RasPiRobot Board, you can easily run DC motors as well as Stepper motors off the RBPi. For this, you must use the version 2 of the RasPiRobot or RRBv2 board. Please note you can run only 5V steppers with the RBPi RRBv2 combination, as this board does not support 12V motors.
In practice, the RRBv2 board sits over the RBPi fitting over the latter’s GPIO connector. The stepper motor wires connect to the RRBv2 board, using its L & R screw terminals. To do that, you must first strip the wire ends of their PVC insulation, until about 10 mm of bare copper wire is exposed. Unscrew the terminal sufficiently to allow insertion of the copper part of the wire into the hole. Turn the screw clockwise to let the jaws hold the wire firmly.
One of the advantages of using the RRBv2 board is you can run the stepper motors from a battery pack. The board has a switch-mode power circuit to provide stable power to the motors. Additionally, you can even run your RBPi from this on-board power supply. That makes the entire arrangement completely portable.
When connecting the battery pack to the RRBv2 Board, take care to observe the correct polarity of the flying leads from the battery pack. Some battery packs terminate the wires on a plug. Therefore, you must use a matching female socket adapter that has flying leads. In either case, connect the positive or red lead to the screw terminal marked Vin on the RRBv2 board. Connect the negative or black lead to the screw terminal marked as GND on the RRBv2 board. Powering on/off through a battery pack becomes simpler if there is a built-in switch.
If you have connected your RBPi to the RRBv2 board, throwing the switch to the on position will allow the RBPi to start booting. To run the stepper motor with commands from the RBPi, you will need to download the RRBv2 Python library codes. For this, you will have to connect your RBPi to the Internet.
You can use the Ethernet connection to connect your RBPi to the Internet. Alternately, you may use a suitable Wi-Fi dongle. Once online, use SSH to establish connection to the RBPi from a PC and proceed to download the RRBv2 Python library from here and install it.
To run a stepper motor, you can write some simple Python codes, following the tutorial here. For example, you will have to provide the delay between the steps, the total number of steps you want the stepper motor to move and the direction of rotation – backwards or forwards.
The delay between the steps governs the speed of rotation of the stepper motor. For example, as you make the steps larger, the motor turns more slowly to make the total number of steps.

A Portable Raspberry Pi Powered display

If you have a motor to control, the RasPiRobot Board is a very good fit. Apart from controlling motors, you can also use its switch mode voltage supply to power your RBPi or Raspberry Pi using a large range of battery types. Therefore, with a pack of AA type batteries and the RasPiRobot shield, you can make a very convenient and portable RBPi powered display.

To make an RBPi display that will show the current time as a scrolling text, you need to collect a few parts. These would be – the Adafruit Bicolor square Pixel LED Matrix along with its I2C backpack, A RasPiRobot Board version 2, a battery holder with on/off switch suitable for holding 4xAA batteries and the RBPi Model B+ with 512MB RAM.

Not much of wiring is involved in setting up the parts together. The only soldering you will need to do involves the LED Matrix display, as this comes in a kit form. This is not too difficult as all the instructions are included inside the kit. Once soldering is over, fit the LED Matrix display into the I2C socket of the RasPiRobot Board.

If you are using the latest version 2 of the RasPiRobot board, you have to be careful its extended header pins do not reach up to the bare connections on the underside of the LED Matrix module. In case they do, you will need to insulate the module by covering the header pins with a layer or two of electrical insulating tape.

Next, plug in the RasPiRobot Board on top of the RBPi. Just make sure the RasPiRobot board fits over all the GPIO pins on the right hand side of the RBPi. The RasPiRobot Board has two screw terminals marked GND and Vin. From the battery box, attach the flying leads to these screw terminals taking care of the correct polarity.

Fit four rechargeable AA batteries to the battery holder. Make sure they are fully charged and fitted with the correct polarity. When you turn on the switch on the battery holder, you should see the RBPi light up its power LED as well as the two LEDs on the RasPiRobot Board.

To operate the LED Matrix board from the RBPi, you will need to install the Adafruit I2C and the Python Imaging Libraries – follow the instructions here. The guide also has a few examples to allow you to check the working of your I2C interface and consequently the LED Matrix display. For example, you can have a slow display scrolling text on the LED Matrix, showing the current time.

The LED Backpack library has a number of sub-libraries that handle the low-level interface to the matrix display. The Python Imaging Library handles the job of writing text onto the display as an image. This uses the True type Font FreeSansBold size 9 from the library, although you can use other fonts as well that look good. You may need to experiment with the fonts, as they are not primarily intended to be displayed in the 8×8 pixels the matrix uses. You can select the color of the display also.

The RasPiRobot Board for the Raspberry Pi

In robotics, it is usual to have to drive a few motors with the RBPi or Raspberry Pi. However, instead of letting the RBPi handle the low-level job of motor control, using a motor controller board is another option. This frees the RBPi for handling more of the high-level code, resulting in better utilization of the resources and improving the efficiency of the project.

For turning your RBPi into a proper motor controller, you can use the RasPiRobot Board. Apart from simply running your motors from an external supply, the RasPiRobot does a fantastic job of powering your RBPi as well. A switch-mode power supply on board the RasPiRobot ensures that your RBPi receives a well-filtered and regulated power supply.

To run two motors from the RBPi, you will need a few parts. These include a battery holder with a switch – capable of holding six batteries of the AA type, two 5V or 6V DC motors, a RasPiRobot Board v2 and an RBPi Model B+ with 512MB RAM. You will find the version 2 of the RasPiRobot Board perfectly matches the RBPi Model B+. The RasPiRobot Board fits directly over the RBPi, with its GPIO connector matching the GPIO pins of the RBPi.

The RasPiRobot Board uses the L293D motor driver chip in an H-bridge configuration to run two DC motors independently and bi-directionally. The switch-mode power supply on board allows you to drive low-voltage DC motors from a higher voltage battery supply. Additionally, the RasPiRobot Board can also supply the RBPi with over 2A of current. That means you need only a single power supply for driving both the motors and the RBPi.

You must connect the motors via the screw terminal pairs on the RasPiRobot Board. These terminals are marked as L and R on the board. Take care to connect leads from one motor to the L terminals and the leads from the other motor to the R terminals. Swapping the leads of a particular motor will make it spin in the reverse direction.

Now plug in the RasPiRobot Board on the RBPI, taking care to match the GPIO pins and connector correctly. After this, you may connect the flying leads from the battery pack to the screw terminals. Be careful to connect the positive lead (red/yellow color) to the screw terminal marked Vin and the negative lead (black/blue color) to the screw terminal marked GND. Reversing these leads could result in irreversible damage to your RasPiRobot Board.

Place the batteries in the holder (be careful of maintaining the sequence), and throw the switch to the on position. The RBPi starts to boot, which is evident from its LED lighting up. The two LEDs on the RasPiRobot Board should also light up. You will need to download and install the Python Library – follow the tutorial.

After the library has installed, you can get the motors running individually in forward or reverse directions for a definite interval or stop them. It is also possible to make your entire assembly mobile by mounting it on a robot chassis.