timrowledge
Posts: 1137
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

PCA9685 servo/pwm hat daemon?

Sun Dec 17, 2017 12:30 am

I've googled as much as I can think of on this but there appears to be no servoblaster-like daemon for controlling servos/pwm cia a PCA9685 HAT.

If anyone knows of one I'd be delighted to be enlightened! Otherwise I'm going to have to try to write one and that isn't an especially big ambition of mine...
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

timrowledge
Posts: 1137
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: PCA9685 servo/pwm hat daemon?

Sun Jan 07, 2018 5:28 am

OK, so absent any information whatsoever I made my own daemon.

Starting from old and non-functioning servoblaster code I
  • removed all the dma/pwm related stuff
  • changed the name(s) to protect the guilty and point at the innocent
  • completely rewrote the input parsing so it actually worked for '+X%' instead of making a total pigs-ear
  • changed to maintain a list of the current % of motion range rather than the simply annoying 'tick' counts
  • added access to the PCA9685 via pigpiod
  • ran it about eleventy-brazillion times trying to debug odd cases
T'ain't perfect, not by a long way but it does seem to function decently so far. It doesn't suck up cycles.It makes servos go where you tell'em to go. It could do withanother option to set the i2c address since the PCA9685 can be set to talk on a fairly wide variety. It would be nice to be able to make the servos move smoothly from one position to another with a nice acceleration curve.

Code & makefile & init-script here -
pca9685servo.zip
(8.36 KiB) Downloaded 74 times
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

timrowledge
Posts: 1137
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: PCA9685 servo/pwm hat daemon?

Sat Feb 24, 2018 4:51 am

After much banging and copious swearing, and some crucial last minute help from joan, the pca9685servo daemon is now working sufficiently well that with a suitable systemd unit file installed to fire it up we can set up a Pi with MotionEye, enable pigpiod, enable pca9685servod, reboot and immediately have a working motioneye server with control over pan and tilt.
Making Smalltalk on ARM since 1986; making your Scratch better since 2012

timrowledge
Posts: 1137
Joined: Mon Oct 29, 2012 8:12 pm
Location: Vancouver Island
Contact: Website

Re: PCA9685 servo/pwm hat daemon?

Thu Apr 26, 2018 9:48 pm

Making Smalltalk on ARM since 1986; making your Scratch better since 2012

Return to “Add-ons”

Who is online

Users browsing this forum: No registered users and 2 guests