|The TSOP1838 IR receiver|
The transmitter sends a continuous stream of bits at a frequency of 38 KHz. When transmitting a byte, the transmitter starts with the most-significant bit.
Header: 77 cycles from high to low (13us high, 13us low) giving a total of 2002us followed by 1998us low.
Command: 12 cycles from high to low (13us high, 13us low) giving a total of 338us followed by 688us low for a 1 or 288us low for a 0. This is repeated for each bit (meaning, each bit is preceded by the 12 cycles).
Footer: 12 cycles from high to low (13us high, 13us low) giving a total of 338us. This marks the end of one “packet”.
The above information was commented into the code (written by Jim Hamilton of the RCGroups Message board) by Vivin Suresh Paliath.
I was able to wire the Arduino to an IR LED to send the IR signals to the helicopter. The values to be sent were controlled from a PyGame based Python program which had a crude but functional user interface that allowed input of various values using a keyboard-mouse interface.
|Pygame based Virtual Remote|
I found it somewhat slow to use, so I created a quick Python-based terminal-esque interface to change only the throttle value, so that I could quickly move the helicopter up and down. I did not include the other settings, pitch, trim and yaw, since it would slow it down and inevitably lead to a crash.
My idea was to connect the Wii Nunchuck peripheral and use it to control the helicopter, since I could send accelerometer data almost instantaneously and quickly process it, and control the copter accordingly.
For the next part in the series, click here.