I have built and nearly finished a pan & tilt time lapse system that uses servos for pan and tilt, and a servo relay to click the remote on the camera. It runs on a Rapsberry Pi using PHP. When panning/tilting, it has a starting position, an end position, and a number of intervals set. It calculates its next position using these 3 variables (with integer rounding) and works 99% of the time. This means every new position is always just a fraction different to the one before, to make it smooth.
Unfortunately, it intermittently pans (or tilts) ridiculously way off (more than 90 degrees sometimes) and then recovers perfectly for the next shot where it should be. I cannot understand what could make it behave like this. I have all of the servo values recorded in a log file, which I can mach up with each photo taken, so I know just where to look to look to see if my program is miscalculating values. It’s not though. The logs indicate perfect smooth movement.
I can only think that power issues might cause this but if that were the case then I would have thought it would become more apparent when the batttery gets weaker. I am using a 4000mah 2S 7.2V li-po battery hooked up to a 5v regulator, and the lipo has low voltage detector hooked up to each cell (set at 3.5v warning). I would have thought that this was a pretty good power control, so I am out of ideas.
If I can’t stop it from behaving like this then the project cannot work, so I would appreciate any feedback from anyone who has seen this before please.