I'm building a quadcopter using the RPI 2 Model B. I'm currently using the Pi4J library (Java library that wraps the WiringPi library) for my project. All is going well except my ESC (Electronic Speed Controller) requires a PWM signal of about 385Hz (2.6mS pulse width) and a minimum pulse width of 1.0mS (low throttle) and 2.0mS (max throttle). The WiringPi's SoftPWM library only supports pulse width increments of 0.1mS, which only gives me a effective of 10 levels of speed control (plus off state). Are there any software/cheap hardware (or a combination of both) solutions that can allow me to control 4 outputs at the same time with a pulse width increment of 0.05mS or less? If there are software solutions it must be in Java.
1 Answer
The Pis with 40 pin expansion header (and the compute module) have two hardware PWM channels which you should be able to use with wiringPi.
That would give you control of two ESCs.
From the software side there are several modules which provide DMA timed PWM on any or all GPIO (e.g. my pigpio, servoblaster etc.). These modules provide a pipe interface to their functions. pigpio also provides a socket interface.
Speaking for pigpio you can use frequencies of 400, 320, 250, 200, 160, 100, 80, and 50 Hz at a 5 µs pulse width resolution.
Adafruit sell a so called 16 channel servo driver (it is actually a LED driver) which may work at other than 60 Hz. You'd have to check and see. As far as I'm aware it has no Java interface so is of little use to a non-programmer.
-
1About the two hardware PWM channels, which two channels are hardware PWM? How can I control them using lower than 100 uS resolution? Dec 26, 2015 at 14:07
-