Reading RC Receiver values (version 2)

in a previous post I briefly showed how to read the sum signal of a receiver that is able to output the signal. Although the code works quite well there are several issues with the code:

calling pulseIn(SignalPin, HIGH) blocks until the corresponding pin is set to HIGH, which is a major waste of time, because no other calculations can be performed in the meantime

I noticed that every now and then the readings start to glitch causing unwanted noise

To cope with the first issue I used Arduino's external interrupt feature that calls a callback function for every rising edge. In addition I wrapped it in a class and defined it as a library for easy usage.

[update: 2013-07-28][update: 2013-08-02]

However, the glitches persisted. Figuring out this issues caused a lot of headaches. To come straight to the point, the signal voltage level is not 5V but 3.3V! This caused the signal detection to occasionally misinterpret a 3V signal as LOW.

In the end the solution is rather simple. I used a p-channel MOSFET I had in my spare-part box and used it as a switch to drive 5V with the signal as input at the gate pin. This way the MOSFET acts as an inverter for the incoming signal while translating it to the 5V level. As I currently lack the time to draw a nice circuit please have a look at the following image I found via image search: circuit

I will probably switch to a RX/TX or bi-directional level converter that I have left over. They are smaller in size and I do not need the capability of switching 10A that the MOSFET currently supports.

I removed the MOSFET and used a level converter designed by Adafruit and distributed by Watterott. (alternative)

I haven't published the code to one of my repositories, since I need to review and clean it up a bit. I promise I will do that in the near future though 🙂

Even using here above linked board you will need almost all your code , infact you need to decode the rc mixed input on a single Arduino input line. Don't worry about being an unemployed Arduino coder :-))