Servo Kit for Raspberry Pi

CED-M051

Description

This kit allows you to connect the two included servo motors to your Raspberry Pi using the Monk Makes ServoSix interface board.

The kit includes:

  • 1 x Servo Six interface board
  • 2 x 9g servomotors
  • 1 x Set of jumper wires (female to female)
  • 1 x Raspberry Leaf pin identification template
  • 1 x 4AA battery box

Getting Started

  1. Install the Software

Although you can use other libraries to control the servo motors, the easiest way to control them in Python is to download the servosix Python library on GitHub where you will also find the commands to install the library.

This library based on Richard Hurst’s ServoBlaster code. This allows accurate servo positioning with a nice easy to use Python interface.

2. Place the Raspberry Leaf GPIO template over the GPIO pins as shown below.

3. Connect a Servomotor to the ServoSix board as shown below. It needs to be the right way around, so make sure that the orange control lead is to the left as shown below.

4. Connect the ServoSix to your Raspberry Pi as follows:

  • One lead from GND on the GPIO connector to GND on the ServoSix
  • One lead from GPIO17 on the GPIO connector to the pin marked ‘1’ on the ServoSix.

5. Connect the battery holder to the screw terminals making sure that the red lead goes to +V and the black to GND on the Servo Six. Fit batteries and the LED on the ServoSix will light to show that it’s powered up and ready to go.

6. Now run the test program in the examples folder as shown below. You will be prompted to enter the servo to move (1) and then the angle to set it to (90).

$ cd /home/pi/servosix/examples
$ python test.py
servo: 1
angle: 90

This should set the servo’s arm to its middle position. Try entering different angles to see the servo arm move.

Reference

You will find full documentation for the library in the Github repository.

You can use up to 6 servos with the ServoSix. To connect a ServoSix board to a Raspberry Pi use one a female to female jumper wire to connect ground (GND) on the Raspberry Pi to GND on the ServoSix board. Then, for each servo (up to six) that you want to control, you also need a female to female jumper wire connecting the control pin for that servo on the ServoSix board to one of the GPIO pins on the Raspberry Pi.

As a hint, the ServoSix board has the GPIO pin to be used with a particular control pin written next to it.

So, looking at the picture above, the left most pin is GND and should be connected to a GND pin on the Raspberry Pi. The next pin along (control pin 1) should be connected to GPIO17 on the Raspberry Pi, control pin 2 on the ServoSix to GPIO18 and so on.

Power for the motors must be supplied separately using the screw terminal on the right, which is where the battery box comes in handy.

RESOURCES

You can find out more about the ServoSix at the Github page for the library.

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

FAQ

Q. Can I connect more powerful servomotors to the Servo Six?

A. Yes, as long as you have batteries or power supply to match. The control signals to the servo motor are protected by 470Ω resistors, so no harm will befall your Raspberry Pi if the control terminal of the servo demands too much current. Servomotors that draw more than 2A should not be used.

 

Q. What happens if I connect the power the wrong way around?

A. Hopefully not much. The ServoSix includes polarity protection.

 

Q. I don’t want to use batteries, can I use a power adapter instead?

A. A DC power supply will work fine with the ServoSix board. You can get barrel jack to screw terminal adaptors, or (and make sure the power supply is turned off) you can cut the plug of the power supply to connect to the screw terminals. The power supply voltage should match that of the servos you are going to use. This is usually 5 to 6V and also be capable of supplying the maximum current that the servos draw. If you are using the servo motors supplied with the MonkMakes servo kit, then a 5V 1A power supply is recommended.

 

Q. I can’t get sound to work on the Raspberry Pi while using the servosix library. Why is this?

A. This is a known side-effect of the way the ServoBlaster library works. If you really need sound, try using the GPIO.RPi library – the servo may be a bit jerky, but it should work. Here’s a link for that.