PWM control on Raspberry Pi: a Servo. Second test on Hatalógico board

So after some testing with the Adafruit driver for PWM, I could write a little example to move a servo with the Hatalogico.

As you can see in the video, in this test the software just commands to move the servos between 0º, 90º and 180º with 0.3 seconds between each position.

Here is the code in GitHub: https://github.com/fdominguezr/Adafruit.PWM.library.git

Update 11/May/2015: Now the new program will ask you the position you want. It is here in GitHub.

You can see all the info about the Hatalogico board for your experiments here.

FAQ regarding PWM servo control with Raspberry Pi:

My servo is working erratically, what could be the problem?

Most of the time is wrong frequency for PWM configuration. I'm using 50 Hz of frequency which works for most hobby servos. You have full explanation here with an improved version of the test software ;-) 

Adafruit_PWM_Servo_Driver/Servo_Test_Asking_Position.py

 

Regarding the issue of "erratic servo movement sometimes) it can be:

To solve that issue you should:

  1. use the right frequency and PWM command for servos. (check Adafruit library or even better, my examples published here, already tested and working great: Adafruit_PWM_Servo_Driver/Servo_Test_Asking_Position.py)
  2. double check all circuit cabling.
  3. check soldering of header with a magnifing glass and a continuity tester.
  4. more difficult: see electrical levels with oscilloscope.
https://www.youtube.com/watch?v=W_0Qr5wTSCk

Great stuff Francisco, what

Great stuff Francisco, what frequency are you using for this?

I managed to get three servos running quite smoothly last night on my hatalogico, but every once in a while (maybe 1/20 commands) they start misbehaving and move in strange directions or jitter abit, especially if I turn them upsidown strangely…