This IR remote project is made of parts from an old IR TV remote, 2 SimpleCircuits, and a TinyDuino. It's possible to eliminate software entirely by replacing the processor with the frequency generator SimpleCircuit,  but we decided not to because a processor produces a more repeatable carrier frequency.

What you will need:

- SimpleCircuit #1: Push button with schmitt trigger output
- SimpleCircuit #2: N-Channel MOSFET (w/ 10k pull down resistor)
- Tinyduino processor, programming board, and protoboard sheild
- IR LED: pulled from an old IR remote
- 8 Ohm: pulled from an old IR remote

The Simple Circuits can be found on our Kickstarter
The TinyDuino can be purchased from Tiny Circuits   (Any Arduino will do, we just like this one!)

## Step 1: Getting the IR LED

The IR LED should be obvious once you break open your old remote. The 8 ohm (ish) resistor may be a little harder to find (I've seen 4 ohm and 10 ohm but never much more than that).

If the remote is entirely SMT, look around for the largest physically sized resistor (0805+). Unsolder the resistor and measure it to be sure. Remember, you may or may not be able to measure the resistance of a resistor when it's soldered to a board, so if you're having doubts remove it before you measure it. If the remote is made of through hole components, look at the resistor color bands for help. Here is a link to a good resistor color band calculator.

## Step 2: The Schematic

We were able to prove the design by simply outputting a continuous 38kHz signal at the gate of the MOSFET and reading the signal with our IR Receiver Circuit. It worked from across the room and we were happy with the results.

The rest is software. We used the "tone" command in Arduino, but there are several other ways to create a 38 KHz pulse, this was just simple, quick, and easy for everyone to understand.

void setup ()
{
tone (10, 38000);  // (PIN #, Frequency)
}
void loop ()
{
}

Just upload the code to your Arduino and everything should go smoothly... now for the fun part!

Next,  we'll complete the circuit by designing our own IR receiver that's compatible with (all?) commercial IR remotes. To prove our design, we'll use an AC relay (Simple Circuit) to control a 60W light bulb.

Components List:

- SimpleCircuit Relay with N-Channel Coil Drive
- Tiny Duino
- IR Receiver: pulled from an old cable box

## Step 4: Disassemble Time

Take apart an old DVD player, TV, VCR, Cable Box, anything, because what we're looking for is something that looks like the picture.

That blacked out LED surrounded by shiny armor is an IR Receiver. This smart diode will automatically put out a logic 1 or 0 if there is an IR LED within range transmitting at a certain carrier frequency. This frequency varies between manufacturers but it's common for an IR receiver like this to be compatible with more than one carrier frequency.

The pin out for my receiver is:

- A: Vout
- B: GND
- C: VCC (2.7-5V)
- D is the bypass cap. Salvage this and resolder it between VCC and GND.

Hint: When you're trying to reverse engineer the pinout of your IR receiver, start by observing which pins are bridged by the bypass capacitor. By process of elimination, Vout is the pin not touched by either capacitor lead. GND was obvious by looking at the markings on the big electrolytic capacitors and performing a continuity check.

## Step 5: Build Time

Now all you have to do is connect an output; in this case we're using an AC relay to toggle a light bulb.

First Circuit is drawn using SimpleCircuits. Second with a typical Relay schematic symbol.

Using the simple switch tutorial from Arduino's Tutorial's  we were able to successfully turn out light bulb on and off using our IR remote and receiver.  Now you can turn anything on and off by just sitting on the couch!

int inPin = 2;         // the number of the input pin
int outPin = 13;       // the number of the output pin

int state = HIGH;      // the current state of the output pin
int previous = LOW;    // the previous reading from the input pin

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0;         // the last time the output pin was toggled
long debounce = 200;   // the debounce time, increase if the output flickers

void setup()
{
pinMode(inPin, INPUT);
pinMode(outPin, OUTPUT);
}

void loop()
{

// if the input just went from LOW and HIGH and we've waited long enough
// to ignore any noise on the circuit, toggle the output pin and remember
// the time
if (reading == HIGH && previous == LOW && millis() - time > debounce) {
if (state == HIGH)
state = LOW;
else
state = HIGH;

time = millis();
}

digitalWrite(outPin, state);