Driving Servo Motors – ServoBlaster for Raspberry Pi

There are many hardware for driving servo Motors in Market. Servo Blaster software removes Jitter sound during servo operation. In Raspberry Pi you can use available GPIO as servo driver using Servo Blaster software. Servo Blaster is software designed by Richard Ghirst, for more detail about Servo Blaster visit GitHub page. 

sudo apt-get install git

Robotics and Coding Training

sudo git clone https://github.com/srcshelton/servoblaster.git

sudo ./servod --pcm &

 

In this article I am explaining how to drive Servo Motor MG 996R. Its same for other servo Motors also. PWM angle that Servo operate are between 60 to 240 degree.

 

Installing ServoBlaster on Raspberry Pi 

 

Install Git using this command

 

 

 

Create a clone or download source file from GitHUb link

 

 

 

 

 

 

 

 

 

Get into user folder. Make and Make Install

 

 

 

 

 

 

 

 

 

 

 

 

Run this command to check if servod installed correctly. Make sure to run as sudo. This command will list GPIO PIN that are in use and respective servo numbers assigned to it. Using ServoBlaster you can drive 8 servo Motors and it will use physical PIN 7 to 22.

***This is Important to run this command before running Servo Motor*****.

 

$ ./servod  --pcm

 

Usage: ./servod <options>

Options:

  --pcm            Tells servod to use PCM rather than PWM hardware to implement delays

 

Using PCM is a better option, as the 3.5mm jack also uses the PWM peripheral, so ServoBlaster can interfere with sound output. In my case 3.5mm jack oudio out stoped working in PWM mode, so recommended to run as PCM with --pcm flag.

This screen is for PWM, taken before i came across audio issue.

 

Run the command in background with & and press enter to come to command prompt.

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

To test single servo, connect servo data wire(orange color) to GPIO physical PIN 7 on PI board, check here for Raspberry GPIO PIN detail. Connect other two wire to external power supply 5V.

 

Command to use 

 

<servo-number>=<PCM angle 60 to 240(servo position)>

 

In below command is PIN 7 servo connected and 80 is PCM angle to rotate.

Run this command on command line to test servo.

 

echo 0=80 > /dev/servoblaster

 

This command will move servo to 80 degree from its initial position, similarly test remaining servo 1 to 7 and angle 60 to 240 degree angle.

 

Once you test all your servo position, now place your robotic hand servo and write down how much angle each servo has to turn. Then do programming accordingly. 

 

This is sample code shows how to use above servo command in python code using system call. In this code varible PWM Degree angle is passed as argument. This is usefull in making multiple angle movement for Robotic hand

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

First complete command is formed simillar to above command and then command is executed within os system call, simillar to command line. 

Please let me know if you have any questions and add your comments below. Thank you for reading,

 

If possible please like us on Facebook. 

 

loading...
(you must be logged in to Facebook to see comments).