50Hz PWM

Hi

I have read quite a number of posts regarding controlling servos with Navio, but the problem is the different PWM frequencies used, ie ESCs at 490Hz vs servos at 50Hz (or more for digital servos).

As I didn’t want to get a digital servo (and still have to compromise the 490Hz) or get a separate PWM driver board, I ended up using PIGPIO and a spare GPIO pin from the DF13 6-way connector (GPIO 17).

Very simple setup:

The above command sets the pulse to 1.5ms on GPIO 17 (50Hz).

I am not sure if it is OK to run PIGPIO together with ArduCopter, but will be testing that next. If anyone knows of any possible issues, please let me know.

Regards
Keith

Hi Keith,

This is potentially very dangerous!! PPM decoding in APM on Navio+ is based on DMA sampling and pigpio uses same resources. You will have numerous collisions that will result in unpredictable performance. I strongly discourage anyone from using pigpio with APM!

Hi Igor

Thank you for your quick reply.

I can see the dependency on pigpio in:
Navio/C++/Examples/PPM-decoder/PPM.cpp

But I cannot see a dependency in the ardupilot codebase?

Can you point me to the pigpio initialisation/code in ardupilot please, I will try to see if I can create an integration point there, so that I can control the servo from arducopter itself.

Its OK, I found it: RCInput_Navio.cpp

Looks like it has moved from using the pigpiod daemon to direct DMA control… Might make integration a little bit harder…

We are not using pigpio, but base our code around same resources (DMA channels), you can see more here https://github.com/emlid/ardupilot/blob/master/libraries/AP_HAL_Linux/RCInput_Navio.cpp .

Also, when you launch pigpiod it has higher process priority than anything else running on the RPI.

I ended up using a separate PCA9685 to drive the servo, all good.

Do you have some more details about using this PCA9685 board with the Pi ?

I got one of these to get things going: