Remotely Programmable RTC-Interfaced Microcontroller for Multiple Device Control

Not rated 9,168

Circuit Image

This project is based on the Atmel AT89C52 microcontroller and the Dallas real-time clock (RTC) chip DS12887. It can control and remotely program the switching operations of 24 electrically operated devices, allowing them to be turned on or off at precise times, either daily or monthly. The microcontroller can be programmed for device control using a standard Philips TV remote control. The Philips IR format employs RC5 code, also known as bi-phase coding. In RC5-coded signals, each bit has a uniform duration, and a transition in the middle of the time interval assigned to each bit encodes its logical value (0 or 1). A high-to-low transition represents a logic value of 0, while a low-to-high transition represents a logic value of 1. Additional transitions are required at the beginning of each bit if a stream of identical bits is sent. However, if the first two bits are start bits, which are used to synchronize the receiver, no additional transitions are needed. The third bit is a toggle bit, which changes state each time a button on the remote is pressed, helping to determine whether the button was genuinely pressed or if an obstacle obstructed the IR path. The five bits (A4 through A0) following the toggle bit identify the device, allowing for a maximum of 32 devices to be uniquely addressed and respond to the same coding without interference. The six bits (C5 through C0) following the address bits serve as control/command bits, enabling up to 64 commands in an RC5-type remote. When a command button is pressed, the coded signal is received by the IR receiver-demodulator TSOP1738. The output of the IR demodulator is normally high, but pressing a button generates a series of low-going demodulated pulses at its output. These pulses are sent to the active-low interrupt input pin (INT/0) of the AT89C52. Upon receiving the first low-going pulse, the monitor program of the AT89C52 is interrupted and execution jumps to location 0003H, where it redirects to the receive subroutine. The microcontroller AT89C52 interfaces with the DS12887 RTC, a 16x2 LCD module, and an 8255 programmable peripheral interface (PPI). The address-decoding circuitry consists of NAND gates (74LS00) and a 3-to-8 line decoder (74LS138). The interfacing circuitry for the external electrical appliances uses the Darlington array IC ULN2803. The addressing range for various peripheral devices is specified in the relevant table. In the AT89C52 (IC1), port P0 outputs the multiplexed address (lower 8 bits) and data. The address is latched into the 74LS573 (IC2) octal latch and the RTC DS12887 (IC3) via the ALE (address latch-enable) output from pin 30 of IC1. Only two address lines from IC2 (A0 and A1) are utilized for addressing the four registers of the 8255 PPI (IC6) in conjunction with the chip-select signal at pin 6 (from IC4) and read/write signals from IC1. Higher address bits from port P2 of IC1 (A8, A9, and A10 from output pins P2.0, P2.1, and P2.2) generate the chip-select signals from the 74LS138 (IC4) covering address ranges 000H-0FFH, 100H-1FFH, and 200H-2FFH for the RTC, LCD module, and PPI chip, respectively. A quad NAND gate (7400, IC5) along with read and write signals from IC1 and the chip-select signal from pin 14 of IC4 is used to select the LCD module during both read and write cycles of IC1. The PPI chip 8255 is configured with port A, port B, and port C for interfacing with the microcontroller and controlling the various operations of the connected devices.

The circuit design utilizes an Atmel AT89C52 microcontroller at its core, which is a robust 8-bit microcontroller suitable for embedded applications. It features 32 I/O pins, 4 KB of flash memory, and supports external memory interfacing. The DS12887 RTC chip provides accurate real-time clock functionality, which is essential for time-based control of the devices. The use of a standard Philips TV remote control for programming and controlling the devices adds user convenience, leveraging the widely adopted RC5 protocol for IR communication.

The IR receiver-demodulator TSOP1738 is crucial for receiving the IR signals from the remote control. Its output connects to the interrupt pin of the AT89C52, allowing for efficient handling of commands. The 74LS573 octal latch is employed to store the address and data temporarily, ensuring that the microcontroller can manage multiple peripheral devices effectively. The 8255 PPI facilitates communication with the external devices, providing flexibility in control and data handling.

Overall, the project exemplifies a well-structured embedded system capable of managing multiple devices through precise timing and remote control, making it a versatile solution for various applications requiring automation.This project based on Atmel AT89C52 and Dallas real-timeclock (RTC) chip DS12887 can be used to control and remotely program the switching operation of 24 electrically operated devices. The devices can be switched on/off at precise times repeatedly every day, every month. The microcontroller can be programmed for device control using a normal Phil ips TV remote control. The Philips IR format makes use of RC5 code, which is also known as bi-phase coding. ` In RC5-coded signals (Fig. 2), each bit has a uniform duration. A transition in the middle of the time interval assigned to each bit encodes its logical value (0` or 1`). A high-to-low transition assigns the bit a logic value of 0, ` and a low-to-high transition assigns the bit a logic value of 1.

` We need additional transitions at the beginning of each bit if a stream of equal bits is sent. However, there is no need of additional transitions if the The first two bits are start` bits, which are used to adjust and synchronise the receiver. These bits are used to calculate and analyse the bit length of the other bits. The third bit is a toggle` bit, which is toggled every time a button ispressed at the remote control.

This bit is used to identify whether the button is really pressed or whether an obstacle came in between the IR path of the remote and the IR receiver. The five bits (A4 through A0) immediately following the toggle bit are used to identify the device (see Table III).

So, a maximum of 32 devices can be identified to and respond individually to the same type of coding without any disturbance, i. e. , one among the 64 devices can be identified uniquely. Addresses of some of the remotes are shown in Table III. The six bits (C5 through C0) immediately following the five address bits are the control/command bits.

Therefore a maximum of 64 commands can be equipped in an RC5-type remote. Some of the command codes (decimal equivalents), as used in this project, are shown in Table IV. When any of the command/control buttons on the remote is pressed, the coded signal is received by the IR receiver-demodulator TSOP1738. The output of the IR demodulator circuit is normally high, but when any of the buttons in the remote is pressed, a stream of low-going demodulated pulses will appear at its output.

These pulses are fed to the external active-low interrupt input pin (INT/0) of 89C52. On receipt of the first low-going pulse, the monitor program of 89C52 will get interrupted and jump to the location 0003H, ` where the execution is redirected to receive` sub-routine of the Microcontroller AT89C52 is interfaced to DS12887 (RTC), a 16x2 LCD mod-ule and an 8255 programmable peripheral interface (PPI). The address-decoding circuitry comprises NAND gates 74LS00 and 3-to-8 line decoder 74LS138 as shown in Fig.

1. The interfacing circuitry for the external electrical appliances comprises Darlington array IC ULN2803. The addressing range of various peripheral devices is shown in Table I. In 89C52 (IC1), port P0 is used for outputing multiplexed address (lower8-bit) and data. The address is latched into 74LS573 (IC2) octal latch and RTC DS12887 (IC3) with the help of ALE (address latch-enable) output from pin 30 of IC1.

Only two address lines from IC2 (A0 and A1) have been used for addressing the four registers of 8255 PPI (IC6) in conjunction with the chipselect signal at pin 6 (from IC4) and read/write signals from IC1. Higher-address bits from port P2 of IC1 (A8, A9 and A10 from output pins P2. 0, P2. 1 and P2. 2) are used for generating the chipselect signals from 74LS138 (IC4) cover INg address ranges 000H-0FFH, 100H-1FF and 200- 2FF for RTC, LCD module and PPI chip, respectively.

Quad NAND gate 7400 (IC5) in conjunction with read and write signals from IC1 and chip-select signal from pin 14 of IC4 is used for selecting the LCD module both during read and write cycles of IC1. PPI chip 8255 is configured with port A, port 🔗 External reference