part 1: Gestures+Heli

A follow up post, after my post about my Syma S107G helicopter. If you haven’t read that post, click here.

I mentioned in my previous post that I burnt an IR receiver. The module I was referring to was the TSOP1838, which had a unique pin-out, and I was able to get it right after a few tries.
 
The pinout is GND, +5V, OUT from left to right, when held with the bulging portion towards you.
 
The TSOP1838 IR receiver
Luckily, I hadn’t actually burnt it, so I was able to decode IR signals from my TV remote and assign unique key IDs for each key. However, when I tried sending signals from my helicopter controller, it could not detect them properly, and would not decode them successfully even when detected. This might also have been due to the receiver’s 38 kHz band as opposed to the transmitter’s band of 37 kHz.
 
I was planning to use the IR signals from the controller to decrypt the IR protocol being used to send the throttle, pitch, yaw and trim signals to the helicopter. Since the IR receiver couldn’t detect the signals, I researched online, and found that a USB logic analyzer could be connected to the pins of the micro controller on board the remote control, but since I did not have one, and did not wish to purchase one for another thousand rupees, I used protocol information made available on the internet by other hardware hackers.
 
 IR protocol is as follows:
 Yaw     Pitch   Throttle   Trim
Byte 1   Byte 2   Byte 3   Byte 4
H 0YYYYYYY 0PPPPPPP CTTTTTTT 0AAAAAAA F
 
H: Header
Y: Yaw
P: Pitch
C: Channel
T: Throttle
A: Adjustment (Trim)
F: Footer


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. 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s