Ceska verze

Simple 4-channel ON-OFF remote control

    Introduction:
This device is good for switching on and off up to 4 independent appliances by remote control. Pressing buttons 1, 2, 3 or 4 turns the corresponding output on, pressing it again turns it off. The remote control operates on the infrared principle, with a range of up to 50m. If you need to output to remain active only as long as the button is held, this is what you seek: Command remote control. If you need more channels, you may seek: 16-channel ON-OFF remote control. You may also like RF remote control with 4 channels.
    Transfer Method:
Carrier frequency if the remote control is from 36 to 38 kHz. Signals are transmitted by pulse distance coding, PDC. It has an advantage over pulse width coding (PWC) in the lower power consumption of transmitter. Waveforms are shown in Figure 3. Long gap (2048 CPU cycles) between pulses is log1, short gap (512 cycles) is log0. Individual samples are separated by an ultralong space (8192 CPU cycles). The pulse (burst) length is always 512 CPU cycles and is formed by a 16 impulses of carrier frequency. The long start bit is omitted. The code consists of two data bits (sufficient to encode 4 buttons) and two check bits. The check bits are logical inverted data bits. They are used to verify the proper transmission. With inverted check bits the length of the sample is constant. The difference between short and long gap and between a long and ultralong gap is always 4x, so that the transmission system is resistant to a wide divergences of clock speeds of transmitter and receiver. It allows operation with the internal RC oscillators in both transmitter and receiver, and it is not necessary to use crystals.
    Transmitter (Remote controller):
Remote control transmitter is controlled by the Atmel AVR microprocessor IO1 - ATTiny13A (ATTiny13V), running at a frequency of 1.2 MHz from internal RC oscillator. Commands are transmitted via infrared radiation emitted by the IR LED with a wavelength of 940nm. TSAL6100, TSAL6200, TSAL5100 or TSAL5300 can be used. They are in 5 mm classical case, max. continuous current is 100mA. When pressing a button, the transmitter sends the corresponding code. The program ensures that transmission always ends up posting the entire sample regardless of when the button was released (transmission never ends during the sample). It also ensures that every time you press button it sends at least 6 samples. Pulse current of the transmitting LED1 is set to about 400 to 500 mA. The current is stabilized by circuit with T1, T2, R1, R2, so it does not decline significantly due to battery voltage decline. The current is determined by resistor R1. Carrier frequency has a duty cycle around 34% (exactly 11/32). The total duty cycle of modulated signal is only about 5.5%, so a high pulse current can be used and obtain a reasonable range. It is necessary to pay attention not to exceed the maximum current for the selected LED. Transmitting frequency is approximately 37.5 kHz (CPU frequency / 32). The transmitter is powered from a 3V supply, eg. two AA or AAA cells, or other 3V battery. Consumption during transmission is about 20 to 30 mA. When no button pressed, IO1 enters Power Down mode and the transmitter consumption is under 1uA (current much smaller than battery self-discharge, thus completely negligible). Situate C2 as close as possible to IO1.
    Receiver:
The remote control receiver is controlled by IO2, also type ATtiny13A (ATTiny13V, ATtiny13), also clocked 1,2 MHz from internal RC oscillator. As the sensor of IR signal IO3 integrated infrared receiver is used. Receivers can be used for frequencies from 36 to 38 kHz (the band-pass filter is relatively wide), eg TSOP1736, TSOP4836, TSOP31236, SFH5110-36, OSRB38C9BA, OSRB38C9AA, TSOP4838, or TSOP34838 SFH5110-38. Integrated receiver receives, amplifies and demodulates infrared signal. It has a built-in automatic gain control (AGC), suppression of ambient light, band-pass filter, demodulator and shaping circuit with TTL output. All the above have a maximum sensitivity at 940-950 nm. Transmitting LED must correspond to this. Frequently occurring types od LEDs such as 850nm are unsuitable! I found the OSRB38C9BA receiver to be the best. It has better sensitivity in comparison with tested and TSOP1736 SFH5110-38. The receiver output is decoded in microprocessor IO2. When it receives the same sample 3 times and the check bits are consistent, it flips the corresponding output. After power is applied, the default state of all outputs is log0 (off). The outputs of the receiving circuit are connected power switches, such as relay according to Figure 2. If you want to use all the channels, build the power switching circuit 4 times. Use the relay contacts dimensioned to the required voltage and current. The relay coil may be 5V, then it can run from the same supply as the receiver. If the coils need higher voltages, such as 12V or 24V, relay is powered from the the corresponding voltage supply. From a higher voltage, 5V can be obtained, eg, by using integrated circuit 7805 or 78L05. When receiver has all outputs at log0 or unloaded, the power consumption is determined mostly by IO3. According to its type it is usually about 0.5 - 5 mA. IO2 itself draws about 25uA when no output current. In the ON state the current consumption is determined mainly by the consumption of relay coils. The relay coil should draw 500mA max., otherwise it is necessary to use another type of transistor for T3 and maybe different value of R4. You can also use N-MOSFETs. Typical pinout of IO3 is shown in Figure 1, but for your specific type I recommend you to refer to the datasheet. Situate C4 as close as possible to IO2.
    Range:
Range depends mainly on the type and current of the LED1 and IO3. Transmitting IR LEDs mainly differs in their total radiant flux (measured in mW), radiance (measured in mW / sr) and transmission angle. Also the maximum LED current is important. It should be also noted that the radiant flux and radiance of various LED datasheet can be measured at different currents! The maximum range when well directioned is determined by the radiance. LEDs with the same radiant flux, but smaller angle, tend to have the greater radiance. The LED with a small angle however is more critical to the direction of transmitter. At smaller distances, the signal is transmitted even by reflections from objects and therefore it does not matter too much on its direction. If the transmitter is not directed, the radiant flux is the most important for the range. I chose as IR receiver OSRB38C9BA. As transmitting LED I tested four types and measured the range at the zero angle (tested with receiver OSRB38C9BA):

Typ IR LED Angle radiance (100mA) radiant flux (100mA) measured range
TSAL6100 20° 130 mW/sr 35 mW 50m
TSAL5100 20° 130 mW/sr 35 mW 47m
TSAL6200 34° 60 mW/sr 35 mW 31m
TSAL5300 44° 45 mW/sr 35 mW 32m

The largest range can be obtained with diodes TSAL6100 and TSAL5100. Diodes TSAL6200 and TSAL5300 are on the other hand less critical to direction.

     Warning! If the device switches mains voltage or other hazardous voltages, it should be treated accordingly. When bad construction this equipment may have dangerous voltages in all its parts. All you're doing, you do at your own risk and your own responsibility.

The program for free download:
Transmitter source code in assembler (ASM)
Receiver source code in assembler (ASM)
Compiled Transmitter HEX file (206 Bytes)
Compiled Receiver HEX file (222 Bytes)
How to write the program into the AVR is described here.

I can send you the programmed microcontrollers. For more info click here.


Figure 1 - Schematic of the simple 4-channel ON-OFF remote control with ATtiny13(A)(V).


Figure 2 - Schematic of the relay power swith. Build it 4 times when using all 4 channels.


Figure 3. - IR transmitter signal waveforms.


Transmitter configuration and security bits setting.
(Hexadecimal values are Low Fuse: 6A, High Fuse: FF.)


Receiver configuration and security bits setting.
(Hexadecimal values are Low Fuse: 6A, High Fuse: FD.)


Remote control transmitter in breadboard.


Testing the IR remote control receiver in breadboard with LEDs on its outputs.


IR LEDs: TSAL6100, TSAL5100, TSAL5300, TSAL6200. Dia: 5mm, 100mA continuous, repetitive pulse ut to 1A.


TSAL5300, TSAL6200.


TSOP1736, SFH5110-38, OSRB38C9BA.


The 4x AA box the transmitter will be built into.


The space from another two AA batteries was used for the trnasmitter PCB board.


The box and the cover with holes drilled for the buttons.


Completed remote controlled.


Video - testing the simple IR 4-channel ON-OFF remote control



Added: 17. 9. 2012
home