I creating flybarless/stabilisation system for my rc helicopter and I need to read signal from 4 channels with good quality. The easiest way is to use 4x pulseIn for 4 pins, but it is inaccurate and not efficient.
I’ve got Spektrum AR6200 receiver - each signal is periodicaly updated (min. 50hz) and lasts for 1-2ms in HIGH.
Best results I have with interrupt TIMER1_CAPT_vect, not bad results with external interrupt - but both ways are limited with arduino or cpu (max number of external interrupts are 2).
Morover I need to send signal to 4 servos / arduino implementation is not bad and read data from gyro via I2C + some calculations but this is what works fine.
I found some howtos but all were limited to one input or all channels were connected to one pin - which is bad idea when receiver sends signal paralelly.
So I have to just add better/faster input read code.
Thanks to your help
Depending on the construction of the receiver, you may be able to find the point where the pulse train is still serial, which may mean you can use a single input pin to time all the channels. Careful examination at the actual servo outputs may mean you could re-multiplex the channels onto a single input using an external mux.
Thanks for your response, but I actually can't multiplex it - see my previous post ".. all channels were connected to one pin - which is bad idea when receiver sends signal paralelly." :( My solution should work with all kinds of receiver.
But the transmitter doesn't send the channels in parallel - there is a point in the rx where the pulses are still in series. In the Old Days the decoder was a simple TTL counter, reset by a simple RC triggered by the long low between channel frames. Unless the rx regenerated the pulses, they stayed in series, but on separate pins. Most, because of cost, did not regenerate.
True, but I can't solder pin to receiver board :-B
Because this receiver costs cca $90 and other users of this flybarless system wont to solder it too
You can use TT-RecEnc to encode your for signals into a PPM signal. Connecting it to one of the external interrupts on the Arduino.
I do have some code for reading a PPM signal from the TT-RecEnc, if you are interested.