MCU Based Automatic Light Switch_Micro2k15

download MCU Based Automatic Light Switch_Micro2k15

of 7

Transcript of MCU Based Automatic Light Switch_Micro2k15

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    1/7

    MCU Based Automatic Light Switch

    John Paul B. Soriano

    Computer Engineering Department

    Technological Institute of the Philippines

    Aurora Blvd., Cubao, Quezon City

    Shawn Cell Justine I. Cadaing

    Computer Engineering Department

    Technological Institute of the Philippines

    Aurora Blvd., Cubao, Quezon City

    Danmar S. Liquiran

    Computer Engineering Department

    Technological Institute of the Philippines

    Aurora Blvd., Cubao, Quezon City

    John Eric F. Susi

    Computer Science Department

    Technological Institute of the Philippines

    Aurora Blvd., Cubao, Quezon City

    Renz Hariette Fernandez

    Computer Engineering Department

    Technological Institute of the Philippines

    Aurora Blvd., Cubao, Quezon City

    CHAPTER 1. PROJECT BACKGROUND

    The Project

    A Microcontroller unit base automatic light switch, asthe name states is a light that automatically turns onwhen its dark. The project detects light and will onlyturn on in the absence of it. We used a light dependentresistor to make this possible and is a cheapalternative. The way this works is that the more light itcan detect, the more resistance it builds up. So themicrocontroller can easily read the resistance in thisresistance in the form of voltage and which can beconverted back into proportional value of light. TheLDR will be protruding in order to sense more light. Wealso made it a separate PCB and will be connectedusing wires for it to be properly adjusted.

    Statement of the Problem

    The growing need for electricity is inevitable. Astechnology develops we become more and morereliant on electricity. We are running out of sustainable

    ways on how to harness electricity. We also ended uptaking this for granted which also leads to wasting ofpower. Not all countries can afford electricity. If only wecould make simple ways to reduce the energy wastedand hopefully have a big impact not only on theeconomy but also our lives. Lights plays a veryimportant role on our lives because we need it in orderto do things effectively and efficiently. Street lights aremanually turned on and off. Having this in mind humanerror will lead to not being able to turn it on whenneeded and off when not. Of course, leaving it onduring the day will make it consume more power withit not being needed leading to wasting of energy.

    The Microcontroller based automatic light switch is asimple way to manage street lights. Using the LDR inconjunction with a microcontroller. This will reduceunnecessary power consumption because it isautomatic and will only turn on during the night andturns of as soon as the sun rises. It doesnt needsomeone to operate and will greatly serve the purpose.

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    2/7

    General Objective

    The main objective of this project was to design aprototype that turns the light on when it is darkautomatically using a microcontroller and an LDR inaccordance with codes and engineering standards and

    consideration of trade-offs based on functionality,economic constraints.

    Specific Objectives

    To design a light switch thatautomatically turns on at night

    To develop a prototype that canemulate the real life application of amicrocontroller based project

    Project Scope and Limitation

    The functionality of the device is only limited to turning

    on and turning off of light wherever it will be applied.The function of the system limited only on theobjectives. The system is programmed through amicrocontroller unit.

    CHAPTER 2. DESIGN PROJECT

    2.1 Design Constraints

    The design constraints in this project are alsoconsidered in order to specify the main functions andlimitations of the project. The constraints also serve asbasis in determining the feasibility of the system. This

    design constraint of this project is composed of thefunctional constraint, economic constraint and themanufacturability constraint.

    2.1.1 Functionality Constraint (Area)

    The functionality constraint of the project was theintensity of light available in order to turn on the lightdetect by the Light Dependent Resistor; must have atleast 20 percent light intensity; in order to turn off thelight. Light sensor is used to detect intensity of light.PIC161F877A microcontroller is used interfaced withlight sensor to sense amount of light available. An

    object blocking the Light sensor might affect thefunctionality.

    2.1.2 Economic Constraint (Cost)

    The economically the project was assemble withlimited budget due to status of the developer but thedeveloper assure that the whole project works with acheap components.

    2.1.3 Manufacturability Constraint (Time)

    The manufacturability constraint of the project was thelimited time given to develop the whole project. Theproject was assembled in a limited time and thedevelopers assure the quality and the function of the

    whole project will be working.2.1.4 Design Standards

    1.) 2700-2014 - IEEE Standards for SensorPerformance Parameter Definitions

    A common framework for sensor performancespecification terminology, units, conditions and limits isprovided. Specifically, the accelerometer,magnetometer, gyrometer/gyroscope,barometer/pressure sensors, hygrometer/humiditysensors, temperature sensors, ambient light sensors,

    and proximity sensors are discussed. (IEEE, IEEEXplorer Digital Library, 2014)

    2.) 1118-1990 - IEEE Standard MicrocontrollerSystem Serial Control Bus

    A serial control bus forinterdevice/intrabuilding as well as intrasiteinterconnection of micro-controllers isdescribed. The bus, which is defined for (butnot limited to) microcontrollers and devices

    with limited reprogrammability, provides amulti drop bit-serial communication protocolthat will allow the interconnection ofdistributed independently manufactureddevices. The protocol is optimized forinstrumentation, distributed data acquisitionsystems, control devices and test andmeasurement. Specifications for a commonarchitecture, generic bus services, systemmanagement, data link, and several physicalmedia are provided. The serial control busexpands upon BITBUS without making

    existing devices obsolete. System reliabilityhas been enhanced by the addition of asystem management layer, and generic busservices have been expanded.

    Hardware

    Upon the design of this project, the designersconsidered the factors that would affect the processdevelopment of the device. The factors that were

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    3/7

    considered are the knowledge, skills and materialsrequired for the development of the design. Thesefactors are discussed below:

    Knowledge:

    The designers applied the knowledge learnedfrom previous courses as listed below:

    Circuit Design

    The knowledge in circuit design has beenapplied in the specification and design of the proposedcircuits. The specifications of these circuits involvedthe calculations of the needed components such as thevalues of the resistor needed, voltage needed to besupplied, and other critical materials that woulddetermine the functionality of the prototype.

    Embedded System

    The system required the integration of bothhardware and software components, particularly; inprocess of converting a continuous range of values intoa finite range of discreet values which is 0 and 1; for onand off switch; this function of analog-to-digitalconverter was process and program insidemicrocontroller; this technique is called quantization.The utilization of the selected sensors required theproper interfacing and coding to the microcontrollerchip.

    Electronic Components

    The knowledge in electronics had been usedalong with the knowledge in circuit design. Electronicsrelated concepts had been considered on thespecification of materials to be used.

    Electronics Components

    Resistor

    A resistor is a passive two-terminal electricalcomponent that implements electrical resistance as acircuit element. In the project we use 420 Ohm and 10k

    Ohm.

    PCB 4x4

    A printed circuit board (PCB) mechanically supportsand electrically connects electronic components usingconductive tracks, pads and other features etched fromcopper sheets laminated onto a non-conductivesubstrate.

    LED Light

    A light-emitting diode (LED) is a two-leadsemiconductor light source. It is a pn junction diode,which emits light when activated.

    Voltage Regulator

    A voltage regulator is designed to automaticallymaintain a constant voltage level. A voltage regulatormay be a simple "feed-forward" design or may includenegative feedback control loops. We us LM7805voltage regulator that output 5 volts.

    Crystal Oscillator

    A crystal oscillator is an electronic oscillator circuit thatuses the mechanical resonance of a vibrating crystal ofpiezoelectric material to create an electrical signal witha very precise frequency. We use 20 MHz quartz

    crystal oscillator.

    Ceramic Capacitor

    A ceramic capacitor is a fixed value capacitor in whichceramic material acts as the dielectric. We use (2)22pF Ceramics Capacitor

    ZIF Socket

    A type of socket for mounting electronic devices that isdesigned not to stress or damage them duringinsertion. We use ZIF Socket with 40 pins.

    Software

    The skills and knowledge applied in the developmentwere all based on the knowledge learned and studiedfrom Software Engineering, C Language and

    Assembly Language as well as the softwarecomponents needed such as Integrated DevelopmentEnvironment for Microcontroller Programing: FlowcodeGraphical Programming.

    Knowledge:

    The designers have applied the knowledge learned

    from previous courses taken as listed below:

    Software Engineering

    The knowledge in Software Engineering has beenapplied in the design of the Software Development LifeCycle (SDLC). The application of the systematic,disciplined approach to the development and operation

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    4/7

    of the android application has been based from thediscussions taken in this course.

    C and Assembly Language

    C Language is a general-purpose, imperativecomputer programming language, supportingstructured programming, lexical variable scope andrecursion, while a static type system prevents manyunintended operations. By design, C providesconstructs that map efficiently to typical machineinstructions, and therefore it has found lasting use inapplications that had formerly been coded in assemblylanguage, including operating systems, as well asvarious application software for computers rangingfrom supercomputers to embedded systems.

    An assembly language (or assembler language) is alow-level programming language for a computer, orother programmable device, in which there is a verystrong (generally one-to-one) correspondencebetween the language and the architecture's machinecode instructions.

    Software Components:

    The different programming tools listed below are usedfor the development of the programs:

    Integrated Development Environment forMicrocontroller Programing

    The IDE used in the development of the program forthe microcontroller is the Flowcode

    2.2 Input-Process-Output

    The input of the system consists of the knowledgerequirements, hardware requirements and thesoftware requirements. The knowledge requirementscontains circuit design microcontroller programmingembedded systems and electronic circuits. Hardwarerequirements consists microcontroller, sensor: LDR(Light Dependent Resistor), and power supplies. The

    software requirements consists of the software to beused in simulation of the circuit before the testing.These software includes Flowcode, Autocad, Pic KitBurner, and PCB wizard. Also engineering standardsand multiple constraints must be observed on the inputof the system.

    2.3 Illustrative Diagram

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    5/7

    Displays a graphical representation of the intendedcomponents, and the relationships of each component

    The illustrative diagram shows the differentcomponents used in the design of this project and areenumerated below:

    1.) Microcontroller (PIC16F877A)

    The PIC16F877A features 256 bytes of EEPROM datamemory, self-programming, an ICD, 2 Comparators, 8channels of 10-bit Analog-to-Digital (A/D) converter, 2capture/compare/PWM functions, the synchronousserial port can be configured as either 3-wire SerialPeripheral Interface (SPI) or the 2-wire Inter-Integrated Circuit (IC) bus and a Universal

    Asynchronous Receiver Transmitter (USART). All ofthese features make it ideal for more advanced level

    A/D appl ications in automotive, industrial, appliances

    and consumer applications. (MicrochipTechnology,2013).

    2.) Light Dependent Resistor

    A photoresistor or light-dependent resistor (LDR) orphotocell is a light-controlled variable resistor. Theresistance of a photoresistor decreases with increasingincident light intensity; in other words, it exhibitsphotoconductivity. A photoresistor can be applied inlight-sensitive detector circuits, and light- and dark-activated switching circuits.

    3.) Light Emitting DiodeA light-emitting diode (LED) is a two-leadsemiconductor light source. It is a pn junction diode,which emits light when activated.[4] When a suitablevoltage is applied to the leads, electrons are able torecombine with electron holes within the device,releasing energy in the form of photons. This effect iscalled electroluminescence, and the color of the light(corresponding to the energy of the photon) isdetermined by the energy band gap of thesemiconductor.

    2.4 System Design

    Figure show how the system work from the inputs ofLight Dependent Resistors that depends on the lightintensity; accepted the value; process and program thecondition; that when the light intensity is 20 percentand lower; the microcontroller will become a switch tothe LED light. The processing of each signal receivedhas been done through Digital Signal Processingtechniques, particularly in quantization. Theseprocesses have to be performed by the microcontroller

    circuit; that accept analog signal of Light DependentResistor base on the light intensity to make it digital foron and off switch for LED light.

    2.5 PROJECT LIQUIDATION

    ITEM QUANTITY PRICE

    PIC16F877A 1 250.00 PHPLDR 1 10.00 PHPLED Light 1 8.00 PHP

    Resistor 3 10.00 PHPZIF Socket 1 120.00 PHP

    PCB 4X4 2 80.00 PHPCeramicCapacitor

    2 15.00 PHP

    CrystalOscillator

    1 20.00 PHP

    Card Board 1 100.00 PHP

    Adaptor Socket 1 10.00 PHP

    Wires 15 75.00 PHPTOTAL 698.00 PHP

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    6/7

    Flowcode

    PCB Design

    Microcontroller PCB

    LDR Circuit

    Testing

    Prototype Design

  • 7/24/2019 MCU Based Automatic Light Switch_Micro2k15

    7/7

    References:

    [1] IEEE Standard for Floating-Point Arithmetic,"in IEEE Std 754-2008, vol., no., pp.1-70,Aug.29 2008

    [2] PIC16F87XA Data Sheet. (n.d.). Retrieved

    September3,2015,fromhttp://www.microchip.com/

    [3] IEEE Standard for Sensor PerformanceParameter Definitions," in IEEE Std2700-2014,vol.,no.,pp.1-69,Aug.12,2014