Gives apx 8-20 ft of wireless control!
You can build these circuits in an afternoon or two. Keywords:
Infrared, wireless, computer interfacing, remote control, MC145026,
MC145027, IR module
Updated 02/27/99 See note about the 32.7 kHz IR module
You can construct your own long range infrared (IR) wireless remote using Motorola's MC145026 emitter and MC145027 detector chips. With your remote you can control devices up to 20 feet (7 meters) away. It operates similiarly to a TV remote. You just point the emitter at the detector, push a transmit button. The detector then interprets your data signal. You can use this circuit to remotely turn on/off devices (like a motors, relays, home appliances):
You can also interface sensors (e.g. temperature, pressure) to the emitter for wirelessly data transfer).
You can also configure your emitter-detector for triggered events. For example, you can place the emitter and detector on opposite sides of a door. The emitter is configured to continously transmits IR light to the detector. When a person walks passed the door, the IR light is blocked. The event can be used to electrically trigger a bell or activate a recorded message. The emitter and detector both use a 9 V battery. You can wirewrap and/or solder the circuits in an afternoon or two with readily available parts from Jameco, Digikey or Newark. What's more exciting is that the circuit can be computer controlled. For example, you can interface the emitter or detector (or both!) to your PC (or a microcontroller like the Basic Stamp, PIC, 8051 etc.). Here are some exciting configurations:
As you can see, there are many exciting possibilities. With this motivation, the tutorial is broken down as follows:
The opening photo shows the emitter-detector pair. They were mounted on plexiglass, but of course, you can custom design your own mounts and enclosures. A combination of soldering and wirewrapping on a Radio Shack breadboard was used. A 9 V battery with a 5 V 7805 regulator and toggle switch was also mounted to give the circuits sturdiness with a clean look. Again you might have your own ideas. Table 1 lists parts needed for the emitter. Table 2 lists parts for the detector. Optional parts are listed. Also, note some of the resistors are not standard. You can either specially purchase them (e.g. Jameco) or just combine resistors in series to add up to the necessary values.
PART DESCRIPTION | VENDOR PART | PRICE (1998) | QTY |
MC145026P (16-PIN) EMITTER | NEWARK #MC145026P | 1.79 | 1 |
74HC132 (14-PIN) NAND | JAMECO #45321 | 0.49 | 1 |
PN2907 PNP TRANSISTOR | JAMECO #28644 | 0.13 | 1 |
BUTTON SWITCH | JAMECO #115086 | 0.25 | 1 |
0.1 uF CAP | JAMECO #15270 | 0.13 | 2 |
0.01 uF CAP | JAMECO #15229 | 0.05 | 1 |
22 pF CAP | JAMECO #15405 | 0.06 | 2 |
5-PIN DIP | JAMECO #109065 | 0.19 | 1 |
4-PIN DIP | JAMECO #139002 | 0.79 | 1 |
T1-3/4 IR LED | JAMECO #106526 | 0.45 | 1 |
T1-3/4 RED LED | JAMECO #34796 | 0.13 | 4 |
T1-3/4 GREEN LED | JAMECO #34761 | 0.13 | 1 |
6-PIN 3.3K SIP RESISTOR | DIGIKEY #Q5332-ND | 0.23 | 1 |
10-PIN 3.3K SIP RESISTOR | DIGIKEY #Q9332-ND | 0.37 | 1 |
32.768 KHZ CRYSTAL (see note below too) | DIGIKEY #SE3201-ND | 0.45 | 1 |
43 K RESISTOR | 1 | ||
91 K RESISTOR | 1 | ||
1 K RESISTOR | 1 | ||
68 RESISTOR | 1 | ||
10 M RESISTOR | 1 | ||
100 K RESISTOR | 1 | ||
OPTIONAL | |||
9 V BATTERY HOLDER | JAMECO #105793 | 0.99 | 1 |
9 V BATTERY STRAP | JAMECO #135221 | 0.12 | 1 |
7805 5V REGULATOR | JAMECO #51262 | 0.39 | 1 |
16-PIN SOCKET | JAMECO #37372 | 0.12 | 1 |
14-PIN SOCKET | JAMECO #337161 | 0.10 | 1 |
SPST toggle switch |
PART DESCRIPTION | VENDOR PART | PRICE (1995) | QUANTITY |
MC145026P (16-PIN) DETECTOR | NEWARK #MC145027P | 2.43 | 1 |
32.7 KHZ IR RECEIVER MODULE | see note below | 3.39 | 1 |
74HC00 (14-PIN) NAND | JAMECO #445161 | 0.23 | 1 |
6-PIN 3.3K SIP RESISTOR | DIGIKEY #Q5332-ND | 0.23 | 1 |
5-PIN DIP | JAMECO #109065 | 0.19 | 1 |
0.1 uF CAP | JAMECO #15270 | 0.13 | 2 |
0.01 uF CAP | JAMECO #15229 | 0.05 | 1 |
T1-3/4 RED LED | JAMECO #34796 | 0.13 | 4 |
T1-3/4 GREEN LED | JAMECO #34761 | 0.13 | 1 |
170 K RESISTOR | 1 | ||
330 K RESISTOR | 1 | ||
OPTIONAL | |||
9 V BATTERY HOLDER | JAMECO #105793 | 0.99 | 1 |
9 V BATTERY STRAP | JAMECO #135221 | 0.12 | 1 |
7805 5V REGULATOR | JAMECO #51262 | 0.39 | 1 |
16-PIN SOCKET | JAMECO #37372 | 0.12 | 1 |
14-PIN SOCKET | JAMECO #337161 | 0.10 | 1 |
SPST toggle switch |
Updated Note (02/27/99): The 32.7 kHz IR module was originally carried by Jameco (part #106382), but was sadly discontinued.
The good news is that they still carry other frequency models. For example, there is the 38.0 kHz model (Jameco Part #131908) and the 37.9 kHz model (Jameco Part #139889). You can use either IR module and buy a matching crystal (Digikey carries them). The schematic is identical.
One unfortunate thing is that I couldn't find all parts from a single source. But the listed suppliers tend to have all items in stock. SIP resistors were used. These are resistors that come in a single package, thus saving breadboarding room. You of course can replace this with conventional 3.3 K resistors. Also, DIP switches were used. They operate like single-pole-single-throw (SPST) switches, and are cheap. You can replace them with SPSTs you want.
Figure 1: Emitter Schematic - download Adobe PDF
file
Figure 2: Detector Schematic - download Adobe PDF
file
There are several things to note. First, the 74132 is a quad NAND gate with a Schmitt trigger. So you only need a single 74132 since ,the emitter circuit uses only two NAND gates. Schmitt triggering is a good idea for signal conditioning. Second, green and red LEDs are used. As will be explained later, the green LED is used as a visual indication that the infrared signal was received. The 4 red LEDs are used to display (in binary) the value of the transmitted signal.
Figure 1 is the emitter wiring schematic. It uses Motorola's MC145026 encoder chip. It encodes 9 bits of information and serially transmits this information whenever TE (Transmit Enable pin 14) goes low. This happens when you hold the pushbutton down. This then pulses the infrared LED at the crystal frequency of 32.768 kHz. The 9-bits are broken down as follows. The first 5-bits (lines A1-A5, pins 1 to 5) represent the address. The next 4-bits (lines D6-D9, pins 6, 7, 9, 10) represent the data. To avoid faulty transmissions, the MC145026 transmits each bit twice.
Because you have 5 address (A1-A5) bits, your emitter has 32 possibly different addresses. The 5-pin DIP switch is used to set an address. The 3.3 K resistors ensure that if a slide-switch on the DIP is closed, then that line associated with that slide-switch will be grounded. On the other hand, if a slide-switch is not closed, then that pin's line will be held high at 5 V. Suppose you wanted to give the emitter an address of 23. 23 in binary is 01111. This means you leave the DIP slide-switches connected to A1, A2, A3 and A4 open, and close the DIP slide-switch associated with A5.
4-bits (D6-D9) means that you can send 16 different numbers (0 to 15). You use the 4-pin DIP switch to configure the number you want to send. For example, suppose you want to transmit a 9. 9 in binary is 1001. Thus you would set D6 and D9 high and D7 and D8 low. You do this by opening the DIP slide-switches connected D6 and D9 and closing the slide-switches connected to D7 and D8.
The Motorola MC145027 in Figure 2 is a decoder chip. It interprets the first 5 of the 9 bits received as an address, and the last 4 bits as data. To receive the transmitted data, Liteon's IR remote control receive module (model LTM-8834-2) is used. This module accepts signals that are pulsed at 32.7 kHz. This is close enough a match for the emitter's crystal frequency of 32.768. The LTM-8834-2 is very robust to noisy signals (like from UV flourescent lamps) and has a good visibility cone. In other words, you don't have to point the emitter exactly at the module. You can be slightly off-angled (-45 to +45 degrees) just like a TV remote control.
This is similar to the Emitter's 5-bit address setting. The detector's address must match the emitter's address. As mentioned before, 5-bits gives you 32 possible addresses. Hence you could use one emitter to control 32 different detector's. You would just give each detector a different address (0 to 31). You would set the DIP switches on the emitter to match the address of the detector you want to control.
The LTM-8834-2 IR module receives the emitter's 9-bit transmission and if the first 5-bits match the address on the detector, then the 4 red LEDs (D6-D9 in Figure 2) will display, in binary, the data it received. The green LED (VT in Figure 2) will also light up. This gives you a visual signal that the detector received a Valid Transmission (VT). Thus in our example, if the emitter's 4-bit data was set to 9 (0101 binary) then the D6 and D8 LED will light up, while D7 and D9 will remain off.
For example you could connect 4 transistors to D6-D9. Then you could connect a motor (or relay) to each transistor. Hence you have on/off control for 4 motors.
You can ground TE (or have the TE pushbutton always held down). This continously transmits the 4-bit data. Suppose you send 15 (1111 binary). Then the 4 red LEDs will always be on. You can hook up a PNP transistor to one of the data lines (say D6). You can add a buzzer to the PNP and block the IR light. For example let someone walk inbetween the IR emitter and detector. Since the IR light cannot reach the detector, the 4 red LEDs should go off. This can trigger the PNP transistor and activate the buzzer. When the person is no longer inbetween the emitter-detector, the buzzer silences.
If you are good with circuits, you can also hook up the 4-bit data to a de-multiplexer, possibly letting you control 16 motors (or relays).
In computer science, 8-bits is called a byte, 4-bits is a nibble. 8-bits gives decimal numbers from 0 to 255. With some programming (and some extra circuitry like flip-flops or latches) you can write a program that instructs a computer-interfaced detector to wait for 2 pulses of the VT line. You set the emitter to send the first 4-bit data number and pulse the (TE) pushbutton. You then set the emitter to transmit another 4-bit data number and pulse it out. Your program can be written to combine the two nibbles into one byte.
If you use a computer-interfaced emitter too (instead of manually setting 4-bit data and pushing the pushbutton), you can wirelessly transmit ASCII data between the two computers.
I used a combination of wirewrapping and soldering. Wirewrapping of certain components will take up less breadboarding area. But I suggest soldering the crystal.
You can see how the entire emitter circuit was mounted on plexiglass. This photo shows the 4 and 5-pin DIP switches used for data and address setting respectively. Also a 9 V battery powers the emitter. Since the chips need +5 V, a 7805 voltage regulator was used. A SPST toggle switch was connected in series with the battery. This cuts off the 9 V battery from the emitter when not in use, thus saving energy.
The above schematic shows how you can use a 9 V
battery and 7805 voltage regulator to provide +5 Volts.
You can build one for the emitter and another one for the
detector.
This other view
shows the IR LED mounting. A small hole was drilled and
the IR LED inserted. Also you can see extra header pins.
This headers were used for computer interfacing. This
will be explained in detail in the Computer Interfacing
section of this tutorial. The pushbutton for TE (Transmission
Enable) can also be seen.
This top view of the
emitter shows the chip placement. Also the 7805 is shown
next to the battery. The 7805 provides the entire circuit
with +5 Volts of power.
Here, the detector
circuit is shown mounted on plexiglass too. The IR module
that receives the IR light is clearly shown. The Green
LED (not clearly shown) was mounted next to the IR module.
This was used for to visually indicate that the detector
received a valid transmission (VT). The detector was also
powered using a 9 V battery and 7805 voltage regulator.
The SPST toggle switch was used similarly.
The 4 Red LEDs were
used to display the 4-bit data received from an emitter
transmission. Again header pins were used and will be
explained in further detail in the Computer Interfacing
section of this tutorial. One can also see the 7805 (mounted
next to the battery) a bit more clearly here.
Hopefully these photos give you an idea of how you can
mount your circuits. One tip is using a wirewrapping
socket to mount your DIP switches on. A 20-pin socket
will work nicely (since a 4-pin and 5-pin DIP switch
mounted next to each other requires 18-pins in total).
Also, you don't have to use a 9 V battery. You can use a
power supply that gives you +5 V. But of course you are
then constrained to keep your emitter-detector wherever
the power supply is!
Once you have finished building both the emitter and detector circuit you can test it out. To begin, I suggest just giving both an address of 0. Thus, pins 1 to 5 on the MC145026 and the MC145027 are all grounded. Set all 4 data bits on the 4-pin DIP switch high (thus pins 6, 7, 8 and 9 should all read +5 V). Next, aim the emitter at the detector and push the pushbutton. The green LED should pulse on and off, and the 4 red LEDs should stay on. You can start flipping on the data switches and see if the 4 red LEDs turn on or off accordingly. You can also play with different address settings.
If you did use a SPST toggle switch, make sure that the circuits are receiving +5 Volts. You can also try turning off any lights (especially flourescent one). Stray light may be a noise source. You should also check to see that both the emitter and detector have the same 5-bit address setting. You might also want to make sure that the crystal is working properly. Pin 6 on the 74132 should be pulsing at 32.768 kHz (or close to this). Another problem is making sure you have the both the IR, green and red LEDs in their correct polorities. Lastly, I would check the 4-pin DIP switch is working well. Pins 6, 7, 9, and 10 on the MC145026 should read either +5 V or almost 0 V as you slide the DIP switches.
The MC145026/27 works great as a manual emitter-detector pair. You can use it to wireless control devices. But computer interfacing really opens up possibilities. It can be any computer like a PC or embedded microcomputers, for example the Basic Stamp, PIC, 8051 and the like. Interfacing the emitter and/or detector to a computer is powerful because the computer can very quickly set or read the 4-bit data and/or 5-bit address settings. Much faster than you can ever try doing manually. For this tutorial, the 8255 PC Interfacing Card was used. This card plugs into your PC's motherboard on an ISA-slot. You can find a separate tutorial on building your own 8255 card on this website. This card is ideal for setting or reading digital lines. Another possiblity is to use a PC's parallel port. The standard parallel port gives you a maximum of 11 digital output lines and 4 digital input lines. Thus you could try interfacing the emitter-detector through the parallel port too. But I have not tried this.
Figure 3: PC interfaced Emitter Schematic
Figure 3 shows Ports A and B wired up to the emitter. The
photos in the Construction Highlights section in this
tutorial showed headers. These header pins allow standard
0.1 inch connectors could be easily attached or removed.
The MC145026's address and data pins were wirewrapped to
a 10-pin header. Then a 10-wire ribbon cable with crimped
connectors was used to tether the 8255's ports A and B to
the emitter circuit. These headers and crimp connectors
are widely available at places like Jameco or Digikey.
This photo shows the
10-wire ribbon cable connecting the PC (via the 8255) to
the emitter's headers. Note you must have a common ground.
That is, you must tie the PC's power supply ground (which
the 8255 card ties into) with the ground on the emitter.
You must also bring the +5 V from the PC to power the
emitter circuit. The 9 V battery is no longer necessary.
The 8255 makes it easy to interface the emitter to the PC
because of the following. The 8255 provides your PC with
24 fully programmable digital lines. The 24 lines are
divided into three 8-bit ports called Ports A, B and C.
The ports can be programmed to be digital output or input
lines. Since you will be assigning address and data lines,
Ports A and B were programmed as output ports.
In this example, the first 5 of Port A's 8 lines were used to set the emitter's address. The first 5 lines of Port B were used to set the 4-bit data and the TE (Transmit Enable) line. You can download the Turbo C file irtx.c used to program the emitter.
To use the computer-interfaced emitter, open all slideswitches on the 5-pin and 4-pin DIP. Once you run the program, you will be asked for the 8255's base address and the emitter's address. I suggest starting with an emitter address of 0. Your detector should also have its 5-pin DIP switch have an address of 0. The program will then continually ask you for the 4-bit data you wish to send. The detector's 4 red LEDs should then give a binary display of your transmitted data.
Figure 4: PC interfaced
Detector Schematic
Figure 4 shows the detector interfaced with the 8255.
With this setup, you can point your handheld emitter, and
your PC can detect your 4-bit transmission. The schematic
shows that Port B was used for the 5-bit address setting
and Port A was used to read the 4-bit data. Again,
similar to the emitter section above, 0.1 inch header
pins were used.
The 10-wire ribbon
cable can be clearly seen tethering the 8255 with the
detector. Again, you must tie all grounds together. The
Turbo C source file irrx.c
can be downloaded. When run, whatever 4-bit transmission
you send will be displayed (in decimal) on your PC as
well as the 4 red LEDs.
The VT (Valid Transmission) line was not used. But you
could use the 8255's Port C as another input port for
reading this signal. The VT signal then can be used as a
way of combining two 4-bit sequential transmissions into
an 8-bit byte. If this is done, then you could transmit
ASCII characters, thus have a crude method for PC-to-PC
communications.
Hopefully this tutorial has motivated your curiosity of wireless control. You can build both the emitter and detector in an afternoon or two using the schematics. The parts are readily available and affordable. What's more, this tutorial introduces how you can interface your PC or other microcontroller for other interesting opportunities.