Just a Quick One
Yesterday I received a a package, inside was my brand new Syma 107 IR Controlled Helicopter in red, before I even flew it myself I had to try and get my Arduino to raise and lower it. I open up my code into the Arduino IDE and uploaded, as normal it didn’t work first time, I ended up tinkering with the timings etc, until I got them right and the propellers spun up! It was game time.
The source for the proof of concept is available on Github, please feel free to fork, watch the project or even better follow me!
The Hard Stuff
As I have now got the device communicating with the Arduino the next step is to create a program which controls the helicopter, to begin with this will just emulate the controller which comes with the helicopter, I will be creating a framework so that you can have easy access to the Arduino.
I originally intended to write the whole package in Java (Cross Platform), however after pondering the pro’s and con’s I decided to write it in Objective-C (Mac OS X) only because I though I would benefit from learning more Objective-C - possibly something I will regret at a later date. Don’t fret though, I have got someone lined up to create a C# version for windows. Now if you are a linux user, which as you can tell from my site I do adore then you will be disappointed at the moment.
Both the ArduinoCopterS107 and the Arduino version are released under the MIT License, however I would like to know if you are going to use it (for self satisfaction =]).
My next post will be a demonstration of the helicopter flying around whilst being controlled by my mac, in the mean time here is a little video to show you the helicopter rising out of shot and then crashing on my bed whilst being controlled by the arduino.
The Software
- Arduino Code
- Arduino Controller for Mac OS X
Here it goes my first real venture into the fabulous world of Arduino’s, Hardware and possibly intense 1’s and 0’s; I have made various small projects using my Arduino Uno, none of them worth documenting, this one is an exception.
I will be interfacing with the Syma 107 IR LED controlled helicopter. I ordered mine on Monday 23rd August 2011 however I thought I could start working on the software and getting the protocol nailed down before it arrives, so most likely what you are reading here is not even relevant, but lets assume it is, and I have got it right first time. =]
Research
After researching the IR Protocol for the Syma 107, I came across this thread. I found some sample code which will move the helicopter up and down by gently increasing the throttle and back down again. The thing I need to do is research the IR protocol between the transmitter (Tx from now on) and the helicopter (Rx) - thankfully this had already done for me and this is what I found; The Tx sends a continuous stream of bits, 77 cycles of the LED (~2000us) for the header then 12 cycles (~300us) to mark the start of a command and then 4 bytes for commanding the Yaw, Pitch, Channel, Throttle and Trim (Fig 1.) This is then followed by another 12 cycles. (~2000) to end the command.
Binary Alert
Fig 1. ↓
0YYYYYYY 0PPPPPPP CTTTTTTT 0AAAAAAA
Yaw Pitch Throttle Trim (Adjustment)
C - denoted by the arrow, is the channel that the helicopter is on. Yaw / Pitch have the same mapping where 0 is left / backward and 127 is right / forward, as the channel’s 8th bit on the throttle is the channel the bit range that we get for channel one is 0->127 and for channel two 128->254.
As you may know I am using a Arduino Uno this has a Atmega 328P-PU with a clock speed of 16Mhz which will be needed otherwise the timings will be wrong. The circuit I have hacked up is a simple serial connection of the infrared led which I de-soldered from a Samsung TV remote, linked up to PIN 8 and with a 320ohm resistor to ground.
Hold Tight for even more Helicopter love when the beast is delivered!
Update 1.
I have now put my code on github, so check it out if you are that way inclined, please note that this is pre-alpha (I mean pre-pre-alpha) this code will possibly not work.
Follow me @tomgco