Where would we be without our infrared remote controls? Stuck
back in the dinosaur era, that's where. IR remote controls are now built into
lots of appliances, ranging from TV sets and VCRs to audio equipment, robots and
lights.
This relatively simple design makes it easy for you to add
infrared remote control to your latest project or to existing equipment. What's
more, it can control up to 10 different functions, which should be more than
enough for most applications (usually, you'll only need one or two channels).
Each output uses an open-collector transistor and this can be used to switch a
relay or even to directly switch other 12V equipment.
The outputs can also be used to drive LEDs via current limiting
resistors or to drive optocouplers (eg, to provide isolation from high-voltage
circuitry). Heavy current items such as motors and light bulbs will have to be
driven by relays. We've made the job easy for you by including diagrams that
show all the various options - see Figs.5(a)-5(d).
MAIN FEATURES
- Uses a commercial handheld IR remote
- 10 separate outputs
- Outputs can be independently set for momentary or toggle operation
- Acknowledge LED
- LED indicator on each channel
- Transistor output for relay connection
- Operates on two different remote codes
- 12V DC operation
|
Commercial remote
As already indicated, the 10-channel remote receiver is
operated using a commercial handheld remote which can also be used to control
your TV, VCR or satellite receiver. Using a commercial IR transmitter vastly
simplifies the construction and you also get a professional looking controller
as well.
Operation is simple - just press one of the 0-9 buttons on the
transmitter to control the 0-9 outputs on the receiver. A momentary output stays
on for as long as its transmitter button is held down, while a toggle output
alternates between ON and OFF
on each subsequent press of the button. An acknowledge LED flashes whenever an
IR signal is being received, while 10 more LEDs are used to indicate the status
of the outputs.
There, we told you it was simple to operate!
All the parts for the circuit are mounted on a small PC board
and this can either be housed in a separate plastic box or built right into
existing equipment. The operational range is up to about 12
metres.
Circuit details
As shown, it's based on a preprogrammed PIC16F84
microcontroller (IC1). What? - you don't like microcontrollers? Awwww - c'mon;
it's a beautiful microcontroller and it greatly simplifies the circuit design
because all the hard work is done by the software that's programmed into the
device.
Fig.1:
IC2 is the infrared receiver - it picks up the pulses from the
transmitter and applies a demodulated signal to pin 2 of PIC
microcontroller IC1. IC1 decodes the signal on its pin 2 input and
switches the appropriate output.
You don't have to worry about any of this, of course, because
you just buy the preprogrammed device and "plug" it in - just like any other
IC.
Apart from the PIC, there's just one other IC, a 3-terminal
regulator (REG1), 10-transistors (Q1-Q10), 11 diodes, a crystal and a few
resistors and capacitors. Let's see how it all works.
IC2 is an infrared receiver which amplifies, filters and
demodulates the code supplied by the transmitter. The top trace in Fig.3 shows
the modulated signal from the hand-held transmitter, while the lower trace is
the demodulated signal at the output of IC2. The modulation is at about 36kHz
and represents a high level (low levels are represented by no modulation).
Note that the output of IC2 is inverted compared to the
transmitted code.
The remote control coding that we are using is called the
"Philips RC5" code. It comprises 14-bits of information, including two start
bits, a toggle bit, five address bits and six command bits.
The two start bits are transmitted first (makes sense, doesn't
it?), followed by the toggle bit. This toggle bit changes each time the same
button is pressed on the transmitter. If the button is simply held down, the
transmission repeats at 113.778ms intervals and the toggle bit remains either
high or low. The state of the toggle bit allows the receiver to distinguish
between whether a button is being held down continuously or has been pressed
more than once.
Fig.2:
the modulating waveform - this operates at about 36kHz and is the
frequency at which the infrared transmitting LED in the remote is
switched on and off
The address bits are for selecting the type of equipment to be
used. For example, address 0 (00000) is for a TV set. Address 1 (00001) is for
TV2 or a second TV set. The two addresses we are using are for Satellite 1 and 2
at addresses 8 (01000) and 10 (01010).
The last six bits are the commands and we are using buttons 0,
1, 2, 3, 4, 5, 6, 7, 8 & 9, which have codes 0 (000000), 1 (000001), 2
(000010), 3 (000011), 4 (000100), 5 (000101), 6 (001100), 7 (000111), 8 (001000)
and 9 (001001). These codes are transmitted in "bi-phase" format, where a low is
a high level falling to a low, while a high is a low rising to a high.
IC1 (the PIC microcontroller) is used to decode the demodulated
signal from IC2. It does everything from the remote control decoding to driving
the outputs. It also does away with the need for a specialised IC and can be
programmed to operate with existing commercial remote controls.
In operation, IC1 monitors its pin 2 input for a remote control
signal. When a signal arrives, it detects the start bits and then monitors the
demodulated signal at regular intervals to provide the code sequence.
The timing is controlled by dividing down the signal from a
4MHz crystal (X1) to obtain 1.8ms intervals - this is the spacing between each
bit in the remote control sequence. The decoded signal appears at pin 1 of IC1
and is used to drive the Acknowledge LED (LED11) via a 220Ω resistor.
Fig.3:
the top waveform (channel 1) is the signal applied to IC2 before
demodulation, while channel 2 shows the output of IC2 after the 36kHz
signal has been removed.
IC1 can be forced to display its remote control status by
connecting pin 1 to the 5V supply (TP2) via a 220Ω test resistor at power up. This will
set pins 18 & 17 to provide a tracer signal and a stop and start level for
the code respectively.
The tracer shows when the code level is monitored for each of
the 14 bits in the code. When in this mode, the 0 and 1 outputs are prevented
from operating normally. Normal operation is restored by switching off the
supply for a few seconds, removing the 220W test resistor and reapplying power.
The accompanying oscilloscope traces show the remote control
operation. Fig.2 shows the modulating waveform - this operates at about 36kHz
and is the frequency at which the infrared transmitting LED is switched on and
off. The presence of 36kHz modulation gives a high signal level, whereas no
modulation represents a low signal.
Fig.3 shows the remote control signals. The top waveform
(channel 1) is the signal applied to the infrared detector (IC2) before
demodulation. This is a modulated waveform with the 36kHz signal appearing when
the signal goes high.
The next waveform down (channel 2) shows the output of IC2
after the 36kHz signal has been removed. Note that this signal is actually
inverted compared to the top waveform. The tracer (pin 18 of IC1) is the channel
3 signal and this indicates when the level at IC2's output (pin 1) is monitored
by IC1.
Fig.4:
the top waveform here (channel 1) shows the stop/start signal on pin 17
of IC1. The bottom three waveforms (channels 2-4) are the same as in
Fig.3.
The resulting decoded output (which is the satellite-1 code for
transmit button 4) is shown in channel 4 (ie, the bottom waveform). This decoded
signal is made available at TP1 and, as discussed above, drives the Acknowledge
LED.
Fig.4 shows a similar set of traces. However, in this case, the
top waveform (channel 1) shows the stop/start signal on pin 17 of IC1. The
bottom three waveforms (channels 2-4) are the same as in Fig.3.
The decoded signal is compared with those stored in IC1's
memory - ie, the 0-9 button codes for satellite 1 (sat1) or satellite 2 (sat2).
The voltage level at pin 3 determines whether a comparison is made against the
sat1 or sat2 codes - sat1 codes are used if pin 3 is high, while sat2 codes are
used if pin 3 is low.
When the transmitted code matches a satellite code in memory,
the respective output of IC1 goes high. For example, if we press button 0 on the
transmitter, pin 18 of IC1 will go high if the output is set for momentary
operation. Alternatively, it will change from a low to a high or from a high to
a low if set for toggle operation.
A momentary output will go low as soon as the button is
released. By contrast, a toggle output will remain in its new state (high or
low) until the button is pressed again.
IR CODE OPTIONS
LINK LK1 OUT: | SAT(CODE 424) |
LINK LK1 IN: | SAT(CODE 425) |
|
Remote trickery
One problem with using the commercial IR transmitter is that
the codes are not actually generated by the internal circuitry. Instead, they
are stored replicas of the codes programmed into the original equipment remote
controls that come with TVs and VCRs, etc. These codes are stored in a memory
that allows each code sequence to be continuously replayed over a few seconds.
When the end of the memory is reached, the sequence in memory is started over
again.
Fig.5(a): driving a LED output.
Fig.5(b): driving an optocoupler.
Because it would be rare for a code sequence to finish exactly
at the end of the memory and start again at the beginning (and with the correct
timing between them), there is often a disjointed flow of code. This presents a
problem because it is recognised by the receiver as a different code.
We circumvented that problem by monitoring the toggle bit in
the remote control sequence. Remember that this toggle bit only changes state if
the button is released and then pressed again. If the button is held down
continuously, this bit will not change except at the "end of memory"
discontinuity.
So, by programming the PIC to ignore very brief code changes
(as indicated by very brief changes to the toggle bit), we can easily "filter"
out this discontinuity. As a result, the remote control receiver only responds
to genuine inputs to the transmitter.
This means that the outputs remain in the correct state if a
button on the transmitter is held down.
By the way, the user is entirely unaware of this filtering and
there is no detectable delay. Press a button on the remote transmitter and the
receiver responds "instantly".
Momentary or toggle operation is set using a programming
resistor on each output (R1-R10). Each resistor can be connected to either the
+5V rail for a toggle output or to 0V for momentary operation.
Fig.5(c): driving a relay.
Fig.5(a): using two outputs to drive a motor in forward & reverse.
When power is first applied to the circuit, pins 18, 17, 13,
12, 11, 10, 9, 8, 7 & 6 of IC1 are all set as inputs. The microcontroller
then checks the voltages applied to these inputs, as set by R1-R10.
If a resistor is connected to the 0V rail, its corresponding
input will be read as low for momentary operation. Conversely, if the resistor
is connected to the +5V supply rail, the voltage at the input will be about
2.69V. That's because the current flows through the 1.8kΩ resistor, a LED (LED1-LED10) and the
associated 390Ω
and 300Ω resistors.
The voltage across the LED will be about 1.8V, so the resulting
current will be (5 - 1.8)/(390Ω + 300Ω +1.8kΩ) or 1.285mA. This means that 2.31V appears across the
1.8kΩ resistor
and so the input will be at 5 - 2.31 = 2.69V with respect to the 0V rail. Since
a high voltage level only needs to be 2.4V or more, the input will be detected
as a high and this selects the toggle mode.
The
circuit works with most preprogrammed IR remote controls - eg, the "Big
Shot 3" from Jaycar (Cat. AR-1710) and the "8-In-One" from Altronics
(Cat.A-1007).
Note that although the current through the 1.8kΩ resistor is
sufficient to light the LED, there is insufficient voltage across the
300Ω resistor (about 0.39V) to turn the output transistor on. This
prevents the output from momentarily switching on any external devices
during power up.
Following power up, the inputs are turned into outputs and
drive output transistors Q1-Q10 via LEDs1-10 and 390Ω base resistors. The current through the
LEDs is about 6.4mA and each transistor can deliver about 120mA of current. This
is sufficient for driving LEDs and 12V relays with more than 100Ω coil resistance.
Note that LEDs1-10 light when ever their respective output
transistors are switched on via the remote control. This means that the LEDs on
the momentary outputs will light only while their transmitter buttons are
pressed, while the LEDs on the toggle outputs will toggle on or off.
Diodes D1-D10 are necessary to protect the output
transistors. They quench the inductive spike voltages that can be generated by
relay switching.
Power for the circuit is derived from a 12VDC plugpack. Diode
D11 protects against reverse polarity connection and the 1000μF capacitor filters the
supply. The +12V rail is then used to supply any output loads for transistors
Q1-Q10.
The +12V rail is also fed to 3-terminal regulator REG1 to
derive a +5V supply. This rail is filtered using a 10μF electrolytic capacitor and supplies
IC1 & IC2. Note that IC2 is decoupled from the +5V rail via a
100Ω resistor
and 10μF
capacitor to filter out any noise on the supply.
Table 1: Resistor Colour Codes
No. |
Value |
4-Band Code (1%) |
5-Band Code (1%) |
1 |
100kΩ |
brown black yellow brown |
brown black black orange brown |
1 |
10kΩ |
brown black orange brown |
brown black black red brown |
10 |
1.8kΩ |
brown grey red brown |
brown grey black brown brown |
1 |
1kΩ |
brown black red brown |
brown black black brown brown |
10 |
390Ω |
orange white brown brown |
orange white black black brown |
10 |
300Ω |
orange brown brown brown |
orange brown black black brown |
2 |
220Ω |
red red brown brown |
red red black black brown |
1 |
100Ω |
brown black brown brown |
brown black black black brown |
|
Building it
A PC board coded 15102021 and measuring 88 x 130mm accommodates
all the parts. Fig.6 shows the assembly details.
Fig.6:
install the parts on the PC board as shown here, noting that the LEDs
and the IR receiver (IC2) are mounted on the copper side (see photos).
The 1.8kΩ resistors set the individual outputs to toggle (T) or
momentary (M) operation, depending on how they are installed - see text.
Before installing any parts, carefully inspect the PC board for
shorts or breaks in the copper tracks. Check also that the hole sizes are large
enough for the components, especially for the screw terminals.
Begin the assembly by installing the wire link near LED4 but
don't install link LK1. Next, install the resistors in the locations shown. The
1.8kΩ resistors
set the outputs to toggle or momentary operation, depending on how they are
installed. For toggle operation, connect the resistor lead to the "T" hole.
Alternatively, for momentary operation, connect the resistor to the "M"
hole.
Table 1 shows the resistor colour codes but it's also a good
idea to check them using a digital multimeter - some of the colours can be quite
difficult to recognise.
The diodes can go in next, making sure they are all oriented
correctly. This done, install a socket for IC1 with pin 1 located as shown on
Fig.6.
Similarly, take care to ensure that the electrolytics are
oriented correctly when installing the capacitors. Once these are in, install
transistors Q1-Q10, followed by the screw terminal blocks (wire entry side
facing outwards).
Regulator REG1 is mounted flat against the PC board, along with
a small heatsink - see Fig.6. You will need to bend the regulator's leads
through 90° so that they pass through their respective holes in the PC board.
This done, the regulator and its heatsink are fastened to the board using a
6mm-long M3 screw and nut and the leads are then soldered.
This
view shows the completed prototype, mounted on the lid of a plastic
utility case. Note that the LEDs and the infrared receiver (IC2) are
installed on the copper side of the board.
The next step is to install crystal X1, the DC socket and two
PC stakes at the TP1 and TP2 positions. That done, you can complete the board
assembly by installing the LEDs (LEDs1-11) and IC2 (the infrared receiver).
The LEDs can either be installed on the top of the PC board or
on the underside (ie, the copper side), depending on how the assembly is going
to be mounted. For the prototype, we installed the LEDs on the copper side -
this allowed the completed assembly to be mounted on the lid of a standard
plastic case, with the LEDs protruding through the front panel.
Similarly, IC2 is also mounted on the copper side of the board.
Its leads are then bent through 90° so that the receiving lens aligns with a
hole in the front panel next to the Acknowledge LED.
Make sure that the LEDs are correctly oriented when installing
them on the PC board. They should be installed with their tops about 14mm above
the board surface, while IC2 should be mounted with its lens bezel about 13mm
above the board surface.
There's an easy way to mount the LEDs and that's to cut a strip
of cardboard exactly 6mm wide, then use this as a "spacer" between the LED and
the board. The accompanying photo shows the idea.
About Remote Controls
This 10-Channel Remote Receiver should work with just about any
preprogrammed IR remote transmitter that can control a satellite
receiver. It's just a matter of programming it to control a Philips
satellite receiver (ie, RC5 code) by following the instruction manual. |
Drilling the front panel
Fig.7 shows the front panel artwork - this can be used as a
template for drilling the front panel. You will need to drill 11 holes for the
LEDs, plus four more to mount the board. In addition, you will have to make a 6
x 6mm cutout for the infrared receiver (IC2) - you can do this by drilling a
hole and then filing it to shape.
Fig.7:
here are the full-size artworks for the front panel and the PC board.
Check your etched board for defects by comparing it against the above
pattern before installing any of the parts.
A hole is also required in the side of the box, to allow access
to the DC socket. Once the holes have been drilled, the PC board can be mounted
on four 10mm-long tapped spacers and secured using countersunk machine screws
through the lid and cheesehead machine screws through the PC board.
Testing
Before testing, you have to set the infrared transmitter to
code 424. To do this, first press both the SET and SAT switches together - the
transmit LED should light. Now enter 424 by pressing the 4, 2 and 4 buttons. The
transmit LED will now go out and the remote control codes are now set correctly
for the receiver.
Now apply power and check that there is 5V between pins 5 &
4 of IC1's socket. If this is correct, disconnect the power, install IC1 and
apply power again. Now press each of the number buttons on the remote control in
turn. The receiver should now light the LED associated with the button pressed
(ie, if 0 is pressed, LED0 should light).
The LEDs are installed on the copper side of the board using a 6mm strip of cardboard as a spacer.
The behaviour of each LED indicates whether its corresponding
output has been wired for momentary or toggle operation.
If you wish, you can now check the operation of the optional
second code by installing link LK1. The transmitter will now have to be
programmed to code 425 instead of code 424.
Note also that the transmitter can be programmed with the code
number placed in any of the SAT, VCR or TV options. This means that if you build
two receivers, they can both be controlled using the same transmitter.
All you have to do is set code 424 for (say) the SAT button and
code 425 for the VCR button - in the latter case, you press SET and VCR
simultaneously and then press 425. Note that the second remote receiver must
have LK1 installed, while the first receiver should have LK1 omitted.
To control the first receiver, you simply press SAT and then
one of the 0-9 number buttons. To control the second receiver, press VCR and
then one of the 0-9 buttons.
Remote Control RC5 Codes
A standard RC5 control code consists of 14 bits (0-13). The first
two are start bits, then comes a toggle bit, followed by five address
bits and six keycode or command bits. The bits are separated by 1.778ms
and the code repeats every 113.778ms. The scheme is as follows:
- Start bits (bits 12 and 13) - both high (1 and 1)
- Toggle bit (bit 11) - high or low (0 or 1)
- SAT1 address - 8 (bits 6-10) 01000
- SAT2 address - 10 (bits 6-10) 01010
- keycode 0 (bits 0-5) - 000000
- keycode 1 - 000001
- keycode 2 - 000010
- keycode 4 - 000100
- keycode 5 - 000101
- keycode 6 - 000110
- keycode 7 - 000111
- keycode 8 - 001000
- keycode 9 - 001001
|
Output control
The
LEDs and the infrared receiver (IC2) are installed on the copper side
of the PC board and protrude through matching holes in the front panel
of the case (ie, the lid). Make sure that all these parts are correctly
oriented.
As mentioned earlier, Fig.5 shows how to connect the outputs to
perform various functions. Fig.5(a) shows how to drive a LED; Fig5(b) shows how
the LED in an optocoupler can be driven, with the transistor output providing an
isolated switch; Fig.5(c) shows how to drive a relay; and Fig.5(d) shows how to
drive a motor via two relays, to provide for forward and reverse control (note:
you must use two outputs from the receiver for this, one driving RLY1 and the
other driving RLY2).
The NO and NC contact designations refer to whether they are
normally open (NO) or normally closed (NC) when the relay coil is not energised.
The common terminal (or wiper) is referred to as "C". Power for the motor can be
from the 12V supply if they are 12V motors. Lower voltage motors will require a
separate supply.
Power supply
Power for the unit comes from a 12VDC plugpack. This must be
rated to cater for the loads that will be connected to the 12V supply rail, so
you need to add up the likely current drawn by the loads. Typically, you will
require a 500mA 12V plugpack when there are no small motors connected and a 12V
1A type when a motor is connected or if all 10 outputs are driving relays.
Parts List
1 PC board, code 15102021, 88 x 130mm |
1 plastic case, 157 x 95 x 53mm |
1 front panel label, 92 x 154mm |
1 12VDC plugpack (power rating to suit application; see text) |
1 preprogrammed remote control (eg, Jaycar 'Big Shot 3' Cat. AR-1710; Altronics 8-In-One Cat. A-1007; or equiv.) |
1 20-way screw PC terminal block, 5.08mm pitch (10 x Jaycar HM-3130 or equiv.) |
1 18-pin DIL socket |
1 4MHz parallel resonant crystal (X1) |
1 19 x 19 x 10mm TO-220 heatsink |
1 PC-mount 2.5mm DC socket |
4 10mm long M3 tapped spacers |
4 M3 x 6mm countersunk screws |
4 M3 x 6mm cheeshead screws |
1 M3 x 6mm screw |
1 M3 nut |
1 30mm length of 0.8mm tinned copper wire |
2 PC stakes |
Semiconductors |
1 PIC16F84P microcontroller programmed with 10-rmote.hex (IC1) |
1 infrared remote control receiver (Jaycar ZD-1952 or equiv.) (IC2) |
1 7805 3-terminal 5V regulator (REG1) |
10 BC338 NPN transistors
(Q1-Q10) |
11 1N4004 diodes (D1-D11) |
11 5mm red LEDs (LEDs1-11) |
Capacitors |
1 1000μF 25VW PC electrolytic |
3 10μF 16VW PC electrolytic |
1 0.1μF MKT polyester (code 104 or 100n) |
2 22pF ceramic (code 22p or 22) |
Resistors (1%, 0.25W) |
1 100kΩ 10 390Ω |
1 10kΩ 10 300Ω |
10 1.8kΩ 2 220Ω (1 for testing) |
1 1kΩ 1 100Ω |
|
WHERE TO GET THE SOURCE CODE
For those interested in programming their own microcontroller, the
source code (10-rmote.hex contained in the 10 channel remote software
zip file) can be downloaded from the list below.
|