Step 7Controlling the Helicopter
Enough work ! No, really, YOU need a break ;) In this step, I'll explain how to control your Helicopter with your freshly-wired system.
- The nunchuk's C button (the little round one) is the Dead Man's switch. Always have it pushed down. If you release it, the Helicopter will receive the Stop command and will stop moving it's blades.
- You control the throttle (up/down) by tilting the nunchuk forward and backwards
- The joystick's X axis controls the Yaw (left/right)
- The joystick's Y axis controls the pitch (forward/backwards)
So this instructable is coming to an end, but stay tuned, because I'm currently building another remote for the heli, but this time, I'll be using an Android smartphone as the remote (It will be ready in 1 or 2 months)
- All right, so now, Have Fun ! (and spread the word ^^)
| « Previous Step | Download PDFView All Steps | Next Step » |












































I decided to try this with a helicopter that looks identical to yours but the Brand name is Xinxun and the model is X-02. From what I could see, the remote looks identical as well but looks seems to be where the similarity ends.
My remote has a switch next to the right stick labeled I/II. This provides high or low rate for the pitch motor. It also has a button labelled "change" that both changes the "band" of operation as indicated by the three LEDs just above the power indicator, and also turns the LED headlight on the heli on or off.
The IR pulse arrangement is completely different. Mine uses a series of 41 pulses. Each pulse is represented in the IR stream by either high (1) or low (0) (38 kHz off or on) state with a 0 being 450 microseconds long and a 1 being 900 microseconds. There are 6 bits each for throttle, yaw, trim and pitch, 4 unused bits (always 0), 2 bits to encode which "band" the remote and heli are operating on, one bit to send the status of the pitch dual rate switch, one bit to send the status of the change button, and then 9 bits that change depending on the values of the previous 32 bits, sort of like a checksum or encryption key.
This is the part I have not figured out yet. I can duplicate a sequence of pulses that I have captured using the logic analyser and the heli will decode it but I don't know how to code those last 9 bits for any variable pulse stream as generated by the nunchuck inputs. If the last 9 bits are not correctly set the heli just ignores that series of pulses and shuts down.
If anyone else has run into this type of coding and sorted it out please respond back.
I thing I almost have it figured out. The last bit is always 0 so that leaves 8 bits to decode and it looks like these are a combination of the four variables. I just need to determine if the combination is boolean and if so what (and, or, xor),
Thanks for your time.
If you want to control the heli's pitch/yaw with the accelerometer and throttle with the joystick, you have to:
- change some variable names in the heli_funcs.h file :
- change all the accy occurences with joyy in SetAbsoluteAltitude()
- change all the joyy occurences with accy in SetPitch()
- remove the accelerometer Y-axis inversion command ( accy = map(accy, 0, 255, 255, 0); )
- call SendCommand(altitude, accx, pitch, pot);
I hope it helped you... Let me know if you have any problems, I always answer ;)