Saturday, June 29, 2013

Pulse Rate monitoring in PC (wireless)

This circuit is used to display the number of pulses occurred per minute on the PC desktop.we can use this to calculate frequency of the signal. 
Working: i will calculate the signal peaks every minute and i will send that information using wireless protocol(Gigbee/GSM). on the other end i will receive by the same wireless device and i will send the same data to RS232 port of a PC. You can monitor the data on Hyper-terminal.
     
                                                                                                             
You have to connect wireless device GSM/Gigbee on both sides. depending the device connected you have modify your code.                                                             
NOTE: i haven't indicated any wireless device. that will be connected to DB9 port.
More information is prohibited here on this topic.

Thursday, June 6, 2013

Automatic car parking indicator using 8051

This system will indicate empty and filled car parking slots at the entry. Now a days Car parking at shopping malls and markets is becoming a big issue and is causing to traffic jam. To avoid this  problem we are designing this system to indicate empty slots and filled slots, so that a car driving person can directly take his car to that particular empty slot. we will indicate the slot state by LEDs and also in LCD screen. we will use IR sensors to sense the presence of car in the slot.
Working: when a car enter into a empty slot the photo detector output will become '1', this will change the state of the slot to filled, otherwise it is remained in empty state only. like wise all the slots are detected by IR sensors.
Here is the functional flow chart

  to download C-code
  to see output video 
  to see working video -1
Schematic Diagram:
case'1': when all the slots are empty
all the LEDs are glowing and slot states are displayed in LCD  
here LED ON means slot empty; and LED OFF means slot filled 
case'2': when 1st and 2nd slots are filled
1st and 2nd LEDs are glowing and the same thing is displayed in LCD
NOTE:
pushbuttons are to be replaced by IR sensors and comparators

Coal mine detection robot

It is mandatory to check the coal mine weather conditions prior to workers entry. If the weather conditions are normal then workers can enter , otherwise they will not go inside the mine. To check the weather conditions all over the mine we will send one robot which will monitor CO (carbon monoxide) in the mine, temperature and light intensity in the mine. After reading each parameter it will compare with threshold readings and produces output depending the readings taken. This robot is also an obstacle avoidance robot, it uses IR sensors to control its movement in the mine.
here is the flow chart

to download C-code
  to see video output

Schematic Diagram:
case'1':  when the light intensity is less in the mine
pulse width to the light is 0.1sec. and obstacle detected on left side. robot moving to right side 
                          A Reference book to learn about robots in hazardous environments here

case'2': when light intensity is less, high temperature and CO gas exceeded in the mine
 pulse width to the light is varying 0.1s, 0.25s and 0.5 sec to indicate 3 parameters are not in normal condition. and no obstacle detected
NOTE: 
push button at P1.3 has to be replaced by CO Gas sensor,
push buttons at P1.4 and P1.4 are to be replaced by IR sensors.  
Green LED will be replaced by Buzzer.
Threshold values may vary in practical  

line follower robot using 8051

This robot can follow black line on the floor. It is designed using micro controller and IR sensors.


  to download C-code
  to see video output

Here is the simple schematic diagram
case'1': when right motor crossed black line
case'2': normal operation




 IR sensor operation


   push buttons should be replaced by IR senors and comparator circuits

Line follower robot without microcontroller

Here is a robot which will follow the black line on the floor. This is controlled on the basis of IR sensors. This doesn't use any micro controller and microprogram.
This is the logic circuit to control the robot operations
  llogic reduction using k-map
  to see video output
reduced logic
IR sensor operation

NOTE: here the push buttons are replaced by IR sensors and comparator circuits.

Saturday, June 1, 2013

Automatic Room light and fan control with visitor counting

This system will control the room light and fan by taking inputs as person count, room light intensity and room temperature.

Working:  When there is no person entered in to room then person count will become zero and then it will not check intensity and temperature, so that bulb and fan will be in OFF mode.  If a person enters into a room then the person count will be increased by '1' and if person exits a room then person count will decrease. If person count is greater than zero then it will check intensity and temperature. If the room intensity is less than the threshold then the bulb will glow otherwise will be in OFF mode only and if the room temperature exceeds the threshold temperature then the fan will start moving otherwise will be in OFF mode only.

Pictorial view of system arrangement 
  to download C-code
  to see its working video-1
to see working video-2

Here is the main flow chart


This flow chart is used to indicate person count, but in practical we dont need to implement this part

 Output Results:
case'1': when there is no person in the room
LEDs showing count value is '0'

case'2': when there are two persons in the room, room condition the intensity is less and temperature is greater than the threshold temperature


                       
NOTE:
1. Threshold values may be different in practical 
2. push buttons will be replaced by IR sensor network in practical 
3. person count LEDs are not needed in practical


Friday, May 31, 2013

Automatic Train Gate controlling / Metro Train Indication

This Embedded System is designed to control the  train junction Gates automatically when train passes across this junction. Here we arrange two IR sensors before the junction ( distance > 500mtrs from Gate junction) and also two IR sensors after the junction (distance  > 500mtrs from Gate junction). The IR sensors which are before the junction will indicate that the train is coming near to the junction and the IR sensors which are after the junction will indicate that the train has passed away the junction.
The pictorial arrangement of the system is shown here
                       

when train comes in between the 2 IR sensors the output of both the photodetectors will become logic - '1'. Then the system will send logic high to the Siren, Red light will glow , green light will turn off and the Gate will close. 
Here is the simple flow chart showing its operation

           
                               

Case'1': When train is coming near to the junction
 to see the video output
  to download the C-code                                                     Servo Motor
    
Case '2': When train passed away the junction
                       

NOTE: 
Here we  connected single servo motor b'coz it is a prototype. but in real time we will use two servo motors, and also here the Siren is replaced by Yellow color LED and IR sensors are replaced by optocouplers.

Thursday, May 30, 2013

Password based Door locking system

This is a  8051 based security project, we can lock and unlock the door electronically. Electronic door locking systems are used in Bank lockers, home lockers, main doors and prison  etc.,

Working: When we give correct UserID and Password then only we can UNLOCK and LOCK the door otherwise we can't operate it. If we entered correct userID and password it will show authenticated message on LCD screen otherwise Invalid userID or Access Denide. Then you can select one of the option LOCK DOOR and UNLOCK DOOR.
Here is the functional flow chart 


to download C-code
Here we are showing how door can be locked and unlocked mechanically and electrically with mechanical body of the door                                                                         Available Product
 Schematic Diagram:  
  to see the video output
case'1': when the door is locked

case'2':When the door is unlocked
NOTE: I haven't connected any motor driver here, but practically we can interconnect opto-coupler or motor driver H-bridge.

Sunday, May 19, 2013

Smart Energy Meter using 8051

This is just a prototype of original meter having some features.
conventional analog energy meters indicates the meter reading by scrolling down the mechanical number plates. It will not show daily power consumption and cost/unit to the consumer. This is a prototype of Smart Energy meter it indicates the meter reading and cost/unit and also it can send the same information to the power grid. This is developed using AT89c51 microcontroller.

Features:
> Security UserID and Password
> Read Units anytime and price/unit
> send no.of Units to grid
> we can change userID and Password 
> get back to previous menu

to download code

Here is the functional tree chart

high level Flow chart: it gives behavioral working model of the meter


 Results: to see the video how it works 
  to see working video
 When user selected read units : displaying no.of units and price/unit
 

when user selected send to grid : it sent ID and no.of units consumed by the user
                                
NOTE: meter readings are calculated by IR LED and PhotoDetector. In between the IR LED and PhotoDetector there will be a rotating magnetic coil of a conventional meter. But here we replaced it with one push button connected to the 555 timer(Monostable multivibrator), because we can't represent them here.

Saturday, May 18, 2013

Change UserID and Password using 8051

Here is the one example showing how to change Predefined "UserID" and "Password" manually by user. If we want to change userID or password, it will take  inputs from the keypad two times for confirmation. If the two inputs are matched then one of them will be assigned to the predefined one , otherwise it will display "not matched" inputs and jumps to main menu. The following flow chart describes how it works

to see the output 
  to download the code
                It is showing initial user ID and Password when the power is ON.

It is showing new UserID and Password when the user changed successfully 

                                

Monday, May 13, 2013

Automatic Room light Controller with OpAmp:

Automatic Room light Controller with OpAmp: 

It is more important to save power. here the one way to save the power by automatic controlling of room lights. This is also an application of OpAmp based comparator. This is based on the light intensity in the room, here we use LDR(light dependent resistor) who's resistance decreases with increase in room light intensity. There is a choice that you can change the threshold level to your desired level so that it can operate at that intensity level. It does not require any microcontroller or any other programmable devices.

components procured:
>LDR  
>OpAmp 741
>resistor 10k
>BC547 transistor
>SPDT relay 12V
>1N4001 diode 
>battery and a bulb

 here i connected the LDR output to the inverting terminal and a threshold voltage of 1.5v is connected to the non-inverting terminal. so that whenever the light intensity increases the LDR output will decrease and if it is less than the threshold the output of the opamp will be +Vsat=+5v.This will trun on the BC547 so that relay will be connected as shown here, bulb will not glow
                                           VLDR >1.5v ; transistor ON; Light OFF;

  to see the output                                             A book on OPAMP circuits

 when the room light intensity decreases LDR resistance will decrease and voltage across the resistor goes high. when it is greater than the threshold opamp output goes to -Vsat=-5v. then the BC547 will goes to the cutoff region (OFF state). so the light will glow.
                                  VLDR < 1.5v ; transistor OFF; light ON;

Automatic room fan controller using OpAmp:


This is the another application of a comparator. This can save the power and we don't need to switch ON and OFF the ceiling FAN manually. here we can set the threshold voltage to our desired value. The ceiling fan will be switched ON when the temperature increases the threshold value. We are using LM35 sensor to sense the room temperature. The sensitivity of this LM35 sensor is 10mv/ 'C. I want that fan to be switched on when the temperature increases more than 27'C. so set my threshold voltage to
                                 Vthreshold = 27'C x 10mv = 270mv = 0.27V

                      here the room temperature is 26'c so the output voltage is < 0.27V ; Fan off
  to see the output 



 when the temperature increases to 27'c or more, the output voltage of LM35 will increases to more than 0.27V. so that opamp output will goes to +Vsat=+5v. This will switch ON the transistor and so relay connects. This will switch ON the ceiling fan.

    here the temperature is 28'c so the output voltage >0.27v; fan ON      LM35 sensor

4x4 matrix keypad interfacing to 8051(AT89c51)

//----- reading the char/number from the keyboard----//
#include<reg51.h>
#define ROW P1      // assigning  Port1 to ROW
#define COL P2       // assigning port2 to COL
void msdelay(unsigned int value);
void sertx(unsigned char );
unsigned char dat[4][4]
={'0','1','2','3',    // keypad read data
                          '4','5','6','7',
                           '8','9','A','B',
                           'C','D','E','F'};
void main()
{
 unsigned char colloc,rowloc; // initializing column and row locations
 TMOD=0x20;               // timer -2 mode-2
 TH1=0xFD;                 // preset FD
 SCON=0x50;              // serial control reg. 9600 baudrate
 TR1=1;                      // timer-1 start
 COL=0xFF;               // make column pins input
 while(1)
 {
   do
   {
    ROW=0x00;      // write "00000000" to ROW  
       colloc=COL;  // read column input
    colloc&=0x0F;  // hide higher nibble
    }while(colloc!=0x0f); //check whether any change in column pins
    do
    {
     do
     {
      msdelay(20);
      colloc=COL;
      colloc&=0x0F;
      }while(colloc==0x0F);
      msdelay(20);                  // check column after 20ms
      colloc=COL;                  // it is for accuracy if there is any random spike it can ignore
      colloc&=0x0F;
      }while(colloc==0x0F);
    while(1)
    {
     ROW=0xFE;         // write "1111_1110" on to ROW
     colloc=COL;
     colloc&=0x0F;
     if(colloc!=0x0F// if there is a change in column/button pressed
     { 
      rowloc=0;          
       break;
      }
      ROW=0xFD;  // writing "1111_1101" onto the ROW
      colloc=COL;
      colloc&=0x0F;
      if(colloc!=0x0F // if there is a change in column/button pressed
       {
        rowloc=1;
        break;
        }
      ROW=0xFB;   // writing "1111_1011" onto the ROW
      colloc=COL;
      colloc&=0x0F;
      if(colloc!=0x0F // if button pressed / change in column
       {
        rowloc=2;
        break;
        }
      ROW=0xF7;     // writing "1111_0111" onto ROW
      colloc=COL;
      colloc&=0x0F;
      if(colloc!=0x0F// if button pressed/change in column
      {
       rowloc=3;
       break;
       }
       }
   if(colloc==0x0E)
   sertx( dat[rowloc][0]);
   if(colloc==0x0D)
   sertx(dat[rowloc][1]);
   if(colloc==0x0B)
   sertx(dat[rowloc][2]);
   if(colloc==0x07)
    sertx(dat[rowloc][3]);
    }
  }
void sertx(unsigned char x)
{
 SBUF=x;
 while(TI==0);
 TI=0;
 }
void msdelay(unsigned int value)
{
 unsigned int i,j;
 for(j=0;j<value;j++)
 for(i=0;i<100;i++) ;
  }

Result:   to see output

Dc motor interfacing to 8051(AT89c51)

Controlling  2 motors in both forward, reverse and one forward one reverse operation according to the 4 input pins. When input is 1110=both in forward;1101=both in reverse;1011=left one forward right one stop; 0111=left one stop and right one forward.

MicroCode:

#include<reg51.h>
sfr sw=0x90;
sbit EN1=P2^0;
sbit EN2=P3^0;
sbit MTR1_0=P2^1;
sbit MTR1_1=P2^2;
sbit MTR2_0=P3^1;
sbit MTR2_1=P3^2;
void main( )
{
EN1=0;
MTR1_0=0;
MTR1_1=0;
EN2=0;
MTR2_0=0;
MTR2_1=0;
while(1)
{
EN1=1;
EN2=1;
if(sw==0xFE)
{
MTR1_0=0;
MTR1_1=1;
MTR2_0=0;
MTR2_1=1;
}
else if(sw==0xFD)
{
MTR1_0=1;
MTR1_1=0;
MTR2_0=1;
MTR2_1=0;
}
else if(sw==0xFB)
{
MTR1_0=0;
MTR1_1=1;
MTR2_0=0;
MTR2_1=0;
}
else if(sw==0xF7)
{
MTR1_0=0;
MTR1_1=0;
MTR2_0=0;
MTR2_1=1;
}
else
{
MTR1_0=0;
MTR1_1=0;
MTR2_0=0;
MTR2_1=0;
 }
}
}

Result:   to see output

Display messages on 16x16 LCD using 8051(AT89c51)

#include<reg51.h>
sfr ldata=0x90;
sbit rs=P2^0;
sbit rw=P2^1;
sbit en=P2^2;
sbit sw1=P3^0;
sbit sw2=P3^1;
sbit sw3=P3^2;
void Tdelay(unsigned int );
void lcdcmd(unsigned char );
void lcd_data(unsigned char );
void lcd_init(void);
void lcd_display(unsigned char *c );

int main( )
{
while(1){
lcd_init( );
if (sw1==0)
lcd_display("Embedded Systems");
if (sw2==0)
lcd_display("Electronics");
if(sw3==0)
lcd_display("Embedded programming");
}
}
void Tdelay(unsigned int ms)
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<1275;j++);
}
void lcd_init( void)
{
lcdcmd(0x38);
Tdelay(25);
lcdcmd(0x0F);      //display on , cursor blinking
Tdelay(25);
lcdcmd(0x06);       //  cursor increment
Tdelay(25);
lcdcmd(0x80);        // start at row-1
Tdelay(25);
lcdcmd(0x01);        // clear screen
Tdelay(10);

}
void lcdcmd(unsigned char cvalue )   // lcd in command mode
{
ldata=cvalue;
rs=0;
rw=0;
en=1;
Tdelay(1);
en=0;
}
void lcd_display(unsigned char *dvalue)
{
unsigned int x;
for(x=0;dvalue[x]!=0;x++)
{
lcd_data(dvalue[x]);
Tdelay(10);
}
}
void lcd_data(unsigned char dvalue)       // lcd in data mode
{
ldata=dvalue;
rs=1;
rw=0;
en=1;
Tdelay(1);
en=0;
}

Result: to see output

16x2 LCD interfacing to 8051(AT89c51)

Displaying “Embedded Systems” in 16x2 LCD display  
#include<reg51.h>
sfr ldata=0x90;
sbit rs=P2^0;   // LCD reset
sbit rw=P2^1;  // read/write control
sbit en=P2^2;  // LCD r/w enable
void Tdelay(unsigned int );     // functions initializaion
void lcdcmd(unsigned char );
void lcd_data(unsigned char );
void lcd_init(void);
void lcd_display(unsigned char *c );

int main( )
{
while(1){
lcd_init( );
 lcd_display("Embedded Systems");
}
}
void Tdelay(unsigned int ms)  // providing some delay
{
unsigned int i,j;
for(i=0;i<ms;i++)
for(j=0;j<1275;j++);
}
void lcd_init( void)
{
lcdcmd(0x38);
Tdelay(25);
lcdcmd(0x0F);      //display on , cursor blinking
Tdelay(25);
lcdcmd(0x06);       //  cursor increment
Tdelay(25);
lcdcmd(0x80);      // start at row-1
Tdelay(25);
lcdcmd(0x01);      // clear screen
Tdelay(10);
}
void lcdcmd(unsigned char cvalue ) // LCD in command mode opearaion
{
ldata=cvalue;
rs=0;
rw=0;
en=1;
Tdelay(1);
en=0;
}
void lcd_display(unsigned char *dvalue)
{
unsigned int x;
for(x=0;dvalue[x]!=0;x++)
{
lcd_data(dvalue[x]);
Tdelay(10);
}
}
void lcd_data(unsigned char dvalue) // LCD in data mode operation
{
ldata=dvalue;
rs=1;
rw=0;
en=1;
Tdelay(1);
en=0;
}
  

Result: to see output

Serial data transmission using 8051(AT89c51)

  Transmit the following strings when the corresponding switch is pressed
     “EMBEDDED SYSTEMS” ; “ EMBEDDED PROGRAMMING” ; “ASSEMBLY PROGRAMMING”;   

#include<reg51.h>
sbit sw1=P2^0;  // switchs connecting port-2 lower pins 0,1,2
sbit sw2=P2^1;
sbit sw3=P2^2;
void Transmit(unsigned char ); // function initialization
void main()
{
unsigned char x;
unsigned char name1[ ]="Embedded systems";
unsigned char name2[ ]="Embedded programming";
unsigned char name3[ ]="Assembly programming";
TMOD=0x20;  // timer-1 mode-2
TH1=0xFD;      // preset value FD
SCON=0x50;  //Serial control 9600 baud rate selection
TR1=1;            // run timer-1
while(1)
{
if(sw1==0)      // check if switch 1 is pressed
{
for(x=0;x<=16;x++ // transmitting 17 characters to serial port
{
Transmit(name1[x]);
}
}
if(sw2==0)       // check if switch 2 is pressed
{
for(x=0;x<=20;x++)   // transmitting 21 characters to the serial port
{
Transmit(name2[x]);
}
}
if(sw3==0)    // check if switch 3 is pressed
{
for(x=0;x<=20;x++// transmitting 21 characters to the serial port
{
Transmit(name3[x]);
}
}
}
}

// serial port declaration
void Transmit(unsigned char i)
{
SBUF=i;
while(TI==0); // wait until serial Transmit interrupt flag  overflow
TI=0;
}




Result: to see output                                                         serial cable