Subscribe

Easy Home Remote Control

Posted by Circuit Labs on Friday, November 14, 2008

Author: Carlos Ferreira

050233ukHappens to everyone! You’re comfortably installed on your sofa watching TV and then all of a sudden you need to get up to turn the lights on or off, or to draw the curtains. Many living rooms these days have a double head-up ceiling light, a floor lamp and an electric window/curtain control. The idea is to control all these devices, and more, with the TV remote control.

The circuit designed for maximum indolence in front of the telly is built around the PIC16F84. The ‘F84 was chosen mainly because of its internal EEPROM, which is necessary to store the user-programmable infrared codes. To control such devices as mentioned above, four relays are used, working together with lamp switches in a two way configuration.

Looking at the circuit, the DIP switch block and the associated resistor array connected to microcontroller port A are used to program the IR codes and to select the operation mode for all the outputs (described further on). The IR sensor is connected to port line RB7 on the PIC. The lower nibble (set of 4 bits) of port B is used to control the output relays via 1-k resistors and BC547 transistors. It is also used to control multifunction indicator LED D1 on port line RB6.

Components C1, C2 and X1 generate the microcontroller clock signal while C3 helps to keep the supply voltage as clean as possible.

The circuit should be powered by a 5-V regulated supply capable of providing enough current for the four relay coils (approximately 140 mA per relay) plus a few mA for microcontroller, IR sensor and LED.

Circuit diagram

The circuit is designed to respond to infrared commands coded to the Philips RC5 protocol. The protocol consists in a frame of 14 bits. The first two bits, always at ‘1’, are used to start the frame. The third bit is the flip bit, this bit indicates when a key is pressed repeatedly. The next five bits are used to identify de system which the message is sent. The last six bits represent the sent command. Note that in RC5 speak a logic ‘1’ is a transition from 0 V to Vcc, and logic ‘0’ is a transition from Vcc to 0 V, where the period of one bit is 1.7778 ms. Many
articles on RC5 have appeared in this magazine.

The software developed for the project is stored in the PIC microcontroller. It allows four different RC5 codes to be saved and used to control the four outputs. For example, your TV remote may be able to control five systems: TV (default), VCR, DVD, AMP, SAT. If, for example, you do not have VCR then the relevant IR codes are available for Easy Home Control. If your remote control is not compatible with RC5 codes, you can buy a cheap universal remote control to do the job. To avoid the relays changing state owing to a power cut in your home, the state of the relays is saved in the microcontroller EEPROM and retrieved every time the PIC re-initialises.

050233uk[5]

The actuation of electric curtains differs from lamps as it’s necessary to send a short pulse to the relays. To make the home control more versatile it is possible to control all relays (configurable by the DIP switches) in one of two modes:

toggle between ON and OFF positions with memory for lamps;
• output pulse for other devices like electric windows-curtains.

If you’re a keen energy saver, it is also possible to program an IR code to turn off all the relays (and save 5 V·140 mA = 0.7 watts per relay).

The Easy Home Remote Control is configured as follows.

1. Switch the circuit on with all DIP switches set to OFF.
2. Flip ON switch #5 (switch connected to RA4/TOCK1) to enable programming mode. Using Table 1, set the other switches as required to save desired IR codes in EEPROM.
3. Flip OFF switch #5 to select working mode. Using Table 2, configure the other switches to select the desired relay mode.

050233uk[7]

Warning!In working mode a fast-blinking LED (D1) means reception of IR codes with no associated  function; 1-second blink means programmed IR code was received and corresponding action was performed. In programming mode, the 1- second blink means the IR code was saved in the microcontroller EEPROM. The assembly code file for the PIC used in this project is available as a free download from the Elektor Electronics website.

File number 050233-11.zip may be found by clicking on Magazine → 2006 → July/August. The PIC is also available ready-programmed from the Publishers as order code 050233-41.

COMPONENTS LIST

Resistors
R1= 5-way 10kΩ SIL array
R2-R6 = 1kΩ

Capacitors
C1,C2 = 22pF
C3 = 100nF

Semiconductors
D1= LED, low current
D2-D5 = 1N4148
IC2 = IR receiver module, e.g.,
TSOP1836, SFH5110 or TK1833
T1-T4 = BC547

Miscellaneous
X1 = 4MHz quartz crystal
IC1 = PIC16F84, programmed, order code 050233-41 (see Elektor SHOP pages or website)
PCB, ref. 050233-1 from The PCB Shop
Re1-Re4 = PCB mount relay, 5V coil, 140mA

 (Elektor Electronics Magazine – 07/2006)


Download this article (#050233-uk.pdf)
 050233-11.zip >> or direct link.

0 comments:

Subscribe to: Post Comments (Atom)