Uncomfortable Travel

How the wheels have survived the journey so far astounds me. Nurse and I have been closed up in the pitching carriage for the better part of a week, covered with a warm quilt. It will be with great…

Smartphone

独家优惠奖金 100% 高达 1 BTC + 180 免费旋转




How to read RC receiver signal with Arduino

It’s very easy to find documentation on how to use a RC transmitter and receiver with servo motors or flight controllers, but it’s not that easy to find examples on how to read RC signal using Arduino. So, I decided to write a very straightforward tutorial.

I’m using a FlySky FS-I6X transmitter with a FS-iA10B receiver, but it should work with any receiver that works with PWM (Pulse With Modulation). This is the same protocol used by Arduino to output analog values trough the pins marked with ~ symbol (but as we will use Arduino to read, we don’t need to use only these pins).

The idea is to connect the receiver pins of each channel you want to read from, to a digital port in Arduino. It’s very straightforward. The Arduino pins will act as input ports and the receiver needs to be powered with the 5v from Arduino too. This is the wiring schema to read the 5 channels from the receiver, the 4 channels for gimbals and 1 channel for an on/off switch:

In your Arduino sketch, you will set the pins you are using to read as input pins 'pinMode(pin, INPUT)’ and will read the value with the function ‘pulseIn(inputPort, HIGH, 2500)'. This will return the duration of the pulse that, in practice, means a number between 1000 and 2000. For negative values on your gimbals, we will read numbers from 1000 to 1499. For 0, we read 1500. For positive values we read numbers from 1501 to 2000. Of course this can change a bit, depending on your transmitter configuration. Instead of dealing with this range we can use a ver handy function, that translate one range to another 'map(channelValue, 1000, 2000, -100, 100)’. This will convert any input from the receiver to a proportional number between -100 and 100. If the receiver is off you will probably read the value 0, so we need to protect our code against that.

Another point of attention is the reverse feature from your transmitter. I used that for one of the available switches. As the FlySky transmitter enforces you to put all switches up before connect to the receiver, the 'off' value is actually the highest value (2000). So, you may think to revert this channel, in order to get 'off' value as the lowest value (1000). But if you turn on the receiver with the transmitter off by mistake, you may have an 'on' situation with no signal being read. I know you must never turn on your receiver with your transmitter off, but when you are developing, it just happen. So, it’s better to prevent than use the reverse signal feature in your transmitter.

Add a comment

Related posts:

From Inc 500 to Hack to Shut Down

I recently was forced to shut down IdeaBuyer.com, a company I had started 13 years ago, due to a catastrophic hack. It brought a company that has been in business for 13 years, twice recognized on…