Servos

Full Servo support only available in ScratchGPIO6 https://cymplecy.wordpress.com/2013/11/26/scratchgpio-development-testing/

Servos are very useful little devices.  They let turn them about through 180 degrees (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.

YOUR PI MUST BE SWITCHED OFF BEFORE CONNECTING OR DISCONNECTING SERVOS

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

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

 

3 thoughts on “Servos

  1. Hi,
    Loving ScratchGPIO. Thank you for putting it together. I have a few things I am trying to clarify, I appreciate any help. I am working on a project and using ScratchGPIO because I want to keep it as simple as possible for kids so they can learn from it. Where I am stuck is with Servos. I need to handle 12+ servos, so I am using the ADAfruit PCA9685 16×12 PWM board. I read in one of your posts (I thought) that it is supported. I see the ADAfruit I2C libraries in your code. Here are my questions: (1) Is it supported? In what versions? (I have tried 5, 5dev, and 6 alpha) (2) I can work with the board via Python, so I know it works, and its recognized. But perhaps I am calling it wrong? Can you show an example of how to call the board? In one post you mention ADAServo0, ADAServo1 – but I can not get that to work. Again any help appreciated.
    Thanks!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s