Author: Carlos Ferreira
Happens 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.
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.
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.
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 Capacitors | Semiconductors | Miscellaneous |
(Elektor Electronics Magazine – 07/2006)
Download this article (#050233-uk.pdf) 050233-11.zip >> or direct link. |
Labels
- * Elektor 2005 (9)
- * Elektor 2006 (72)
- Adapters (1)
- ADC / DAC (1)
- AM / FM (2)
- Amplifiers (3)
- Antennae (2)
- Articles List (1)
- Audio (1)
- Automatic (2)
- Batteries (3)
- Bluetooth (1)
- Breakers / Contacts (1)
- Buzzers / Sirens (1)
- Clocks / Timers (2)
- Computer (2)
- Converters (2)
- Coolers / Fans (1)
- Counters (1)
- Datasheets (7)
- E-blocks (1)
- Energy (2)
- Flash / Light (8)
- Frequency (1)
- Fuse (1)
- Generators (2)
- High-voltage (1)
- Indicators (2)
- Infrared (IR) (4)
- LCDs (1)
- LEDs (7)
- Magazines (1)
- Meters (5)
- Microcontroller (9)
- Mobile Phone (1)
- Motors (1)
- OPAMP (3)
- PCB (1)
- Photosensors (1)
- Power Supply (2)
- Preamplifiers (1)
- Programming (3)
- Radio (1)
- Rectifiers (1)
- Regulators (1)
- Relays / Switches (10)
- Remote Control (7)
- RS232 (3)
- Security (4)
- Sensors (2)
- Servo (2)
- Simulators (1)
- Small Circuits (46)
- Telephones (2)
- TENS (1)
- Testers (3)
- Timebase (1)
- Tools (1)
- Transmitters (1)
- Trigger (1)
- USB (2)
0 comments: