Introduction: InfraRed Receiver
Ever wanted to be able to control your Arduino project with an InfraRed remote control? I'll show you how to build a very simple IR-receiver.
Step 1: Gather Materials
1. Some kind of Arduino. For this, I'm using a Pro Trinket from Adafruit:
1.a. The Pro Trinket has this little "backpack" you can attach to it. I'm using that to connect to and easily charge the battery, as well as add the switch:
2. IR Receiver:
3. Wire. Some solid-core, some male jumper cables:
4. Lithium-Ion Battery:
6. SPDT Switch (optional):
7. LED (optional):
8. Resistor (optional)
9. 1000 micro-farad Capacitor (optional)
Step 2: Plug in the IR Receiver to Your Breadboard
The "front" of the IR Receiver is rounded. The back is completely flat. With that orientation in mind, the center pin is ground, the right pin is Vin, and the left pin is signal.
Step 3: Add LED (optional Step)
The LED will flash whenever the IR Receiver picks up an IR signal. Connect a resistor to the "signal out" leg of the IR Receiver. The other end of the resistor goes into the negative/cathode leg of the LED. The other end of the LED needs to connect to power.
Three ways to recognize polarity of an LED:
1. The shorter leg is the negative/cathode leg
2. The head of the LED is flat on the side that is the negative/cathode side.
3. Inside the head of the LED, the larger metal piece is the negative/cathode side.
Step 4: Add Arduino
My Arduino has male header pins on one side, and female headers on the other. The male headers keep it locked into place on the Breadboard, and the female header pins make it easy to change the circuit.
Arduino pin ----------- Breadboard
3.3v ----------------------- Red power line
GND ---------------------- Ground line
5 --------------------------- Signal out from IR Receiver
Step 5: Add Switch (optional)
First, cut the trace between the two pins on Adafruit's Li-Poly Backback. Then, strip a bit of insulation off of two jumper wires. Carefully solder the jumper wires into the holes, but be sure to avoid creating a short to anything underneath the Backpack. Finally, provide some strain relief to the delicate jumper wires with hot glue.
Now, plug in the SPDT switch to the breadboard. You'll connect one jumper cable to the center pin, and one to either the left or right pins. It doesn't matter if you use the left or the right pin, but be sure to connect one to the center. That way, the switch in one position will be "open" (or "off") and the switch in the other position will be "closed" (or "on"). Also, be sure to note that these switches tend to be "make before break," which means that they momentarily short the left and right pins together as you slide the switch.
Step 6: Program the Arduino
First, you'll need to read the values of your IR remote. I'm using a Creative remote, which sends out IR commands at 38kHz. I used Adafruit's handy IR tutorial to figure out what my remote was sending:
After hooking that up, and pressing all the buttons, I was able to capture the IR codes from my Creative remote. Now I can look for those commands in my new sketch (attached), and take some action based on them.
Step 7: Hook Up Some Neopixel LEDs (optional)
Here's where you'll use the capacitor, as recommended in Adafruit's Neopixel Uberguide. My Neopixels are going into pin #4, but you can change that however you wish.