Tuesday, May 16, 2006

What It Does

This system is used to distribute IR commands around your house. This is useful if you have A/V equipment in one room that you want control from several other rooms.


Features

  • 6 inputs -- allows you to control your equipment from six different places
  • 2 outputs -- allows you control equipment in two different places
  • 2 inputs/outputs -- allows equipment in these two places to send or receive IR commands
  • Status LEDs that tell you the state of each input
  • 4 IR LED "blaster" outputs
  • Rogue input detection -- causes an input line to be ignored if it keeps asserting its line for no reason

Hardware / Firmware / Software


This project uses one Microchip PIC 16F877 to do all the work. The firmware is written in mostly C. It is compiled with Hi-Tech's free PIC C compiler, available here. The schematics were drawn with CadSoft's Eagle schematic drawing program, which is also free, and available here.

The source code for this project can be found here. Get the latest version.


Schematics

Here is the main schematic. Click on it for a larger picture. It can be built one of two ways: simple input mode, or deluxe input mode. With deluxe input mode, the circuit can detect which inputs have something connected and will inform you via the status LEDs. If an LED is off, there's nothing connected. If an LED is on, there is something connected. With simple mode, the circuit can't tell you whether there's something connected or not, but it does use less parts.

To select whether you want to simple or deluxe mode, you will have to change the BETTER_IR_EYE_MODE definition in the code and re-build. The code has been built in deluxe mode by default.


Main Circuit Schematic


Inputs

Port B is used for the eight inputs. Each input is connected to one of two things: a piece of equipment that has some sort of remote control jack (like a Pioneer SR jack), or an IR receiver module, or "eyeball". Either way, the signal must be +5V when idle and have 0V pulses when active. If you hook this to some equipment that has an output jack, it is expected that the equipment outputs a baseband (ie, demodulated) version of the modulated IR pulses from your remote controls.

The inputs can be set up in simple mode or deluxe mode. In simple mode, no extra components are needed for the inputs. The internal port B pullup resistors are used. If an input is high, either nothing is connected, or it is idle. An input will pulse low when active. If an input gets stuck low, then there's a problem with the device connected to that input.

In deluxe mode, the system can determine if there is something connected or not. This is done by disabling the internal pullup resistors and supplying your own pull up/down resistor connected to port E bit 2. This bit is continuously toggled between high and low to cause the resistors to toggle between pullup and pulldown. If nothing is connected to an input, its state will follow that of the port E bit. If something is connected, the input will be high all the time. An input will pulse low if active. If an input gets stuck low, then there's a problem with the device connected to that input. Of course, without the status LEDs (discussed later), there's no reason to use deluxe mode instead of simple mode.

The firmware has compensation for the on and off delay of the IR receivers. It turns out that with the receiver modules that I was using, it took four IR pulses before the module would trigger and assert its output, but it would take seven missed pulses before the module would return to the idle state. This would cause the IR blasters to send an extra three pulses. The firmware compensates for this by initiating a three-pulse delay before starting to send out the IR pulses.


Outputs

Port A bits 4 and 5 are outputs. Like the inputs, they are +5V when inactive and pulse 0V when active. They are expected to be hooked up to equipment that can accept this sort of signal (again, like a Pioneer SR jack).


Inputs/Outputs

Port B bits 0 and 1 are special because they are both inputs and outputs. They are normally set up as inputs when the system is idle, but they get changed to outputs if another input triggers the system. These are useful for rooms which contain equipment that you want to control, but you also want to be in this room and control equipment in other rooms.


Modulated IR "Blaster" Outputs

Port A bits 0 through 3 output a 40kHz modulated signal when the system is active. The outputs are 0V when idle but pulse +5V when active. It is expected that these are hooked up to IR LEDs. Port A IR output bits 0 and 1 are special, and they correspond to Port B input/output bits 0 and 1. When and input is received on input 0, all modulated IR outputs will be active except for output 0. This is in case you have the IR LED pointed at the IR receiver in that room. You will get some nasty feedback if you start outputting IR pulses in the same room that's receiving IR pulses from your remote.


Status LEDs

Eight LEDs are connected to port D and report the status of each input. The states are:

Simple Mode

  • LED off -- nothing connected, or input idle
  • LED pulse -- input active
  • LED repeatedly flashing -- input has a problem and is pulling low all the time
Deluxe Mode
  • LED off -- nothing connected
  • LED on -- something is connected, and it is idle
  • LED pulse -- input active
  • LED repeatedly flashing -- input has a problem and is pulling the line low

Interfacing To Your A/V Components

IR eyeballs usually have a stereo 3.5mm plug with the tip being the +5V supply, the ring being the output signal, and the shield being ground. They are wired up to the circuit like this:

IR Eyeball Jack

IR blaster LEDs usually have a mono 3.5mm plug with the tip accepting a positive voltage and the shield being ground. They are wired up to the circuit like this:

IR Blaster Jack

Some equipment may have jacks that send and receive remote control signals directly so that you can plug a wire into the back of the unit instead of pointing an IR blaster at the front of the unit. Some of the Pioneer equipment has SR jacks that do just that. They are usually in the form of a mono 3.5mm jack. Both inputs and outputs are wired up to the circuit like this:


Wired Remote Control Jack



The All Electronics Mystery Infrared Device

*** NOTE: This is not available anymore from All Electronics. Too bad. ***

This thing is great. For $2, you get an IR receiver with voltage regulator, plus a four-LED IR blaster with some extra transistors to drive them. There are notes on the item's page that indicate what the wires are used for. I bought several of them to play with and found that they were compatible with my system with no modifications. I have one of these in my AV cabinet, and it has enough IR power to flood the room and control every device in it.

All Electronics Mystery Infrared Device
Here's a schematic:

The IR iZ

Who says IR receivers need to be boring? Here's how to embed an IR receiver module in a McDolands iZ toy. Click here.

McDonalds IR iZ

Circuit Board

I built my circuit on a Rapid40i PIC prototype board made by DH MicroSystems, Inc. For under $20, you get the board and all the parts necessary to get your PIC powered up and running. You just supply the PIC and any extra parts you need for your project. I looked at a few different prototyping boards, and this one had the best layout for a good price.

Rapid40i PIC Prototyping Board from dhmicro.com