Tuesday, April 12, 2011

Arduino and Tx/Rx system

In the previous article the PWM signal was described, which used to control servo motors. Today we will use the following Transmitter/Receiver (Tx/Rx) and the Arduino to read PWM signals.
Tx/Rx manufactured by www.HobbyKing.com
The above Tx/Rx systems usually used for controlling airplanes, helicopters and other remote vehicles. This one has 6 channel, which means it can control 6 different motors (servos and other types).
In the following picture you can see 7 row of pins(6 channels + battery).
This Tx/Rx system comes without any documentation, so the only way to get more information is to google the Internet. Actually I thought that the receiver gets it's power from the battery pins(I don't know why 3 pins) and generate appropriate PWM signals on all channels, but I discover the following:
If connect only(without battery connected) channel pins to appropriate Arduino pins(+5V to +5V, Gnd to Gnd, and Signal to digital port 2), then the receiver will work and on the signal pin it generates PWM signal, coming from transmitter. To read the signal, connect 2nd channel pins to Arduino appropriate pins(The 2nd channel corresponds to throttle). Connect signal pin to Arduino digital pin 2.

The Arduino has a PulseIn function, which can be used to read the PWM pulse width. The micros function returns the number of microseconds since the Arduino began running. Compile and upload the following code and run it then switch-on the transmitter.
Before switching on the transmitter, the time interval is about 100ms, which is equal to 50ms timeout time + Serial print times, and the pulse width is 0(no signal). When the transmitter switched-on, the pulse width is near to 1460us and time interval reduced to ~66ms, which now is equal to ~20ms period time + Serial print times.
Switching-on transmitter
And this is the screenshot of Serial output when the throttle is changed by moving joystick up and down.
Moving throttle joystick up/down
That's all.


  1. Hi Mkrtich,
    This post is very helpful to me. I am interested to make the same thing. However I am newbie to Arduino. Would you please teach me which Arduino board is used and how do you connect the servo signal to the Arduino board?

    1. Hi Donald,

      I tried with Arduino UNO and Duemilanove. In the article it is described how to connect servo signal pins to the board (+5V to +5V, Gnd to Gnd, and Signal to digital port 2)


  2. Thanks Mkrtich. I will get one of them.
    Thank you for your help.