Servos are very useful little devices.  They let turn them about through 180 degree (half a circle) and hold their position.

So they are very useful to control the position of the Pi camera or robot arms or lift pens up and down.


The most popular ones come with 3 pin socket – Brown is Gnd, Red is+ve and Yellow is the signal wire which gets connected to a Pi Pin.

Note: It is more reliable to connect the +ve wire to a separate battery but if you power your Pi from a good PSU then it will probably work.

ServoDocsTo use, simply create a variable called servoX (where X is the pin you have connected the signal wire to).  The servo values are from -100 to 100 with 0 moving the servo to its centre position.

All servos behave differently and not all will take the maximum or minimum values of 100 and -100.  If you find your servo is making “funny noises” then try using values of 90 and -90 or even smaller if needed

Using Adafruit 16 Servo/PWM board with Servos

Adafruit produce a very nice board with ability to very accurately generate pulses for motors and servos

To use it with ScratchGPIO use variables AdaServo0 to AdaServo15 with values from -90 to 90 as above to control servos.

Using Adafruit 16 Servo/PWM board with LEDs

If you just want to  use the board to control some LEDS , use variables AdaPower0 to AdaPower15 with values from 0 to 100.  This will give rock steady results unlike normal ScratchGPIO power command which causes the LEDs to flicker.