Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering

Intelligent Automated Home Lighting System

By Disha Karnataki

Want to know why your monthly electricity bills are “so high”?  This is because when a person inside the room leaves the room hastily, he or she unknowingly leaves the  lights and fans switched on.
So, what’s next? The only way  to solve this is to use an Intelligent Automated Home Lighting System. In this system when a person enters the room the tube lights are switched on automatically and go off automatically when there is no body inside the room. This implies that the whole system is now at the tip of your motion.
Here we have used 8051 micro-controller along with two sensors.  These are IR Sensors or LED light falling on the LDR that act together to detect the motion inside the room  while microcontroller acts as a person counter and increments or decrements depending upon the number of people inside the room. If  the room is vacant then the  bulbs,  tube lights,  fans, etc switch off automatically on the exit of the last person who was  present there.

Block Diagram:

Overview of Automatic Light System for Home

Fig. 1: Overview of Automatic Light System for Home

Circuit Component Description

Before explaining the working let’s find out what are LDR Sensors:
• When the light level is less intense, resistance of the LDR is high
• But when light shines onto the LDR, resistance falls

Typical Image of Light Dependant Resistor

Fig. 2: Typical Image of Light Dependant Resistor

Block Diagram Explanation of each LDR working

Block Diagram representing working principle of LDR with Microcontroller

Fig. 3: Block Diagram representing working principle of LDR with Microcontroller

Block Diagram representing Microcontroller response to signals from LDR circuit

Fig. 4: Block Diagram representing Microcontroller response to signals from LDR circuit

Sensor Working

As properties are already stated

Case 1

When nobody interrupts the light falling on LDR:
The resistance of LDR is low and hence the base of the transistor does not get sufficient voltage to turn on the transistor and hence the collector voltage is almost equal to supply voltage that is 5V in this case.

Case 2 

When a person interrupts the light falling on LDR:
The resistance of LDR is high and hence transistor switches on and the collector voltage almost becomes equal to zero voltage.
These different collector voltages are picked by the microcontroller pins  which decide whether the person is going into the room or out of the room.
LDR sensor is just used for experimental purpose. In reality photo-transistor like the IR Sensors should be used because of good sensitivity.

Like this one:

Typical Image of IR Transmitter and Receiver

Fig. 5: Typical Image of IR Transmitter and Receiver

8051 Microcontroller Features

1)  8051 have 128 bytes of RAM
2)  8051 have 128 user defined flags
3)  It consists of 16 bit address bus
4)  It also consist of 3 internal and two external interrupts
5)  Less power usage in 8051 with respect to other micro-controller
6)  It consists of 16-bit program counter and data pointer
7)  8051 can process 1 million one-cycle instructions per second
8)  It also consist of 32 general purpose registers each of 8 bits
9)  ROM on 8051 is 4 Kbytes in size
10) It also consists of Two16 bit Timer/ Counter

Block Diagram of 8051 Microcontroller

Fig. 6: Block Diagram of 8051 Microcontroller

Fnd: There are two types in it:

Common Anode and Common Cathode
I have used common cathode in this project. So for display to be lit logic “1” has to be sent.

Final Image with all the Circuit Components

Image showing circuit for detecting entrance or exit of a visitor in action

Fig. 7: Image showing circuit for detecting entrance or exit of a visitor in action

Detection of Whether Person is Entering the Room or Person is Leaving the Room

Case 1:

When person  enters  the room- as the  person enters  the room  first  sensor1  is  interrupted  and  then  the  sensor 2

The  decoding  of these  two  signals  take  place  as follows:  if   a  first  low  is  sensed  due  to sensor-1  then, the  second low  sensed  by   microcontroller due to  sensor-2    will  indicate   that  person  is coming  inside  the  room  and  hence counter  will  increment  by  one  and  the  bulb  will be switched  on.

Case 2:

When  person  exits  the room –  he  will  interrupt  the  sensor2  and  then  will  interrupt  the  sensor-1.

The  decoding  of these  two  signals  take  place  as follows:  if   a  fist  low  is  sensed  due  to sensor-2  then, the  second low  sensed  by microcontroller due to  sensor-1 will  indicate   that  person  is  going  outside   the  room  and  hence counter will  decrement  by  one  and  the  bulb  will be switched  off  if  counter value  reaches  to zero.

Software and Project Overview

Software Overview

Flowchart of C Code used for Visitor Detection and Automatic Switching of lights

Fig. 8: Flowchart of C Code used for Visitor Detection and Automatic Switching of lights

Other Features that can be Included

1)  During day time as the person enters the room, the lights (bulb) should not automatically switch on
2)  If the person inside the room wants to intentionally inverse the state of the room, then  it can  be done by using remote control interfaced   with microcontroller.

Project Overview

Overview of working algorithm of Automatic Light System

Fig. 9: Overview of working algorithm of Automatic Light System 

Project Source Code

###


CODE:IT  IS  WRITTEN  IN ASM  LANGUAGE:
org 0000h
ljmp main
org 0100h
main:mov p0,#00h    //make p0  as o/p port     BULB  IS CONNECTED HERE
mov p3,#0ffh       //make  p3  as i/p port        LDR  SENSORS ARE  CONNECTED HERE
mov p2,#00h      //make p2  as o/p port    FND  IS CONNECTED HERE
mov r0,#00h
mov p2,#0ffh
up:
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
f2:jb p3.0,f1          // CONTINUOUSLY  CHECK  FOR  A LOW  ON SENSOR-1  AND SENSOR-2 ALTERNATELY
lcall delay //
lcall delay                        //  DELAY  TO CAPTURE  THAT  EVENT PROPERLY
lcall delay                            //
lcall delay                         //
lcall delay                         //
k2:jb p3.2,k2        //AFTER  LOW  OCCURRED  AT  SENSOR-1  THEN  CHECK  FOR  SENSOR-2  WHETHER  THE  PERSON  IS                               REALLY   ENTERING  THE  ROOM
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
inc r0
setb p0.0
lcall delay
lcall delay
lcall delay
sjmp fnd1         //DISPLAY    THE   INCREMENTED  VALUE  ON  FND
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
f1:jb p3.2,f2           //CONTINUOUSLY  CHECK  FOR  A LOW  ON SENSOR-1  AND SENSOR-2 ALTERNATELY
lcall delay             //
lcall delay       //                           DELAY  TO     CAPTURE  THE  EVENT
lcall delay            //
lcall delay                     //
lcall delay               //
k1:jb p3.0,k1         //AFTER  LOW  OCCURRED  AT  SENSOR-2  THEN  CHECK  FOR  SENSOR-1  WHETHER  THE  PERSON  IS                           REALLY   EXITING  THE  ROOM.
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
dec r0
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
lcall delay
ljmp fnd2                          //DISPLAY  THE  DECREMENTED  COUNT
c2:
cjne r0,#00h,j1
clr p0.0
ljmp up
j1:ljmp up
fnd1:
cjne r0,#01h,a1
mov p2,#0f9h
ljmp up
a1:cjne r0,#02h,a2
mov p2,#0a4h 
ljmp up
a2:cjne r0,#03h,a3
mov p2,#0b0h
ljmp up
a3:cjne r0,#04h,a4
mov p2,#19h 
ljmp up
a4:cjne r0,#05h,a5
mov p2,#92h
ljmp up
a5:cjne r0,#06h,a6
mov p2,#82h 
ljmp up
a6:cjne r0,#07h,a7
mov p2,#0f8h
ljmp up
a7:cjne r0,#08h,a8
mov p2,#00h 
ljmp up
a8:cjne r0,#09h,a9
mov p2,#10h 
a9:ljmp up
 
fnd2:
cjne r0,#00h,ac1
mov p2,#0ffh
ljmp c2
ac1:cjne r0,#01h,b1
mov p2,#0f9h
ljmp c2 
b1:cjne r0,#02h,b2
mov p2,#0a4h 
ljmp c2
b2:cjne r0,#03h,b3
mov p2,#0b0h
ljmp c2
b3:cjne r0,#04h,b4
mov p2,#19h 
ljmp c2
b4:cjne r0,#05h,b5
mov p2,#92h
ljmp c2
b5:cjne r0,#06h,b6
mov p2,#82h 
ljmp c2
b6:cjne r0,#07h,b7
mov p2,#0f8h
ljmp c2
b7:cjne r0,#08h,b8
mov p2,#00h 
ljmp c2
b8:cjne r0,#09h,b9
mov p2,#10h
ljmp c2 
b9:ljmp c2
delay:mov r2,#128
up1:mov r1,#0ffh
here:djnz r1,here
djnz r2,up1
ret
end
 

 

###

 


Circuit Diagrams

Circuit-Diagram-8051-Microcontroller-Based-Automatic-Lights

Project Video


Filed Under: Electronic Projects
Tagged With: 8051, Home Lighting System, microcontroller
 

Questions related to this article?
👉Ask and discuss on EDAboard.com and Electro-Tech-Online.com forums.



Tell Us What You Think!! Cancel reply

You must be logged in to post a comment.

HAVE A QUESTION?

Have a technical question about an article or other engineering questions? Check out our engineering forums EDABoard.com and Electro-Tech-Online.com where you can get those questions asked and answered by your peers!


Featured Tutorials

  • Introduction to Brain Waves & its Types (Part 1/13)
  • Understanding NeuroSky EEG Chip in Detail (Part 2/13)
  • Performing Experiments with Brainwaves (Part 3/13)
  • Amplification of EEG Signal and Interfacing with Arduino (Part 4/13)
  • Controlling Led brightness using Meditation and attention level (Part 5/13)
  • Control Motor’s Speed using Meditation and Attention Level of Brain (Part 6/13)

Stay Up To Date

Newsletter Signup

Sign up and receive our weekly newsletter for latest Tech articles, Electronics Projects, Tutorial series and other insightful tech content.

EE Training Center Classrooms

EE Classrooms

Recent Articles

  • What is a loop calibrator? 
  • What are the battery-selection criteria for low-power design?
  • Key factors to optimize power consumption in an embedded device
  • EdgeLock A5000 Secure Authenticator
  • How to interface a DS18B20 temperature sensor with MicroPython’s Onewire driver

Most Popular

5G 555 timer circuit 8051 ai Arduino atmega16 automotive avr bluetooth dc motor display Electronic Part Electronic Parts Fujitsu ic infineontechnologies integratedcircuit Intel IoT ir lcd led maximintegratedproducts microchip microchiptechnology Microchip Technology microcontroller microcontrollers mosfet motor powermanagement Raspberry Pi remote renesaselectronics renesaselectronicscorporation Research samsung semiconductor sensor software STMicroelectronics switch Technology vishayintertechnology wireless

RSS EDABOARD.com Discussions

  • Measure AC current accurateley (100mA to 10A)
  • 74HC595 creating Fake output
  • What was before microcontrollers ?
  • NEED HELP FOR OP-AMP IN BGR
  • Check undesired substrate mode...

RSS Electro-Tech-Online.com Discussions

  • Sla ir li ion
  • Need a ducted soldering fan for solder smoke extraction
  • Question about ultrasonic mist maker
  • Best way to reduce voltage in higher wattage system?
  • Two 300nH inductor in series, can get higher current?
Engineers Garage
  • Analog IC TIps
  • Connector Tips
  • DesignFast
  • EDABoard Forums
  • EE World Online
  • Electro-Tech-Online Forums
  • Microcontroller Tips
  • Power Electronic Tips
  • Sensor Tips
  • Test and Measurement Tips
  • 5G Technology World
  • About Us
  • Contact Us
  • Advertise

Copyright © 2022 WTWH Media LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of WTWH Media
Privacy Policy | Advertising | About Us

Search Engineers Garage

  • Projects and Tutorials
    • Electronic Projects
      • 8051
      • Arduino
      • ARM
      • AVR
      • PIC
      • Raspberry pi
      • STM32
    • Tutorials
    • Circuit Design
    • Project Videos
    • Components
  • Articles
    • Tech Articles
    • Insight
    • Invention Stories
    • How to
    • What Is
  • News
    • Electronic Products News
    • DIY Reviews
    • Guest Post
  • Forums
    • EDABoard.com
    • Electro-Tech-Online
    • EG Forum Archive
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • EE Resources
    • DesignFast
    • LEAP Awards
    • Oscilloscope Product Finder
    • White Papers
    • Webinars
  • EE Learning Center
    • Design Guides
      • WiFi & the IOT Design Guide
      • Microcontrollers Design Guide
      • State of the Art Inductors Design Guide
  • Women in Engineering