Here we describe how to control electrical and electronic gadgets from a remote location using radio frequency (RF) transmission. An RF interface is used instead of infrared (IR) to avoid the drawbacks of an IR interface. Besides, RF has a longer range. The signal is transmitted by an RF transmitter and received by an RF receiver to switch on or switch off the desired device. This system can be used to control up to fifteen devices.
Fig. 1 shows the block diagram for RF-based multiple device control using microcontroller. Signals from the keypad are fed to microcontroller AT89C2051, which, in turn, is interfaced to the RF transmitter through encoder HT12E. The microcontroller continuously reads the status of the keys on the keypad.
When any key is pressed, data is passed to the encoder and then to the RF transmitter from where it is transmitted. The RF receiver receives this data and gives it to the RF decoder. The decoder serially converts the serial bit data into four-bit data at a port of microcontroller AT89C51. The microcontroller energises the corresponding relay through a relay driver. Devices are connected to normally-open (N/O) contacts of the relays.
HT12E and HT12D
HT12E and HT12D are CMOS ICs with a working voltage range of 2.4V to 12V. Encoder HT12E has eight address lines and four address/data lines. The data set on these twelve lines (address and address/data lines) is serially transmitted when transmit-enable TE pin (pin 14) is low. The data output appears serially on DOUT pin. Data is transmitted four times in succession.
The frequency of the pulses of data transmission may lie between 1.5 kHz and 7 kHz depending on the resistor value used between oscillator pins 15 and 16.
The internal oscillator frequency of decoder HT12D is 50 times the oscillator frequency of encoder HT12E. The values of timing resistors connected between pins 15 and 16 of HT12E and HT12D, for the given supply voltages, can be determined from the graphs given in the datasheet of the respective chips. The resistor values used in the circuit here are chosen for approximately 3kHz frequency for encoder HT12E and 150 kHz for decoder HT12D at a VDD of 5V.
Decoder HT12D receives data from HT12E on its DIN pin serially. If the transmitted address matches the address of the decoder four times in succession, valid transmission pin (VT) becomes high. The data from pins AD8 through AD11 of the HT12E appears on pins D8 through D11 of the HT12D.
Fig. 2 shows the transmitter circuit with SM TX-433 RF module (TX1). TX1 is an AM/ASK transmitter module operating at 433 MHz. AT89C2051 is a low-voltage, high-performance CMOS 8-bit microcontroller. It has 2 kB of Flash, 128 bytes of RAM, 15 input/output (I/O) lines, two 16-bit timers/counters, a five-vector two-level interrupt architecture, a full-duplex serial port, a precision analogue comparator, on-chip oscillator and clock circuitry.