Friday, June 14, 2024

Remotely Programmable RTC Interfaced Microcontroller for Multiple Device Control

This project based on Atmel AT89C52 and Dallas real-time-clock (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 Philips TV remote control.

RC5 coding

Since the circuit makes use of Philips TV remote for device-switching time parameters, you need to know the fundamentals of the coding format used in these IR remotes.

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 next bit has a different logic value.


- Advertisement -

Table II shows how all the commands of an RC5 remote control are encoded.

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 is pressed 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.

- Advertisement -


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.

94A_fig-2When 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 () 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 program.

The outputs from the sub-routine are:

  1. Toggle bit, which toggles (either ‘0’ or ‘1’) each time the button in a remote is pressed.
  2. Address byte, whose value is zero for a normal Philips-type TV remote control (see Table III).
  3. Control byte, which has a unique value for each button in the remote control (see Table IV).

Click to rotate Fig. 1

The hardware


Microcontroller AT89C52 is interfaced to DS12887 (RTC), a 16×2 LCD module 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.

361_parts-listIn 89C52 (IC1), port P0 is used for outputing multiplexed address (lower 8-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 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) are used for generating the chip-select signals from 74LS138 (IC4) covering address ranges 000H- 0FFH, 100H-1FF and 200-2FF for RTC, LCD module and PPI chip, respectively.



Unique DIY Projects

Electronics News

Truly Innovative Tech

MOst Popular Videos

Electronics Components