It sounds like the servos are receiving random and incorrect signals, possibly due to a faulty electric connection that’s capturing signals from another pin. Try jostling around the GPIO pin insets and/or re-flowing solder joints.
I’ve never heard of anything like this before and my own pan-tilt hat has never done anything like this yet… It might be an issue on the board, but it’s unlikely.
The off-position 0-ing isn’t that hard of a bodge-fix. Just try setting your 0 position in your Python code.
Let me do a bit more research and I’ll get back to you with a better fix! :)
It seems to fix this, you should pop over to the “/library/pantilthat/pantilt.py” part of your pan-tilt hat directory (wherever that is) and change the values
in order to re-adjust the minimum and maximum position of your hat, which should hopefully reset the 0 position as well. The values are PWM (Pulse Width Modulation) based, so I’m not sure myself how they translate to degrees, have a fiddle around!
I’m still not sure why your hat moves randomly at boot. It is possible it’s a fault with your Pi, but I’d prefer to resort to that as a last resort (shortly after an error with your hat). Try running the “test.py” file in the library directory and see if you get, to Phil’s dismay (yes, I found that little Easter egg there sir), a happy message that your haven’t broken anything. If not, do post the log up here or have a look for any errors that may suggest why you’re getting this erratic behaviour!
Hi, I have same problem, but I am waiting for a longer cable for the camera [20cm] as it all looks very tight when moving around. I suspect when they put it together the servo is not in the zero position, Once I get the new cable I will try the following put the servo with a python call to pan 90. Then unscrew the pihat from the servo [careful as not to move it, there is one screw on the bottom in the servo, unscrew and reposition the pihat.
If that is not going to work I need to find some more information about the pulse width and how this relates to the zero position, But I have strange effect that with every reboot the hat turns more to the left each time…
That PDF is confirming the 1000-2000ms but you can easy set the pan to pulse_min 600ms or lower, so I really think we are talking about 2 different things here and the relationship to the degrees is total different. just my 2c.
Over more testing I discovered the pantilt is very unrealiable and generally innacurate.
Now this may be because of the poor quality of the servos - you get what you pay for after all.
It maybe also be that driving it via GPIO is not good enough. I recently discovered this http://pythonhosted.org/RPIO/pwm_py.html - basicaly a more accurate way to drive servos.
@gadgetoid do you think this RPIO PWM lib could be integrated in?