oops
Active Member
- Messages
- 100
- Reaction score
- 166
- Thread starter
- #61
What I found when writing this for the RP2040 is that it's hard to do this fast enough in software to get precise figures. e.g. using an interrupt on edges and measuring the timer value to establish the pulse width gave some variation in the measured values for the same pulse width. Using PIO gives extremely consistent values. It looks like the ESP32 has a feature in its PWM hardware that can automatically measure the period between transitions. That said, doing it in software is probably good enough, as we're mostly using the RC inputs as a switch, rather than needing an analog value.
As far as I can tell, the pulse width is fairly well standardised, and ranges from about 1ms to 2ms, with neutral around 1.5ms, but the the frequency varies. 50Hz is "normal", but the Spektrum gear seems to run at 200Hz. I spent quite a long time convinced that my code was wrong because I can find absolutely no documentation of this! But as long as you can accurately measure the pulse width, it doesn't really matter how often you get pulses.
As far as I can tell, the pulse width is fairly well standardised, and ranges from about 1ms to 2ms, with neutral around 1.5ms, but the the frequency varies. 50Hz is "normal", but the Spektrum gear seems to run at 200Hz. I spent quite a long time convinced that my code was wrong because I can find absolutely no documentation of this! But as long as you can accurately measure the pulse width, it doesn't really matter how often you get pulses.