Instructables

Puzzlebox Orbit: Using an Arduino to Control an Infrared Helicopter

Featured
Picture of Puzzlebox Orbit: Using an Arduino to Control an Infrared Helicopter
In this Instructable we will explain how infrared signals are used by a remote to control a toy or device, then show how a simple circuit can be added to an Arduino to operate the same device through free, Open Source software.

This document is part of a series covering the Puzzlebox Orbit, a brain-controlled helicopter that features an open design, open hardware, and open software. The helicopter can be operated via an EEG headset plus either a mobile device or the dedicated Puzzlebox Pyramid remote control unit. The Puzzlebox Pyramid includes a micro-controller based on the Arduino.

While we refer to the Puzzlebox Orbit in our examples, the principles, source code, and to a large extent software are all directly applicable to most any toy or devices which use infrared (IR) for remote control.
 
Remove these adsRemove these ads by Signing Up

Step 1: The Remote Control

IR Code.png
IR Carrier.png
Here we explain in a very broad sense how an infrared remote control works.

There is at least 1 infrared LED (or Infrared Emitter, IR LED, IR Emitter) inside every infrared remote control, including the one you use to control your TV set. When you press a button on the remote, the IR LED will give out a certain series of "LOW"s and "HIGH"s which represents a series of "0"s and "1"s. (To be strict, it is common that a "HIGH" and a corresponding "LOW" consist of a "0", and another combination of "HIGH" and "LOW" with different period represents a "1".) Different series of "0"s and "1"s can mean different things, for example maybe "1100100000111" can mean "Turn Off the TV", and "001101011100" can mean "Volume Down".

Infrared is also cast by light and heat sources all around you: light bulbs, sunlight, heaters, even people. Therefore the remote control needs to have a distinct method of sending out infrared code to the receiving device (TV set, helicopter, car, etc.). That's why infrared normally transmits with "carrier" - a high frequency square wave sequence (normally 36kHz, 38kHz and 40kHz). So, if you were to capture and zoom in on an infrared signal, you would find each "HIGH" consists of a sequence of square waves rather than a continuous "HIGH" voltage level.

Check out Wikipedia:Infrared Remote Control for more information about infrared remote controls.
nbeched1 year ago
I would use a higher base resistance, or use a n-channel MOSFET in the first place (no "base" resistor needed) and connect the emitter (source on a MOSFET) straight to ground, then put the IR LED right next to the R2.
Thanks. Awesome project.
puzzlebox (author)  nbeched1 year ago
Again, thanks for the feeback! While we agree that your way suggestion would work, could you explain the precise advantage of your circuit design?
The reason to connect the emitter/source of an NPN/N-type to ground is to simplify the calculations. As nbeched mentioned, you probably want the resistor in series with the IRED doing the current limiting rather than the transistor, in which case you calculate that resistance as (Vcc-Vdrop)/Iled, which would typically be (5-1.2)/.1=38. Then, separately you can calculate the base resistor to be <= (Vout-0.7)*alpha_min/Iled. Alpha should at least be 10-20, so you can usually just cheat and make that resistance 10x the other resistor.

If you're trying to be as efficient as possible with a BJT (a FET would be more efficient,) your method is better (the above wastes the base current,) but a bit of a pain to calculate, and in some circumstances may not work (if Vcc is too low.) Iled = Ie = Ib + Ic. Rb will now be (Vout-Vdrop-0.7)*alpha_min/Iled.
I'll try not to confuse too many people and it's hard to do it in a comment without a picture and what not, but I'll try.
When you use a transistor as a switch, you want the collector-emitter (drain-source with MOSFETs) voltage to either be minimum or maximum. Minimum signifies the ON state (for the load) and the maximum (as you have guessed) the OFF state. Minimum Vce corresponds to a minimum Rce (collector-emitter resistance) - ideally (well, theoretically) a short circuit. Maximum Vce (and max Rce) implies a very high resistance (ideally, open circuit or infinite resistance).
The way you have drawn it may be fine for an LED, but if the transistor does not "reach" saturation, higher power loads would cause the transistor to overheat and potentially burn.
For this reason it is a common practice to use an NPN transistor (or n-channel MOSFET) closest to the ground and connect the load from your positive supply to the collector (drain in MOSFET). The opposite may be done with pnp or p-channel MOSFET, but npn/n-ch is generally preferred for if the ground is common, load can be powered from a higher voltage as long as your transistor can handle it.
Again, this only applies when operating a transistor as a switch, when you make an analogue amplifier (e.g. audio), you want it to be in active region in a similar configuration to what you have...

If you follow my advice, you may want to put a higher valued resistor for R2 as when the transistor saturates, you might end up pulling more current and potentially burning the LED.

Hope this makes it clear and hope I didn't confuse too many people.
nadkarsushant5 months ago
dmb00581 year ago
Hi ! I've tried your instructable as I had a "Robotics UFO" ball helicopter which I think is the same as the one you used, and all the other bits in my junk box. I'm finding a problem though, wondered if you had any ideas. The commands don't produce any response. Instead, after what seems like a random interval, the 'copter will go to full throttle, lift off and a few seconds later, go to zero power ! The handset controls it fine as usual, and the IR circuit is blipping away (can see it on my phone camera - nice tip !), so I don't know where to look really.
cogit0 dmb00588 months ago
I've having the same issue as dmb0058 and hopkinsbizz: the LED is blinking along nicely, but sent commands have no effect. The prop starts up ('p' command?) after ~10 seconds, stays on for 2 seconds, and then shuts off. I've added debug statements all over my code to see if anything is being sent randomly, and the COM port looks quiet. Not sure whether if there is a fault in the output code generation or if there is something subtle in my circuit that I'm missing. Any help is appreciated!
I was wondering if you ever got this issue solved? I am having the exact same problem. I have everything set up, but it will only come on randomly. As far as I can see, I am using the same heli as the Puzzlebox Orbit Project is. Thanks
techhobbit1 year ago
FYI: The cheapest I've ever seen any of these helicopters is right now at JCPennys... online (and at my local store)... $12 each!
I have one of these helicopters and I can't fly it. I bought it while out of state so I cannot go back to the place of purchase. When you apply enough throttle to make it fly, instead of going up, it shoots across the floor. If you have any thoughts on adjustments, I'd be very grateful.
By the way, nice project for learning about the arduino and breadboarding a simple circuit.
puzzlebox (author)  mid_life_crisis1 year ago
First thought would be to make a close inspection of the mast, especially between and around the rotor blades. Sometimes a stray hair can collect and wrap around here, throwing off navigation. Besides that damaged rotor blades or a low (or bad) battery might be contributing factors. We supply replacement blades with the Puzzlebox Orbit.
Mic1001 year ago
Good instructable and realy nice project :)
Edgar1 year ago
Great project, went to my Blog:
http://faz-voce-mesmo.blogspot.pt/2012/11/muahahaha-instructables-e-ideias-geniais.html
nbeched1 year ago
Please add little comment boxes around the IR LED in both pictures explaining the effect, as when I first looked at this step, I thought "Why on Earth would you take a picture of your phone taking a picture of the circuit???" :)
puzzlebox (author)  nbeched1 year ago
Thanks for the great feedback. Comment box added!
dgateley1 year ago
Excellent project. One will learn a whole lot of very useful things replicating it and there is great opportunity for going deeper. An ideal Arduino starting project.
I love the exoskeleton design of the helicopter! thanks for the info.