servoblaster configuration


3 posts
by mweltin » Mon Dec 31, 2012 9:09 pm
I'm having trouble interfacing my servo motors via the servoblaster kernel model.

The basics of my set up are:
Rpi hardware version: Model B revision 1.0 + ECN001
OS: Latest Wheezy 2012-12-16-wheezy-raspbian
Servo: Htec HS-311 servo (I have two new ones, but only using one at a time for testing. )

I can load the servoblaster kernel module just fine. With a multi meter I was have been able to confirm that the circuit I use to buffer the gpio pin is also functional.

The issue is this. Sending a 0 plus width to the servoblaster works (e.g. 0=0 > /dev/servoblaster), but if I specify any other duty cycle (e.g. 0=90, 0=200 etc) the servo will simply turn clockwise until it reaches it's physical limit. No command I send will cause the servo to rotate in a counter clockwise direction.

The servoblaster README assumes a 600kHz clock. I found online that to check your clock speed you should look at /sys/devices/system/cpu/cpu0/cpu_freq/scaling_cur_freq. This file indicates my clock speed is 700kHz.

I have used the tick_scale command line argument when loading the kernel module, and set it to tick_scale=7. Tick_scale acts as a clock divider so I assumed '7' would give me the 10us clock tic. However, I still get the same behavior.

The README also mentions....
"However at least one person has reported that the pulses are out by about a factor of about 8,
and so are repeated every 2.5ms rather than every 20ms." In this case it suggests using
sudo insmod ./servoblaster.ko tick_scale=48

I have also tried that, but the odd behavior remains the same. I don't have a o-scope, and I'm not entirely sure I won't run into the same kinds of timing issues if I use Panalyzer either so I have not tried that yet.

I'm almost certain that it's a timing issue, but I can't seem to figure out how to adjust the module to send the proper control signal.

thank you,
mweltin
Posts: 10
Joined: Fri Sep 14, 2012 11:35 pm
by rgh » Tue Jan 01, 2013 9:57 am
Hi, panalyzer does not rely on the clock rate the same way servoblaster does, so it should be valid to use panalyzer to debug servoblaster issues. However, you could start by trying the servodebug utility mentioned here http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=15011&start=75#p220871.
Posts: 220
Joined: Fri Nov 25, 2011 3:53 pm
by mweltin » Fri Jan 04, 2013 4:36 am
I managed to get my hands on an oscope, and I was pulling the control signal from the wrong point in the circuit.

Thank you for your reply rgh, that was valuable information about Panalyzers use of the clock rate.
Posts: 10
Joined: Fri Sep 14, 2012 11:35 pm