Pages

Remotely Programmable RTC-Interfaced Microcontroller for Multiple Device Control

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.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 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
program.



 The outputs from the subroutineare:
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.
3. Control byte, which has a unique value for each button in the remote control. 


Download Project 

Click on above links to download

Program to generate 50msec delay in 8051

mov tmod,#01 ;select timer 0

here:mov tl0,#0fdh ;load tl0 with 0fdh
mov th0,#4bh ;load th0 with 4bh
cpl p1.5 ;compliment p1.5
acall delay ;call delay routine
sjmp here ;jump to here
delay:mov r1,#0c8h ;load r1 with data 0c8h
l1:setb tr0 ;set bit tr0
again:jnb tf0,again ;repeat till tf0=0
clr tr0 ;clear tr0
clr tf0 ;clear tf0
djnz r1,l1 ;decrement r1, jump to l1, if not equal to 0
ret
end

Write a C program to display the code of the key pressed in 8051

#include <REG51xD2.H>

#include "lcd.h"
unsigned char getkey();
void delay(unsigned int);
main()
{
unsigned char key;
InitLcd(); /* Initialise LCD */
WriteString("Key Pressed="); /* Display msg on LCD */
while(1)
{
GotoXY(12,0); /* Set Cursor Position */
key = getkey(); /* Call Getkey method */
}
}
unsigned char getkey()
{
unsigned char i,j,k,indx,t;
P0=0x0ff;
P1=0x0ff;
P2 = 0x00; /* P2 as Output port */
indx = 0x00; /* Index for storing the first value of
scanline */
for(i=0x00E;i>=0x00B;i<<=1) /* for 4 scanlines */
{
P2 = i; /* write data to scanline */
t = P0; /* Read readlines connected to P0*/
t = ~t;
if(t>0) /* If key press is true */
{
delay(6000); /* Delay for bouncing */
for(j=0;j<=7;j++) /* Check for 8 lines */
{
t >>=1;
if(t==0) /* if get pressed key*/
{
k = indx+j; /* Display that by converting to Ascii */
t = k>>4;
t +=0x30;
WriteChar(t); /* Write upper nibble */
t = k & 0x0f;
if(t > 9)
t+=0x37;
else
t+=0x30;
WriteChar(t); /* write lower nibble */
return(indx+j); /* Return index of the key pressed */
}
}
}
indx += 8; /* If no key pressed increment index */
}
}
void delay(unsigned int x) /* Delay routine */
{
for(;x>0;x--);
}

program for Elevator Interface in 8051

#include <REG51F.H>

void delay(unsigned int);
main()
{
unsigned char Flr[9] = {0xff,0x00,0x03,0xff,0x06,0xff,0xff,0xff,0x09};
unsigned char FClr[9] = {0xff,0x0E0,0x0D3,0xff,0x0B6,0xff,0xff,0xff,0x79};
unsigned char ReqFlr,CurFlr = 0x01,i,j;
P0 = 0x00;
P0 = 0x0f0;
while(1)
{
P1 = 0x0f;
ReqFlr = P1 | 0x0f0;
while(ReqFlr == 0x0ff)
ReqFlr = P1 | 0x0f0; /* Read Request Floor from P1 */
ReqFlr = ~ReqFlr;
if(CurFlr == ReqFlr) /* If Request floor is equal to Current Floor */
{
P0 = FClr[CurFlr]; /* Clear Floor Indicator */
continue; /* Go up to read again */
}
else if(CurFlr > ReqFlr) /* If Current floor is > request floor */
{
i = Flr[CurFlr] - Flr[ReqFlr]; /* Get the no of floors to travel */
j = Flr[CurFlr];
for(;i>0;i--) /* Move the indicator down */
{
P0 = 0x0f0|j;
j--;
delay(25000);
}
}
else /* If Current floor is < request floor */
{
i = Flr[ReqFlr] - Flr[CurFlr]; /* Get the no of floors to travel */
j = Flr[CurFlr];
for(;i>0;i--) /* Move the indicator Up */
{
P0 = 0x0f0 | j;
j++;
delay(25000);
}
}
CurFlr = ReqFlr; /* Update Current floor */
P0 = FClr[CurFlr]; /* Clear the indicator */
}
}
void delay(unsigned int x)
{
for(;x>0;x--);
}

program for Stepper motor interface in 8051


#include <REG51xD2.H>
static bit Dir=0;
void delay(unsigned int x) /* Delay Routine */
{
for(;x>0;x--);
}
void ChangeDir(void) interrupt 0 /* Int Vector at 000BH, Reg Bank 1 */
{
Dir = ~Dir; /* Complement the Direction flag */
ClrLcd();
if(Dir)
delay(32000);
else
delay(32000);
}
main()
{
unsigned char Val,i;
EA=0x1; /* Enable Interrupt flag and Interrupt 0 & Serial Interrupt */
EX0=0x1;
ES=0x1;
P0=0x00; /*since the monitor is using the serial interrupt it has to be enabled*/
while(1)
{
if(Dir) /* If Dir Clockwise */
{
Val = 0x88;
for(i=0;i<4;i++)
{
P0 = Val; /* Write data for clock wise direction*/
Val = Val>>1;
delay(575);
}
}
else /* AntiClockwise Direction */
{
Val = 0x11;
for(i=0;i<4;i++)
{
P0 = Val; /* Write data for anticlock wise direction*/
Val = Val<<1;
delay(575);
}
}
}
}

Home Security System Using AT89C52

The project works on 5V DC derived from 230V. It will display the condition of home like temperature, door or window status, smoke detection, obstacle detection etc on 2×16 display and here we can use any mechanical device by the use of relay so we can overcome the problem generated at home. The project is also use for controlling the temperature    


            The project is use for security purpose at night for security purpose alarm is generated so that we should know something is wrong going on and it will display the problem generated on 2×16 display. 
Block Diagram
image


Description Of Block Diagram

 

   
  • POWER SUPPLY
Power supply block gives us 5V DC from 230V AC to drive microcontroller and other devices.
  • MICROCONTROLLER
 Here we use AT89C52. The AT89C52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of  Flash programmable and erasable ROM
  • LCD
           Here we use 2×16 LCD. It display the condition of home, it display temperature.
         
  • SOUND DETECTION
                   Sound signal is received from microphone in sound detection block and compared with threshold value if it is above threshold alarm is generated and display SND1 on LCD otherwise it display SND0.
  • SMOKE DETECTION
                   If the smoke is present smoke detection block will sense it and compared it with threshold value if the value is below threshold alarm is generated and display SM1 otherwise it display SM0.

Download Project 

RFID Based Door Access Control System using Microcontroller

Automation today has increased the speed of living. This project in which radio frequency is used to automatically control the door locks and grants access to the persons who are allowed to access that particular door.

The technology used is termed as RFID meaning ‘Radio Frequency Identification’. Here tags are provided in the form of identity cards which contain a coil and a transmitter.
When the coil is placed in a high frequency electromagnetic waves, it is energized and provides supply to the transmitter which transmits a code unique to the tag. This code is received and identify and hence the person is identified.
After identifying the person the access permission to the person are verified and if he is trying to access a door, which he is allowed access to, the door is opened and a log is created with the person’s name and time accessing the door.
Circuit Diagram:1
image