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


12 comments:

Igor said...

What kind of IR sensor have you used? I've tried your device with the Sharp GP1U52X IR sensor (once was sold in RadioShack) and the results are not reliable at all and only if I to put a remote control 2-3 inch in front of the sensor.

John Sevinsky said...

I replaced all of my sensors with the All Electronics Mystery IR Device. They work great!

I've noticed that if you have a bare IR sensor module, they don't work very well if they are in a bright room. They like to be enclosed in a box with an IR filter in front of them.

Igor said...

That's great. I'm going to order a bunch. Can you, please, clarify the correct pinout of the "mystery" device - the comments there (on the seller's site) are a bit confusing.

John Sevinsky said...

Actually, if you saw it, you wouldn't be confused by the pinout descriptions. After you cut off the connector at the end of the cable, hook the red and/or green to 12V, the yellow and/or blue to ground. The output or the IR receiver is the white wire. The input to the IR blaster is the black wire. DO NOT supply a solid high signal to this line, or you WILL burn up the IR LEDs. The red and green are internally tied together, as are the yellow and blue.

Igor said...

I just got my order and I'm surprised to see an RCA connector on the back of the device. Any idea what is it for? There are 3 leads connecting it to the main board: white, red and a resistor.

John Sevinsky said...

It's a 3.5mm jack that you can plug in an optional IR emitter in case you don't want to use the built-in emitters.

G.Hill said...

John,
very interesting design.
Please forgive the dumb questions but I am an electronics neophyte:
To program the device with the compiled code I assume the 5 pin connector on the board is hooked up to a serial connector on the computer used to upload the code?
If so, what are the pinouts?
If not, what is the hookup?

John Sevinsky said...

No, it does not hook directly to the computer. It hooks up to an in-circuit programming connector on a PIC programmer. There are many of these available. Some attach to a parallel port and are really inexpensive, and others attach to a USB port. Just do a Google search for "pic programmer" and make sure it supports the type of PIC used in the project. I think mine is the PRO40 model. The pins on the PIC prototype board and the programmer are labeled.

Edencircle said...

I've loaded the code into my 16F877A chips and found it works for all my infrared controllers. However for some reasons I have enabled timer0 interrupt for measuring time interval and the repeater was turned working for only some controller. It does not works is for my Philips DVD player. Is there any hints how I can tackle the problem.

G3rard05 said...

I couldn't download the code.

John said...

Bum link for the source code like someone mentioned above.

Reuben Meeks said...

Sirs; is there anyone that has a copy of the 'DIY IR Remote Control Repeater', source code that I can have a copy of? Thanks for any replies....