PWM read

Moderators: adafruit_support_bill, adafruit

Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/
Locked
User avatar
lsoltmann
 
Posts: 12
Joined: Thu Mar 27, 2014 10:13 am

PWM read

Post by lsoltmann »

Is it possible for the Raspberry Pi to read a PWM signal directly? Google seems to indicate that this is not possible. If it is not possible, is there a breakout board that is able to read a PWM signal and send it to the Pi over I2C or some other interface?

I am in the process of building a flight computer and need to be able to read the PWM signals coming from the receiver (standard RC protocol, pulses sent every 20ms with a pulse width range of 1 to 2ms) and add or subtract from them before sending them to the servos over the Adafruit 16-channel 12-bit servo driver. Any input is greatly appreciated!

charhaL
 
Posts: 1
Joined: Wed Nov 20, 2013 3:25 am

Re: PWM read

Post by charhaL »

The raspberry pi has too many processes running to handle analyzing a fast PWM signal. You can type " ps - a " to see them all.
The rpi has a single core which switches between processes. The time between each process changes based on total number of processes, and process priority.

The PWM read needs regular interval "real" time. Something like an arduino atmega chip does! No operating system, and only a single process: your code.

The best solution to this would be to embed an atmega in your project.
PWM signal from receiver -> arduino digital pin -> process signal -> arduino i2c -> raspberry pi

Once it's working with the uno, just pop your already programmed atmega out and into your project. (it will execute the same code every time it has power)
ATmega328 w/ arduino bootloader is about 3$ each, embed them everywhere.
Especially if you are making something which fly's, I imagine space and weight are limited.

Locked
Forum rules
Talk about Adafruit Raspberry Pi® accessories! Please do not ask for Linux support, this is for Adafruit products only! For Raspberry Pi help please visit: http://www.raspberrypi.org/phpBB3/

Return to “Adafruit Raspberry Pi® accessories”