Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal...

101
Automated Nightlight Final Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty Advisor Dr. Degang J. Chen Team Members Wesley Adreon Kong-Wei Soon Andrew Cook Dantrayl Smith Disclaimer Notice: This document was developed as a part of the requirements of an electrical and computer engineering course at Iowa State University, Ames, Iowa. This document does not constitute a professional engineering design or a professional land surveying document. Although the information is intended to be accurate, the associated students, faculty, and Iowa State University make no claims, promises, or guarantees

Transcript of Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal...

Page 1: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Automated Nightlight

Final Report

Project Team: May 06-19

ClientIowa State University – Senior Design

Faculty AdvisorDr. Degang J. Chen

Team MembersWesley Adreon Kong-Wei SoonAndrew Cook Dantrayl Smith

Disclaimer Notice:This document was developed as a part of the requirements of an electrical and computer engineering course at Iowa State University, Ames, Iowa. This document does not constitute a professional engineering design or a professional land surveying document. Although the information is intended to be accurate, the associated students, faculty, and Iowa State University make no claims, promises, or guarantees about the accuracy, completeness, quality, or adequacy of the information. The user of this document shall ensure that any such use does not violate any laws with regard to professional licensing and certification requirements. This use includes any work resulting from this student-prepared document that is required to be under the responsible charge of a licensed engineer or surveyor. This document is copyrighted by the students who produced this document and the associated faculty advisors. No part may be reproduced without the written permission of the senior design course coordinator.

Date SubmittedMay 3, 2006

Page 2: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table of Contents

List of Figures ...................................................................................................... ivList of Tables ....................................................................................................... vList of Definitions ................................................................................................ vi

1. Introductory Material ................................................................................. 11.1 Executive Summary............................................................................... 11.2 Acknowledgement ................................................................................ 21.3 Problem Statement ................................................................................ 2

1.3.1 Problem Statement ..................................................................... 21.3.2 Problem Solution ........................................................................ 2

1.4 Operating Enviornment ........................................................................ 21.5 Intended User(s) and Intended Use(s) .................................................. 3

1.5.1 Intended User(s) ......................................................................... 31.5.2 Intended Use(s) ........................................................................... 3

1.6 Assumptions and Limitations ............................................................... 31.6.1 List of Assumptions .................................................................... 41.6.2 List of Assumptions .................................................................... 4

1.7 Expected End-Product and Other Deliverables .................................... 4

2. Project Approach and Results ..................................................................... 52.1 Functional Requirements ....................................................................... 5

2.1.1 Ambient Light Detection ............................................................. 52.1.2 Movement Detection ................................................................... 52.1.3 Back-up Power Supply ................................................................ 62.1.4 Illumination ................................................................................. 62.1.5 Control Circuit ............................................................................ 6

2.2 Functional Design Constraints............................................................... 62.2.1 Size .............................................................................................. 62.2.2 Power Consumption .................................................................... 82.2.3 RoHS compliant and Pb Free ..................................................... 82.2.4 Ease of Use ................................................................................. 82.2.5 Maintenance ................................................................................ 8

2.3 Technical Approach Considerations..................................................... 82.3.1 Motion Detection ........................................................................ 8

2.3.1.1 Infrared Detection................................................................ 82.3.1.2 Sound Detection................................................................... 92.3.1.3 Body Heat Detection............................................................ 9

2.3.2 Illumination ................................................................................. 92.3.2.1 Fluorescent ......................................................................... 102.3.2.2 Solid State Devices ............................................................ 102.3.2.3 Incandescent Light Bulbs ................................................... 10

2.3.3 Control Circuit ............................................................................ 102.3.3.1 Circuits................................................................................. 102.3.3.2 Microcontroller.................................................................... 11

i

Page 3: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.3.4 Power Supply ............................................................................... 112.3.4.1 Battery Back-up.................................................................... 112.3.4.2 Power Source ....................................................................... 12

2.3.5 Daytime Operation ....................................................................... 122.3.5.1 Internal Timer...................................................................... 122.3.5.2 Phototransistor .................................................................... 122.3.5.3 Photoresistor ....................................................................... 13

2.3.6 Approach Selected ....................................................................... 132.3.6.1 Motion Detection................................................................. 132.3.6.2 Illumination ........................................................................ 132.3.6.3 Control Circuit..................................................................... 142.3.6.4 Power Source....................................................................... 142.3.6.5 Daytime Operation............................................................... 14

2.4 Technical Approach Considerations....................................................... 152.4.1 Power Supply.................................................................................162.4.2 Ambient Light Sensor..................................................................... 182.4.3 Infrared Transmission and Detection..............................................19

2.4.3.1 Transmitter ...........................................................................192.4.3.2 Detector ................................................................................19

2.4.4 Illumination LED’s......................................................................... 202.4.5 Microcontroller............................................................................... 212.4.6 Circuit Layout................................................................................. 222.4.7 Completed Parts List.......................................................................23

2.5 Implementation Process........................................................................... 252.6 End-Product Testing................................................................................ 25

2.6.1 Testing Environment..................................................................... 252.6.1.1 Narrow Width Hallway........................................................ 252.6.1.2 Wide Width Hallway............................................................ 262.6.1.3 Battery Back-up Testing...................................................... 262.6.1.4 Illumination Testing............................................................ 26

3. Resources and Scheduling ............................................................................. 273.1 Task Definition ...................................................................................... 27

3.1.1 Project Definition ......................................................................... 273.1.2 Technical Consideration .............................................................. 273.1.3 Design Process ............................................................................ 273.1.4 Product Construction and Limitation ........................................... 283.1.5 Product Testing ............................................................................ 283.1.6 Product Documentation ............................................................... 283.1.7 Product Demonstration ................................................................ 283.1.8 Product Reporting ........................................................................ 28

3.2 Personal Effort Requirements ............................................................... 283.3 Other Resource Requirements .............................................................. 293.4 Financial Requirements ........................................................................ 313.5 Schedule ................................................................................................ 33

ii

Page 4: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

4. Closure Material .......................................................................................... 354.1 Project Proposed Milestones and Evaluation Criteria.......................... 35

4.1.1 Problem Definition ..................................................................... 354.1.2 Research and Technology............................................................ 354.1.3 Design .......................................................................................... 354.1.4 Implementation ........................................................................... 364.1.5 Testing ......................................................................................... 364.1.6 Documentation ............................................................................. 364.1.7 Demonstration .............................................................................. 36

4.2 Commercialization................................................................................. 374.2.1 End Product Cost.......................................................................... 374.2.2 Market Selling Price..................................................................... 384.2.3 Potential Market............................................................................ 39

4.3 Recommendations for Additional Work................................................ 394.3.1 Battery Charger............................................................................. 394.3.2 Layout........................................................................................... 404.3.3 Fabrication.................................................................................... 404.3.4 Personalization............................................................................. 40

4.4 Lessons Learned.................................................................................... 404.4.1 What Went Well........................................................................... 404.4.2 What Did Not Go Well.................................................................. 414.4.3 Technical Knowledge Gained........................................................ 414.4.4 Changes.......................................................................................... 41

4.5 Possible Risks and Risk Management.................................................... 414.5.1 Equipment Damage........................................................................ 424.5.2 Human Injuries.............................................................................. 42

5. Project Team Information .......................................................................... 425.1 Client .................................................................................................... 425.2 Faculty Advisor .................................................................................... 425.3 Team Members .................................................................................... 435.4 Summary .............................................................................................. 435.5 References ............................................................................................. 44

Appendix A – Tested Source Code .................................................................... 45Appendix B – Instruction Manual ..................................................................... 49Appendix C – Narrow Width Hallway Testing................................................. 50Appendix D – Wide Width Hallway Testing .................................................... 51Appendix E – Batter Back-up Testing .............................................................. 52Appendix F – Disclaimer .................................................................................... 53Appendix G – Illumination Testing ................................................................... 54

iii

Page 5: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

List of Figures

Figure 1: The frontal view of the nightlight.......................................................... 7Figure 2: The top down view of the nightlight .................................................... 7Figure 3: The basic flow diagram of the nightlight circuit .................................. 15Figure 4: General interpretation of a transformer ............................................... 16Figure 5: AC to DC power conversion ............................................................... 16Figure 6: Complete power supply circuit.............................................................. 17Figure 7: LDR ambient light detection circuit...................................................... 18Figure 8: The basic layout of the sensing circuit that will be used ...................... 20Figure 9: Pin layout of a PIC microcontroller...................................................... 21Figure 10: Complete PSpice layout of the nightlight .......................................... 23Figure 11: Project tasks Gantt chart ................................................................... 34Figure 12: Deliverables Gantt chart .................................................................... 35

iv

Page 6: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

List of Tables

Table 1: Basic input/output of a PIC microcontroller........................................... 22Table 2: Complete component listing of the automated nightlight....................... 24Table 3: Original personal effort requirement in terms of time ........................... 29Table 4: Revised personal effort requirement in terms of time ........................... 29Table 5: Actual personal effort requirement in terms of time ............................. 29Table 6: Original required other resources .......................................................... 30Table 7: Revised required other resources ........................................................... 30Table 8: Actual required other resources ............................................................. 31Table 9: Original project cost with and without labor cost.................................. 32Table 10: Revised project cost with and without labor cost.................................. 32Table 11: Actual project cost with and without labor cost.................................... 33Table 12: Project milestones and overall importance........................................... 36Table 13: Milestone evaluation criteria................................................................. 37Table 14: Complete component listing of the automated nightlight.................... 38Table 15: Estimated selling price of the nightlight.............................................. 39

v

Page 7: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Terms and Definitions

120 V AC – Refers to 120 volts alternating current. This is the standard voltage for household outlets.BJT – Bi-polar junction transistor.Cadence – A circuit layout design program.IrED – Infrared light emitting diodes.LED – Refers to light emitting diodes. A device that emits light at the presence of current.mA – Milliamperes.PCB – Printed circuit board. Refers to what the circuit will be placed on at time of production.NiMH – Nickel metal hydride.PICmicro® - Brand of microcontroller. PSpice – A circuit design program.RoHS compliant and Pb free – Restriction of use of hazardous substances and lead free.MOSFETs – Metal oxide semiconductor field effect transistors.DC – Direct current.AC – Alternating current.mAh – Milliamp hour.Foundry – Location where semiconductor devices are made.Cadence® - Circuit simulation program.

vi

Page 8: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

1. Introduction Materials

This section will introduce the project, including the executive summary, acknowledgements, problem statement and solution, operating environment, intended users and uses, limitations and assumptions, expected end-product and other deliverables.

1.1 Executive Summary

The objective of this project was to design a low cost, high efficiency automated nightlight. Although there are many nightlights that are already on the market, that require frequent user interaction, the team has enhanced the nightlights characteristics therefore, creating a more efficient nightlight for the hallway of a home or apartment.

This nightlight needs very little user interaction and thus making it easy on the user. The nightlight has the ability to detect motion on a 180 degree plane. The nightlight also has the ability to determine whether a person is moving closer or further away; therefore adjusting the light intensity accordingly, and the ability to distinguish between daytime and nighttime. Finally the nightlight provides a delay before shutting off in case of a person returning to the room.

After the team defined the set of limitations to follow, research was conducted to look for anything available that would aid in the creation of this project. The team found many sources that proved to be very helpful. Upon completion of the research, the team selected the best approach and best products available to complete the project.

Following the decision of what is to be used, the building and the testing of the sub-circuits was done. This was done to limit the number of errors that may have occurred in building the final circuit. Also, this allowed for more extensive testing in that if each circuit functioned properly alone, it would then be placed into the main circuit and tested along with the rest of the design.

The final result is a nightlight that does what is expected. During the day hours when ambient light is present, the nightlight is off. As soon as this light source becomes non-existent, three lights come on at a very low level to illuminate a very small area. As soon someone approaches the nightlight, all lights will come on and be at a higher level producing light to illuminate a hallway.

The suggested follow-on work is that the design be simplified and made smaller. There may be some parts of the nightlight that does may not need to be included in a future model. Also, a more modular design that could be

1

Page 9: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

taken to different countries on moments notice and operate correctly. The final recommendation is making the nightlight smaller. The dimensions mentioned in this report may be larger that what some people may want. By doing this, it will be more appealing to the potential buyer.

1.2 Acknowledgement

The design team would like to personally thank our faculty advisor, Dr. Degang Chen and Iowa State University for giving us the opportunity to create the product. The team would also like to thank Dr. Chen for his technical advice, time, and effort in overseeing the project. The design team would also like to thank Dr. Jacobson and Dr. Tuttle for their technical advice involving microcontrollers, MOSFET’s, and circuit analysis.

1.3 Problem Statement

The problem statement is broken up into two separate sections; one that defines the general problem area and another that describes the proposed approach to the solution.

1.3.1 Problem Statement

Many nightlights offer a small amount of light which are used in many rooms of a house. Nightlights that are presently available are very simple but require frequent user interaction. However, there may be cases where interaction is not available but a light source is needed.

1.3.2 Problem Solution

The solution to the problem was creating a nightlight that automatically turned on and off as a person approached the nightlight; thus creating an illumination that provided the person with increased visibility. The project team developed a nightlight that needed very little personal contact.

1.4 Operating Environment

The end product will be installed in the hallway of a house or apartment. The nightlight should be kept at room temperature which is seventy degrees Fahrenheit; however, it can also be operated for a range of 45-90 degrees Fahrenheit. A high moisture environment can be hazardous for the nightlight causing the sensor within the nightlight to not be able to distinguish if a person is coming or going. Also, little children should not be allowed to play with the nightlight because any outside stress could cause the sensor to

2

Page 10: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

become damaged. Finally the nightlight should be cleaned from time to time because of dust collecting on or around it. The nightlight is not required to work in instances of catastrophic events.

1.5 Intended User(s) and Intended Use(s)

This section is divided into two parts, one to cover the intended user(s), and the second is to cover the intended use(s).

1.5.1 Intended User(s)

The automated nightlight is intended for any people of any age who owns, rents or lives in his/her own form of housing.

1.5.2 Intended Use(s)

This automated nightlight is intended to be low cost and highly efficient. The nightlight stays on bright as the user enters the hallway and slowly go to dim as the user is leaving in an optimizing manner; therefore creating an environment where the user does not have to worry about turning on/off the light. The nightlight is not intended to be used as a main light source for a room such as a ceiling illumination. Also the nightlight is not intended to be used on the outside of the house; therefore increasing its chances of being damaged by outside sources. This nightlight is built for the hallway of the home or apartment.

1.6 Assumptions and Limitations

This section contains the assumptions and limitations of the project.

3

Page 11: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

1.6.1 List of Assumptions

The following is a list of assumptions that the team developed as a guideline for completing the project.

The end product could be used all over the world, thus allowing everyone to utilize this product.

The end product could be used for other rooms other than the hallway. This will create more features that will enhance the nightlight’s uses.

The nightlight could be used within office buildings The final product could be built into homes. The product could force some lights within a home to be designed

the same way. More lights within the home will share the same features as the nightlight.

1.6.2 List of Limitations

The following is a list of assumptions that the team developed as a guideline for completing the project.

The cost to purchase this product will not exceed twenty dollars, thus allowing the product to be competitive with the market.

The nightlight will only work in a certain range of temperatures (45-90 degrees Fahrenheit).

The sensor within the nightlight may not be able to sense small animals, due to the height of the wall socket.

The angle of detection is limited to only 180 degrees. The nightlight will only be able to operate between eighteen and

twenty-four hours without the AC power. The nightlight is about 2”H x 3”L x 4”W in size and about two

pounds in weight.

1.7 Expected End-Product and Other Deliverables

The expected end product was a small automated nightlight used for the hallway of a home or apartment. The sensor within the nightlight sensed a person coming and going within the given area. The light brightened as a person walked closer to the light and dimmed slowly as a person walked away from the given area. The nightlight remains on dim during night time hours.

Along with the physical product, this project produced two written documents: a design document and an end-user operating manual. Upon the finalizations of the project, the final report encompasses the entire project.

4

Page 12: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

The design document shall include system design rationale, functional description and mechanical design information. It has already been delivered to the intended user.

The end-user operation manual provides instructions of the operation of the device and its care and maintenance. It was written in a non-technical manner. It too was also delivered to the intended user.

The final report entails all details about the project description and how the nightlight operates.

2 Project Approach and Results

The purpose of the project approach and results is to explain in detail the exact purpose of the project, functionality, approaches considered, detailed design, implementation, testing and the end product results of the project.

2.1 Functional Requirements

This section sets the functional requirements of the automated nightlight. The items listed is what the end project is able to do.

2.1.1 Ambient Light Detection

The nightlight will be able to detect ambient light. This feature will determine the initial operating state of the nightlight. If there is an external light source detected, the nightlight will remain off. The moment that an external light source is no longer present, the nightlight will shift operation states and the nightlight will become active.

2.1.2 Movement Detection

In order for the nightlight to operate correctly, there needs to be movement within the range of the detectors. At the moment the detectors sense a moving object, the nightlight will slowly illuminate the area.

5

Page 13: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.1.3 Back-up Power Supply

For emergency situations, a back-up battery has been implemented into the nightlight. At the moment in which the 120V AC power supply is no longer present, the nightlight will switch to a battery supply. This supply will operate the nightlight for a period of time before the battery supply has been exhausted or the 120V AC supply has been returned to the nightlight.

At the moment that the 120V AC power supply is gone, the 9V battery will become the main power source for the circuit. This is the same type of battery used in household smoke detectors.

Upon switching to the battery supply, the nightlight will operate at approximately at 60% capacity. The nightlight will work, but illumination by the nightlight will decrease.

2.1.4 Illumination

Upon detection of movement, the nightlight will increase the amount of light emitted. The nightlight will use a bank of light emitting devices to illuminate the area.

2.1.5 Control Circuit

There are a series of different input and output signals that have to be manipulated and analyzed. The control circuit will be designed by the team to operate as specified in the project requirements.

2.2 Functional Design Constraints

This section will list the constraints that the team recognized while designing the nightlight.

2.2.1 Size

In order to make the nightlight competitive on the market, the nightlight must be comparable in size to those already available. This serves as the biggest constraint because the team requires a DC voltage sources for correct operation. The final project shall not exceed the following dimensions: 4”x3”x1 5/8”. Figure 1 shows the frontal view of the nightlight. Figure 2 shows the expected top down view of the nightlight. The side view of the nightlight will have no features worth showing.

6

Page 14: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Figure 1: The frontal view of the nightlight.

Figure 2: The top down view of the nightlight.

Blue-green LED

Infrared SensorIrED

Front View

LDR

Top View

7

Page 15: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.2.2 Power Consumption

Another item to make the nightlight competitive in the market is to reduce power consumption. To make the nightlight competitive, the circuit will use components that require very low voltage consumption. Also, the nightlight when not active will move into a lower operating state consuming less energy.

2.2.3 RoHS compliant and Pb Free

This requirement was set forth for safety reasons. Since there may be children present, all parts that will be used will be RoHS compliant and Pb free. This will reduce the chances of toxic fumes being emitted from the device in case of fire or over heating.

2.2.4 Ease of Use

This nightlight is intended for use by anyone who inhabits in any living arrangement with little or no technical knowledge.

2.2.5 Maintenance

The nightlight must require very little maintenance. The only maintenance that needs to be done is making sure the batteries work and occasional cleaning of the nightlight.

2.3 Technical Approach Considerations

In order to create the nightlight, many technological options must be chosen. The technical approach of the nightlight will include the decision on what kind of technology, the advantages of that particular technology, the selected approach and why that technology was chosen.

2.3.1 Motion Detection

Motion detection was the initial approach for operating the nightlight. There are three technologies that have been considered detecting motion in the required 180 degree plane.

2.3.1.1 Infrared Detection

This was considered because it is very cheap and the sizes of the components used are relatively small. This approach

8

Page 16: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

was considered because it will allow for distance detection. The IrED will be able to determine whether something is leaving or approaching the nightlight.

The disadvantage of this is that if the component fails to operate correctly, it may be more difficult to replace the parts.

2.3.1.2 Sound Detection

Sound detection was considered because it will look for sound movements in the field. This selection would emit sound waves into the field and look for something to bounce the signal back to the device. This would be favorable because it operates similar to things that are already on the market.

The downside of this is that the size of the module exceeds the dimension restrictions that the team has developed. The complexity of implementing this component would be far to complicated for such a simple application.

2.3.1.3 Body Heat Detection

The human body emits a certain infrared wavelength. The detection of human heat would allow for differentiation between inanimate objects, pets and heating ducts. There is a device that is made to detect the human body specifically and will ignore other hear sources. This is favorable because it will detect exactly what the team wants. It will also simplify the design of the nightlight as well.

The downside is that this device will also exceed the dimensions the team has set for this project. The cost of the device would have been outside the allowed budget.

2.3.2 Illumination

The nightlight will have to light the hall in the presence of movement. There are three different types that are available to illuminate the desired area.

9

Page 17: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.3.2.1 Fluorescent

Fluorescent light has become ever more common in homes today. This type of lighting is very useful because it will operate at lower voltages and has a very long life-time.

The downside to this solution is that the bulb size would be considered overkill for a nightlight. The size and the amount of light produced would not be needed.

2.3.2.2 Solid State Devices

Solid state devices, such as LED’s are considerably smaller and do not need much power to operate. This favors the constraint for keeping size down and well as limiting power consumption.

The downside to this is that if something happens to one of the LED’s it will be difficult to repair. The illumination that an LED may offer may be too bright for the human eye during the night hours.

2.3.2.3 Incandescent Light Bulbs

Incandescent light bulbs were considered because of the wide array of selections. These light bulbs also allow for quick replacement.

A quick downfall of incandescent light bulbs is power consumption. As the life of the bulb lengthens the amount of current required to light the bulb will increase. In turn, it will increase the amount of power needed for the circuit.

2.3.3 Control Circuit

In order for the nightlight to operate correctly, there will need to be a set of controls included. These controls will dictate the overall operation and “decision making” of the nightlight.

2.3.3.1 Circuits

Everything for the control circuit can be done in an analog design using different components. Since the team is comprised entirely of electrical engineers this approach would be beneficial. Using the knowledge of circuits the

10

Page 18: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

team could design a set of circuits that will cause the nightlight to operate correctly.

The team is limited to components that have been used in previous classes. It is very difficult to implement components that the team has never worked with. This may delay the overall design of the nightlight. Using analog component may also increase the size of the nightlight and extend it beyond the limits the team has set forth.

2.3.3.2 Microcontroller

A microcontroller is a device that works on a digital signal. Microcontrollers can take a series of commands and do exactly what the team programs it to do. This will eliminate the need for an analog circuit.

The negative of this is that the team has limited knowledge of programming. There are a vast number of microcontrollers available and time spent researching the device that will best fit the teams goal may be difficult and may delay the designing of the circuit.

2.3.4 Power Supply

This nightlight requires two types of power sources, AC that will be converted to DC and a DC battery back-up. This will ensure operation of the nightlight at all times.

2.3.4.1 Battery Back-up

A requirement for this nightlight is to have a battery back-up. Since this is a requirement, the aspects of this needed to be considered. The battery back-up has to be able to power the circuit for a lengthy period of time before being considered dead. An advantage is that it will allow for operation incase of a power outage. It also may allow for recharging the batteries that are designed for recharging, such as NiMH batteries.

The addition of a battery will push the nightlight to maximum size. The batter unit will take the majority of the device. The addition of a charging unit may also increase

11

Page 19: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

the size of the nightlight beyond that of what the team has designated.

2.3.4.2 Power Source

The main power source of the circuit will be a 120V AC, available from the wall outlet. This source will need to be converted to a DC form because many of the components used need a DC source to operate. This will require the AC voltage to be stepped down and rectified to DC. The beneficial part is that there are circuits available to do these conversions.

The downfall is that the size of these circuits that are available may be too large for the team’s dimensions. The team may have to build a circuit that is capable of handling 120V AC and converting it to a DC source.

2.3.5 Daytime Operation

The nightlight is required to go off during the day and turn on during the night. There were a few considerations the group used to approach this.

2.3.5.1 Internal Timer

In order to use an internal timer, there must be a clock in the circuit that never loses track of time. This will allow the user to plug in the nightlight and set a time for the nightlight to turn on and off.

The use of an internal timer would increase the difficulty of the nightlight. It may also be very complicated to implement and design. There could also be a chance that the implementation is wrong and the circuit would not operate correct.

2.3.5.2 Phototransistor

A phototransistor can detect the presence of light. This device can easily detect whether or not ambient light is present. This will allow for proper operation. A phototransistor is very small in size and requires minimal power to operate.

12

Page 20: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Since a phototransistor is so small, it is very susceptible to damage. This will them make it hard for repairs.

2.3.5.3 Photoresistor

A photoresistor operates similarly to a potentiometer but instead of needing to set the potentiometer to a value, light will do that automatically. As light shines on the photoresistor, the resistance becomes smaller and a signal can be passed through to the rest of the system. If there is no light present, the photoresistor will have a higher resistance indicating that there is no light present and no voltage will be passed. This component is rather cheap and is simple to implement.

The downside is that it may encounter problems with the lighting of the hallway from the nightlight itself. Also, if the photoresistor is not properly chosen, it may not turn on and turn off at correct moments during the day and the operation may not be as expected.

2.3.6 Approach Selected

This section will briefly describe each of the approaches selected from those listed in the previous section

2.3.6.1 Motion Detection

The method of detection that was chosen was infrared detection. Even though detection of the human infrared signal is very favorable, the device is too large for the project. Infrared LED’s and detectors allowed the best method of detection while not contributing too much to the size.

2.3.6.2 Illumination

Even though fluorescent and incandescent lights are readily available, LED’s allowed for optimal way of illumination. The LED’s was selected because power consumption is low and LED’s will not contribute much to the overall size of the circuit.

13

Page 21: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.3.6.3 Control Circuit

The microcontroller was selected for implementation because of the amount of simplification that is done to the circuit. The team favored circuits because of a strong back ground; a microcontroller can offer the same functionality at a considerably lower size.

2.3.6.4 Power Source

The power supplied to the nightlight will be done in two different fashions, depending on the status of the 120V AC wall source. The wall source will be stepped down to a 10V source that will be used throughout the circuit.

In case of a power outage, the battery back-up will only be a regular battery supply. The battery back-up will be a standard 9V dry cell battery. The rechargeable battery was dismissed because the size of the recharging circuit alone would exceed the dimensions set by the team.

2.3.6.5 Daytime Operation

The photoresistor was selected to be used to determine whether there is ambient light present. This was selected because it will allow for the larger, more sensitive detection range.

14

Page 22: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.4 Detailed Design

This section covers all the specific details of the final design for the automated nightlight. This section includes all circuit diagrams, part numbers, final parts cost total, and all calculations required configuring and selecting components. The majority of the functionality for this nightlight strongly relies on the microcontroller. This will be the ‘brain’ of the system, and provide signal control. Therefore, each part of this detailed design will have a connection to the microcontroller. This section is divided into the five main components of this project. Each portion contains subcomponents needed for completion. The system flow diagram further relates these components in Figure 3.

Power supply AC to DC step-down power supply Auxiliary Battery Comparator circuit for power sequencing

Light Sensor LDR (light dependant resistor)

Infrared Infrared transmission Infrared detection

Light emitting diodes High illumination diodes

Microcontroller

Figure 3: The basic flow diagram of the nightlight circuit.

15

Page 23: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.4.1 Power Supply

The power supply consists of three main parts. The primary power supply reduces and rectifies standard 120 V AC current down to 12V DC. The secondary (back-up) power is a standard sized 9V DC. The primary source of electricity is a common low current power supply configuration with a full wave rectifier, filter capacitor and voltage regulator. Figure 4 is the general interpretation of a transformer.

Figure 4: General interpretation of a transformer.

This alternating current is rectified through a bridge rectifier, and then filtered with a capacitor. Lastly, a voltage regulator is used set at 10V DC. This simple configuration provides suitable voltages and currents which do not exceed 250 mA as tested. Approximately 20mv of ripple can be seen on the output of the power supply; however this does not pose a problem. Physical size is a strong concern for the power supply; therefore the components chosen were selected with a minimum size criterion. Below is basic representation of the AC to DC conversion of the power. The cost of the power supply makes up a large portion of the total cost of parts for this project. Figure 5 shows the basic flow to convert AC power to a constant DC power.

The cost of components ~ < $8.00

Figure 5: AC to DC power conversion.

In the case of a power outage, this system senses the failure and switches to the battery backup power supply. A comparator circuit senses the absence of the primary power. The circuit utilizes n-channel and p-channel power MOSFET’s to handle the supply current, the sequencing

16

Page 24: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

is performed by the comparator IC. The 9V battery supplies around 500mAh which is sufficient to operate the system under power out conditions for around 4-20 hours depending on traffic passing the light.

Below in Figure 6 is the completed schematic of the power supply with the power sequence comparator circuit in line.

Figure 6: Complete power supply circuit.

There were no calculations performed for the power supply circuit as the data sheet for the comparator provided the needed components The final list of parts and values can be found at the end of this section in Table 2.

17

Page 25: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.4.2 Ambient Light Sensor

In order to remain efficient, this system does shut off in the presence of any ambient light source of certain magnitude. For instance, the light will remain in a low power state while in the presence of daylight from a window, or from household lighting. When the outside light source drops below a specified magnitude, the system returns to normal operation. The system utilizes a LDR (light dependent resistor) to control the gate of a p-channel MOSFET. When in a high light surrounding, this signal changes from high to low and provides the PIC with a sleep control signal. If the light source is of sufficient magnitude the photo circuit will send a signal to the microcontroller resulting in a ‘non-functioning’ low power mode. A configuration of the phototransistor is shown below. Note that R4 controls the amount of light needed to bias the MOSFET gate. The cost of this configuration is quite minimal at well under a dollar. Figure 7 shows the PSpice representation of this sub-circuit.

The cost of components ~ << $1.00

Figure 7: LDR Ambient light detection circuit.

2.4.3 Infrared Transmission and Detection

The human sensing capabilities of the system chosen are realized by sending an infrared signal to moving objects and receiving the reflection. The sensing network will consist of two parts, the transmitter and the (receiver) detector circuit.

18

Page 26: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.4.3.1 Transmitter

The transmitter of the circuit utilizes two infrared signal diodes. Approximately a 5 kHz signal is generated by the microcontroller and transmitted simultaneously by both diodes. The diodes are spaced from each other across the front of the light housing in order to maximize the coverage of the infrared illumination. The logic capabilities of the microcontroller allows for a simple program function to oscillate the LED’s. By using a simple calculation also shown below the values of the resistors were set to limit the current to around 15mA.

R=(Vsource – Vdrop across diode)/(Desired current)

The cost of components ~ << $1.00.

2.4.3.2 Detector

The detector of this system is comprised if two infrared sensing circuits to detect to the returning infrared signals reflected from a human or other moving object. The received signals are then sent to the microcontroller where they are digitally converted by on board A/D converters, and then compared for any changes in the field of interest.

These two sensing circuits are identical, therefore, only a single version of the circuit will be discussed. The circuit utilizes a phototransistor to sense the infrared light. The phototransistor is sensitive to infrared light around 950nm, matching the wavelength of the infrared diodes. The signal is fed into a bandpass filter realized with an op-amp. This filter extracts the original 5 kHz signal from any other noise that may be present. The low and high end cut-off frequencies are calculated below.

- Flow = (2 * pi * (R) * (C)) = (2 * pi * 100 * .047uF) = ~ 3000Hz

- Fhigh = (2 * pi * (R) * (C)) = (2 * pi * 100 * .047uF)= ~ 16000Hz

After any 5 kHz components are selected from the incoming signal, they are sent to a comparator circuit. This comparator controls the sensitivity of detection with an operational amplifier and then compared to a preset value in which controls. The comparator circuit uses a very common op-amp

19

Page 27: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

comparator orientation. This signal is sent to the microcontroller to be converted and tested as previously stated. When there is a change in the infrared field, the microcontroller will detect the differences across two of these detector circuits. A representation of one of the detector circuits is shown below. Note that the potentiometer will be used to find the correct level of ‘change’ that is needed for human detection to occur. This value will then be replaced by a permanent resistor of the appropriate size. Figure 8 shows the schematic of the detector that is used for the nightlight.

The cost of components ~ << $3.00

Figure 8: The basic layout of the sensing circuit that will be used.

2.4.4 Illumination LED’s

When the presence of a human is detected, the area of interest must be illuminated with visible light for human convenience. When a human is detected by the sensors, the microcontroller sends a signal to one of two led networks, or both depending on the power requirements. In a state of a power outage, only three LED’s are illuminated, otherwise all five LED’s are illuminated. Three different levels of light intensity are required, off, low, and high intensity light. The level of light intensity allows for a somewhat gradual change from dark to bright conditions, and will be controlled by the microcontroller. In order to limit the

20

Page 28: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

current through the illumination LED’s, the calculation shown below was performed, and the current is limited to 15mA.

R=(Vsource – Vdrop across diode)/(Desired current)

These five LED’s will be evenly spaced across the front of the light housing and directed in a downward direction. The area of interest can then be illuminated with high intensity blue LED’s. The reason for choosing this color is because blue tends to permeate well in dark conditions while being easy on the eyes. A circuit layout or the led switching network provided below.

The cost of components ~ << $2.00

2.4.5 Microcontroller

As mentioned throughout this document, this system relies upon an on board microcontroller to manipulate numerous signals. This embedded chip is programmed to perform all logic functions for this project. Due to the availability, vast amount of resources, low cost, and high capability; a PICmicro® 8-bit microcontroller was chosen. More specifically, a model of the PIC16F family has been selected. This controller is housed in a chip with 18 pins designated to digital I/O. The chip contains sufficient non-volatile memory to store the source code, which is being written in assembly or C. The reference drawing with the pin layout for a PICmicro® is provided in Figure 9. The basic input/output chart is provided in Table 1. For further and more detailed information on the programming and I/O control of the PIC microcontroller, please refer to Appendix A.

The cost of components ~ $2.00.

Figure 9: Pin layout of a PIC processor.

21

Page 29: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 1: Simplified input/output of a PIC processor.Input Output

1. Input signal from ambient light detector

Power state condition

Signals from IR detectors. Output corresponding light condition and intensity level

Non Input Regulate the duty cycle of Both visible LED’s, infrared LED’s: Preserve efficiency.

Non Input Allow for a delay when ‘lights out’ condition happens

2.4.6 Circuit Layout

The final design has been implemented with computer modeling, as well as a prototype model using a prototype board. However, work on the final PC board layout and constructing is still in progress, and will be finished in a short matter of time.

Values, implementation difficulties, and logic difficulties have all been slightly overestimated in order to enable the possibility of alternatives in the future.

The current completed PSpice circuit layout is provided in Figure 10.

22

Page 30: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Figure 10: Complete PSpice layout of the nightlight.

2.4.7 Completed Parts List

In order to build this circuit, a parts list needed to be comprised. In Table 2 is the complete listing of each component that is used to build the circuit.

23

Page 31: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 2: Complete component listing of the automated nightlight.Component List

Part Description Schematic Label Part Number Value Tolerance

Transformer NA 41PG300 120v primary | 12v secondary NA

Sequence Comparator U1 MAX6820 NA NA

Voltage Regulator U4 LM317T 10 Volts NAN Channel MOSFETs Q1 FDC633N NA NAP Channel MOSFETs Q2 FDN304P NA NA

Microcontroller U1 PIC 16LC71 NA NACrystal Oscillator Y1 NA 20 MHz NA

Resistor 1 R1 NA 4.7K Ohms 5%Resistor 2 R2 NA 1.2K Ohms 5%Resistor 3 R3 NA 10M Ohms 5%

Battery V2 NA 9 Volts NACapacitor 1 C1 NA 0.1uF 5%Capacitor 2 C2 NA 470uF 5%

Mosfet Q3 2N5464 NA NALDR R4 NA 100 – 1 meg NA

Resistor 5 R5 NA 4.7 K Ohms 5%Resistor 6 – 10 R6 – R10 NA 300 Ohms 5%Resistor 11 -12 R11 – R12 NA 200 Ohms 5%

Diode 1 D1 NA NA NARectifier D2 NA NA NA

Illumination Diodes D3 – D7 NA NA NAInfrared Diodes D8 – D9 NA NA NA

NAInfrared Detector Parts List

LM 324 1 – 2 U2 – U3 NA 0 – 10 Volts NAPhototransistor Q1 Q2N2222 NA NA

Resistor 1 R1 NA 2K Ohms 5%Resistor 2 R2 NA 100 Ohms 5%Resistor 3 R3 NA 22 K Ohms 5%

LDR R5 NA 50 K Ohms NALDR R6 NA 100 K Ohms NA

Capacitor 1 C1 NA .47uF 5%Capacitor 2 C2 NA 220pF 5%Capacitor 4 C4 NA 0.047uF 5%

Diode 1 D1 NA NA NA

24

Page 32: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

2.5 Implementation Process

During the implementation process, problems were encountered and solutions were found. During the initial design process, many components were wrongly selected. After computer modeling, many devices proved incompatible with the design. In order to solve these issues, the team worked with faculty from Iowa State University, and began to rely more heavily on provided data sheets.

The microcontroller has also caused delay in our completion of the project. The first model that was ordered was not in the correct package. After acquiring the correct controller, the programming stage was also put on hold due to problems with the software and programmer provided in the senior design laboratory. These problems have not been totally resolved; the proper people have been notified to make the repairs. In the mean time we are using computer simulations to represent the microcontroller in our design.

Prior testing of the infrared detection circuit proved to be difficult without actual physical testing. Simulating the analogous portion or the sensors was simplified by constructing prototype circuits and testing them in a laboratory setting. With help from faculty and peer students, our team began to simplify our testing process by implementing the majority of the testing with simulation programs such as Cadence®.

2.6 End-Product Testing

The nightlight underwent testing to verify operation. The different testing iterations are listed below. Each tester will receive a copy of the instruction manual for referencing. The instruction manual is located in Appendix B.

2.6.1 Testing Environment

A number of different hallway environments were used in testing the operation of the nightlight. Please note, these testing environments will not include the length of a hallway unless otherwise specified.

2.6.1.1 Narrow Width Hallway

A narrow width hallway, with a width no greater than 3.5 ft., while being optimal for detection, may cause the nightlight to be ‘tricked’ into determining whether a user is present. This testing environment has been tested by the team and by individuals outside the team.

25

Page 33: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

The nightlight was also tested if a user passes in front of the nightlight and passes back in front of the nightlight moments later.

The success of the testing will be based on the form that the tester will fill out. This form is located in Appendix C.

2.6.1.2 Wide Width Hallway

Hallways with a wide width, greater than 3.5 ft. but no larger than 7 ft., may cause more difficulties in detection. The field of detection area may need to be increased to account for this distance. Use in any hallway larger than 7 ft in width may cause the nightlight not to perform as expected. This testing environment has been tested by the team and by individuals outside the team.

The nightlight was also be tested if a user passes in front of the nightlight and passes back in front of the nightlight moments later.

The success of the testing will be based on the form that the tester will fill out. This form is located in Appendix D.

2.6.1.3 Battery Back-up Testing

As part of testing the nightlight, each tester is asked to ‘kill’ that outlet. By doing this, it will test whether the battery back-up circuit works properly. This will be done in addition to the hallway testing described in previous sections.

The success of the testing will be based on the form that the tester will fill out. This form is located in Appendix E.

NOTE: The tester must willingly agree to ‘kill’ the outlet and is not forced to do so. The tester must also read the disclaimer if they choose to test this portion. Disclaimer is located in Appendix F.

2.6.1.4 Illumination Testing

The illumination testing will consist of two different phases. The first, the tester will report whether the light

26

Page 34: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

emitted by the nightlight is too bright, not bright enough or just right.

The second phase is whether the right number of LED’s is on. It is recommended that the tester who tests the battery back-up also tests this phase. If the 120V AC source is still available, all five LED’s should be lit up. If the nightlight is operating on battery back-up only, there should only be three LED’s lit up.

The success of the testing will be based on the form that the tester will fill out. This form is located in Appendix G.

3 Resources and Scheduling

This section will include details of all costs associated to complete this project. The resource requirements can be separated into three major parts, which are: personal effort requirements, other resources requirements and financial requirements. Since these three parts have previously been covered in the project plan and design report, an actual version for each part will be compared to the revised case as listed in the design report. The difference between revised version and actual version will also be explained. This actual version contains the real and accurate resources and scheduling details for the whole project.

3.1Task Definition

The following defines the tasks that will be completed to ensure completion of the project.

3.1.1 Task A: Project Definition

Understanding the functionality of product. Product is assumed to operate in certain circumstances and its limitation. Consult with advisor about the feasibility of project.

3.1.2 Task B: Technical Consideration

List the choices of technologies that can be used in product design. Select the best and feasible approach. Do extensive research on published technical paper and related material from library.

3.1.3 Task C: Design Process

Start with hand calculation on parameter value of device. Device circuit simulation using CAD tools such as PSpice, Cadence.

27

Page 35: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

28

Page 36: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

3.1.4 Task D: Product construction and implementation

Layout out of printed circuit board and integration of various parts.

3.1.5 Task E: Product Testing

Testing of product on previously specified specification and limitation.

3.1.6 Task F: Product Documentation

Documentation of the product in an on-going task that will span the entire project. This includes all the details analysis of product design.

3.1.7 Task G: Product Demonstration

Demonstrate the functionality of device to client and advisor.

3.1.8 Task H: Product Reporting

Full report covering the details of whole process.

3.2 Personal effort requirements

This section includes the details in personal effort requirement. Personal effort requirements give the detailed amount of time (hours) spent on this project by each member. For each member, the time spend will be shown for each and all the tasks. Three versions are available, the first version is the original version on project plan, and second version is the revised version on design report. The third one which is also the latest version is the actual personal effort that is spent on this project. Table 3 shows the original number of hours that were expected to be spent on the project. Table 4 shows the revised number of hours that may be required to finish the report. Table 5 shows the actual hours spent on this project. From Table 5, it can be seen that the time spent on task D or product construction and implementation has increase of 11 hours or 8%. This is mainly caused by the problem caused by the microcontroller programmer. The microcontroller wasn’t installed properly delay and caused the delay. Hours were wasted on trying to fix the programmer but unsuccessful. The programmer was eventually fixed by the staff from CSG.

There is about 50% decreased on time spent on product demonstration. It was determined that the estimated time on demonstration was too long. The demonstration should take no more than 3 hours per person if the part on product testing is completed without unexpected problem.

29

Page 37: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

The actual total hours spent in this project is 741 hours which is 12 hours lower than the estimated value.

Table 3: Original personal effort requirement in terms of time.Personal Name Time consumption for various tasks in hour

A B C D E F G H TotalWesley Adreon 6 17 78 30 12 18 9 11 181Dantrayl Smith 8 23 75 29 10 15 10 14 184Andrew Cook 8 19 81 31 14 16 8 13 190Kong-Wei Soon 7 17 74 35 13 17 7 12 182Total 29 76 308 125 49 66 34 50 737

Table 4: Revised personal effort requirement in terms of time.Personal Name Time consumption for various tasks in hour

A B C D E F G H TotalWesley Adreon 6 28 81 34 11 13 6 11 190Dantrayl Smith 8 23 79 32 13 13 6 10 184Andrew Cook 8 27 82 33 15 14 7 11 197Kong-Wei Soon 7 21 76 28 13 16 6 15 182Total 29 99 318 127 52 56 25 47 753

Table 5: Actual personal effort requirement in terms of time.Personal Name Time consumption for various tasks in hour

A B C D E F G H TotalWesley Adreon 6 28 81 36 13 11 3 9 187Dantrayl Smith 8 23 79 32 11 13 3 11 180Andrew Cook 8 27 82 34 15 11 3 12 192Kong-Wei Soon 7 21 76 36 15 13 3 11 182Total 29 99 318 138 54 48 12 43 741

3.3 Other required resources

This section includes the details on other required resources. Other required resources includes lists of electrical part and material that were required to build the complete product.

Three versions are available, the first version is the original version on project plan is shown in Table 6; second version is the revised version on design report in Table 7. The third version which is also the latest version contains the actual value of required resources is in Table 6.

30

Page 38: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 6: Original required other resourcesItem Cost by individual part Cost by category

Project poster $ 40.00 $ 40.00Electronics parts:SolderPCB board-2200 holes Red led with holder x 6PCB etchant0.25W resistor x 509 V Battery

$ 4.19$ 4.29$11.94$ 4.29$ 5.29$ 2.00 $ 32.00

Plastic case $12.00 $ 12.00Totals $ 84.00

Table 7: Revised required other resourcesItem Cost by individual part Cost by category

Project poster $ 44.00 $ 44.00Electronics parts:PCB board-2200 holesPIC MicrocontrollerInfrared LEDs (2)Infrared Sensors (2)LEDs (5)9 V BatteryPower transformerBridge Rec.BJT Switches (4)Photo TransistorVoltage RegulatorPassive ComponentsCrystal

$ 4.29$ 3.00$ 1.00$ 2.00$ 2.00$ 2.00$ 3.00$ 0.50$ 2.00$ 0.50$ 1.00$ 1.00$ 2.00 $ 24.29

Plastic case $12.00 $ 12.00Totals $ 80.29

31

Page 39: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 8: Actual required other resourcesItem Cost by individual part Cost by category

Project poster $ 48.00 $ 48.00Electronics parts:PCB board-2200 holesPIC16F84 MicrocontrollerInfrared LEDs (2)Infrared Sensors (2)LEDs (5)9 V BatteryPower transformerBridge Rec.BJT Switches (4)Photo TransistorVoltage RegulatorPassive Components20 MHz Crystal

$ 4.55$ 3.00$ 1.50$ 2.00$ 2.20$ 2.00$ 3.50$ 0.50$ 2.00$ 0.50$ 1.00$ 1.00$ 2.00 $ 25.75

Plastic case $12.00 $ 12.00Totals $ 85.75

Table 8 shows that the total actual required other resources is $85.75, which is $5.46 or about 7% higher than the revised value shown on Table 7. The reason is mainly due to underestimate on poster cost. The poster cost $4.00 more than estimated. The actual costs on all other parts stay almost the same as revised value on design report except small changes on PCB board and infrared LED.

3.4 Financial Requirements

This section covers in detail the financial requirement of this project. Its original version and a revised version are given in Table 9 and Table 10 respectively. The actual financial requirement is shown on Table 11. Each table gives the total cost without considering labor cost and total cost with labor cost included. The labor rate used on three versions stay the same at $11.50 per hour. Due to the changes in hours spent on project, the labor cost was varied from one version to the other version. Table 11 gives the total labor cost at $8521.50. The decreased on labor cost is proportional to the decreased on total time spent on project. There is 10% increase on the financial requirement without labor. This is due to increased in higher poster cost and extra postage cost. The increased in postage cost was due to purchasing of extra electrical components.

From Table 11, actual financial requirement without labor is $99.79 and actual financial requirement with labor cost is $8621.29.

32

Page 40: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

The reason to included total financial requirement with the labor cost is because of opportunity cost. Including of labor cost reflect a more realistic cost in completing this project.

Table 9: Original project cost with and without labor cost.Item W/O labor With Labor

Miscellaneous electronic partsPosterPostagePlastic case

Subtotal

$ 32.00$ 40.00$ 7.00

$ 12.00

$ 91.00

$ 32.00$ 40.00$ 7.00$12.00

$ 91.00Labor at $ 11.50/hr$ Wesley Adreon $ Dantrayl Smith$ Andrew Cook$ Kong-Wei Soon

Subtotal

$ 2081.50$ 2116.00$ 2185.00$ 2093.00

$ 8475.50Total Project Cost $ 91.00 $ 8566.50

Table 10: Revised project cost with and without labor cost.Item W/O labor With Labor

Miscellaneous electronic partsPosterPostagePlastic case

Subtotal

$ 25.75$ 44.00$ 10.50$ 12.00

$ 90.79

$ 25.75$ 44.00$ 10.50$ 12.00

$ 90.79Labor at $ 11.50/hr$ Wesley Adreon $ Dantrayl Smith$ Andrew Cook$ Kong-Wei Soon

Subtotal

$ 2150.50$ 2070.00$ 2208.50$ 2093.00

$ 8659.50

Total Project Cost $ 90.79 $ 8750.29

33

Page 41: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 11: Actual project cost with and without labor cost.Item W/O labor With Labor

Miscellaneous electronic partsPosterPostagePlastic case

Subtotal

$ 24.29$ 48.00$ 15.50$ 12.00

$ 99.79

$ 24.29$ 48.00$ 15.50$ 12.00

$ 99.79Labor at $ 11.50/hr$ Wesley Adreon $ Dantrayl Smith$ Andrew Cook$ Kong-Wei Soon

Subtotal

$ 2185.00$ 2116.00$ 2265.50$ 2093.00

$ 8521.50

Total Project Cost $ 99.79 $ 8621.29

3.5 Schedule

The time allocation for each task in this project is presented in Gantt chart. The original version, revised version and actual version will be presented. Figure 11 shows the Gantt chart that shows the time span for each task in this project. From Figure 11, the actual product implementation has a later start date than the revised version. As a result of that the actual completion date for product implementation has also been delay for about three weeks. The reason for this is because the Dataman programmer was installed properly and thus the program couldn’t be burn into the microcontroller for testing.

For product documentation there is not much difference between revised version and the actual version. The product testing start date and completion date been delay because it is closely dependent on product implementation which was delay due to the Dataman programmer as mention earlier.

There is also a significant change on end product documentation. The time actual span for this task is more than 50% shorter than the revised version. The reason for this is the overestimate on the revised version. This task was completion in shorter time because our group has a better understanding on the whole design and implementation on the second semester and therefore allows us to document all the details easier than expected. The product reporting tasks for both semesters are identical for all three versions. The reason for this is because it usually takes long time in writing the report and our group was able to complete the task one day before the due date. There is no change on weekly project reporting because it is a part of the requirement of this course to turn in a report every week.

34

Page 42: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Figure 11 shows the original, revised and actual version of deliverable date for all required task. The actual deliverable for project was on September 23 which is also on the due date. The difference from the original deliverable date is mainly because the original deliverable date was purposely set to be two day earlier than the due date as a safety measure to meet the dateline. The revised deliverable date for design report is two days later than the original date is because the unavailable of support from advisor that went for conference on the week of September 7. The revised deliverable date for most of the future tasks have been set earlier about one to two days as a safety measure to meet the dateline incase there is any unexpected problem. There is no change for weekly email report because of course requirement to turn a report every week. All the revised deliverable date is base on current best estimate. The date will be changes if deem necessary. The deliverable chart is located in Figure 12.

Figure 11: Project tasks Gantt chart.

35

Page 43: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Figure 12: Deliverable Gantt chart.

4 Closure Material

The material included in this section is the closure material that will sum up the project.

4.1 Project proposed milestones and evaluation criteria

The proposed milestones are listed below, followed by the evaluation criteria used for this project. Table 12 shows the milestones and importance of each milestone. Table 13 shows the evaluation criteria that will be used to evaluate this project.

4.1.1 Problem Definition

In order for the team to design, test and build a prototype nightlight, the problem needs to be defined. This laid the blueprints of what the nightlight will do and how it operates.

4.1.2 Research and Technology

Upon completion of the problem definition, the research can begin for the project. The research included what nightlights are available, what circuits can be used for this design and what the current nightlights have to offer.

4.1.3 Design

After the preliminary design is completed, it must meet the standards set by the customer as well as the faculty advisor. Next all components must be selected. The components will be researched evaluated for acceptability. The proper completion of this milestone will result in a fully functioning design.

36

Page 44: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

4.1.4 Implementation

The design will be implemented using the components chosen. During this process, all components will be lab tested and compared with similar products. The components that show the highest efficiency, best functionality, and have the lowest relative cost will be chosen. This will be the first version of the nightlight available for testing.

4.1.5 Testing

During this process, the project will be tested to the standards set by the customer as well as the faculty advisor. The overall performance will be evaluated by testing the logic and the efficiency of the nightlight in different situations. This step will be considered successful if all criteria and design requirements meet or exceed the standards set by the client and the faculty advisor.

4.1.6 Documentation

This project includes many documents that are written by the team. This includes a project report, design report, project poster, final report and an instruction manual.

4.1.7 Demonstration

After all other aspects of this design process are completed; the final product will be demonstrated for all parties concerned. Proper completion of this milestone will entail a successful demonstration of the fully functioning automated nightlight.

Table 12: Project Milestones and Overall ImportanceMilestone Importance

Relevance Percentage Complete (%)

Problem Definition Medium 100Research and technology High 100Design Low 100Implementation High 100Testing High 100Documentation Medium 100Demonstration High 100

37

Page 45: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 13: Milestone Evaluation CriteriaEvaluation Result Numerical ScoreExceeded/Met 100%Partially Met 75%Did not Meet Standard 50%Did not Attempt 0%

4.2 Commercialization

The commercialization of the nightlight is based on different criteria that will make this nightlight competitive on the market.

4.2.1 End Product Cost

The end product cost will be the total for one nightlight to be produced. The end product cost includes all parts and materials needed for the construction of one nightlight. All parts listed in Table 14 are needed to complete one nightlight.

38

Page 46: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Table 14: Compete component listing of the automated nightlight.Part Description Part Number Value Tolerance

Transformer 41PG300 120v primary | 12v secondary NA

Sequence Comparator MAX6820 NA NA

Voltage Regulator LM317T 10 Volts NAN Channel MOSFETs FDC633N NA NAP Channel MOSFETs FDN304P NA NA

Microcontroller PIC 16LC71 NA NACrystal Oscillator NA 20 MHz NA

Resistor 1 NA 4.7K Ohms 5%Resistor 2 NA 1.2K Ohms 5%Resistor 3 NA 10M Ohms 5%

Battery NA 9 Volts NACapacitor 1 NA 0.1uF 5%Capacitor 2 NA 470uF 5%

Mosfet 2N5464 NA NALDR NA 100 – 1 meg NA

Resistor 5 NA 4.7 K Ohms 5%Resistor 6 – 10 NA 300 Ohms 5%Resistor 11 -12 NA 200 Ohms 5%

Diode 1 NA NA NARectifier NA NA NA

Illumination Diodes NA NA NAInfrared Diodes NA NA NALM 324 1 – 2 NA 0 – 10 Volts NA

Phototransistor Q2N2222 NA NAResistor 1 NA 2K Ohms 5%Resistor 2 NA 100 Ohms 5%Resistor 3 NA 22 K Ohms 5%

LDR NA 50 K Ohms NALDR NA 100 K Ohms NA

Capacitor 1 NA .47uF 5%Capacitor 2 NA 220pF 5%Capacitor 4 NA 0.047uF 5%

Diode 1 NA NA NAPCB Board NA NA NA

Plastic Case 100-1564 4”x3”x1.6” NAElectrical Prong 235300-1 Standard 2 prong plug NA

SwitchR13-602A-

05Standard single throw slide

switch NA

4.2.2 Market Selling Price

The market selling price of the nightlight will be comparable to those presently on the market. The current price of nightlights range anywhere from $5.00 to $30.00 depending on what the nightlight

39

Page 47: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

offers. Since this nightlight offers a little more functionality, the price will be more, but comparative on the market.

The market selling price calculation will include the man hours to assemble the nightlight, proper testing, packaging and shipping costs. Table 15 lists the estimated market cost including each section listed before.

Table 15: Estimated selling price for the nightlight.Description Reason CostAssembly 1 person, 0.5 hr, 11.50 hr. $5.75Testing 3 people, 1 hr/each, 11.50 hr $34.50

Packaging Proper packaging able for shipment $3.50Shipping To place product in store $1.50

Bulk Order reduction

For ordering more than 1 nightlight at a time

$-13.00

Total Projected cost $32.50

4.2.3 Potential Market

This nightlights functionality makes it very versatile and can be used in numerous locations. The prime market for this nightlight is in hallways, mainly between either bedrooms and bedrooms and bathrooms. But, is could be used in any room as long as the use of the nightlight is kept within the range of the detection field.

The market target can be anyone who lives in any type of housing that has a need for hallway illumination. The target buyer is anyone who is able to make purchasing decisions for a household.

4.3 Recommendations for Additional Work

The functionality this nightlight offers is very competitive to other in the market, but there is room for improvement. The section will list recommendations for additional work.

4.3.1 Battery Charger

Since there is a battery back-up present in the nightlight, it would be beneficial for the user that a charger for the battery be used. This would cut down on the use of dry cell batteries, and a safer, longer lasting NiMH battery can be used.

40

Page 48: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

4.3.2 Layout

The PCB board is the location of all components needed for the nightlight. Since the initial design done by the team may not be the most efficient, a company that produces the nightlight could redesign the layout of the PCB board for better efficiency and smaller size.

4.3.3 Fabrication

Since much of the components used are discrete components that need no special service, except the microcontroller, the nightlight could be made in a much smaller fashion. If someone were to produce the nightlight and had access to a foundry, the nightlight could be fabricated in surplus. The only extra component that would need to be handled separately is the microcontroller.

4.3.4 Personalization

Another recommendation is to add a physical interface which will allow the user to preset or configure the night light to operate at their personal preference. The output intensity for various stage of the night light is preset by the designer. As a designer the light output intensity is set to be the level which is accepted by most users. However there might be some user that prefers a brighter or lower intensity output. By adding an analog physical interface user can have the night light to operate at the condition which please them the most.

4.4 Lessons Learned

This section describes what was learned by the team during the development of this project.

4.4.1 What Went Well

The team communication the team had was very good. When setting up meetings within the team, with Dr. Chen or a professor outside the project, a team member would suggest it, and the team would then act upon that request. Communication between the team went well because if there was a problem encountered and one member could not solve, it was discussed among all the members and then solved accordingly.

41

Page 49: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

4.4.2 What Did Not Go Well

Some aspects did not go so well. The item the team learned the harsh realities of is that equipment may not be working properly and it may put a delay in the expected delivery time.

Also, unexpected delays such as illness and deaths in the family also put a delay in expected delivery time. This put a lag in the completion of some deadlines multiple times this semester.

4.4.3 Technical Knowledge Gained

The team learned that documentation is critical in a successful project. Documentation is also the main bulk of work that needs to be done. In order to complete a successful project, the documentation that accompanies the end product will determine the actual success of the project.

The team gained better knowledge in programming a microcontroller. A microcontroller may be very difficult to program, but once the main functions are understood, everything started to come together.

The team also gained knowledge on trouble shooting circuit. There were many problems that arose while designing the circuits. In simulation, the idea may work, but physically may not.

4.4.5 Changes

The most important change the team would make if given the chance to redo this project is the approach taken. The team was confused early as to the expected operation of the nightlight.

The team would also change the approach taken in completing deadlines, both set by the team and the faculty advisor. There were times when a deadline was approaching that was set by the team but an event caused the team to miss the deadline and the effect would ripple through the rest of the project.

4.5 Possible risks and risk management

The potential risk involved with this project has been initially identified. This list will be updated as possible risks are foreseen.

42

Page 50: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

4.5.1 Equipment Damage

During the initial design, many components will be tested for efficiency. This could pose a risk on damaging testing equipment or the components themselves. This would likely cause concerns with time as well as cost. All procedures related to the testing equipment will be reviewed by all team members. The data report for all components being tested will also be reviewed to minimize the chance of damage.

4.5.2 Human Injuries

This project deals with residential household electricity, and therefore involves the risk of electrical shock. Precaution will be taken when working with this system, especially when people outside of the design team are around the project.

5. Team Information

Following are the contact information for every person that involve in this project.

5.1 Client

Iowa State UniversityDepartment of Electrical and Computer Engineering, Senior DesignAddress: 2215 Coover Hall, Ames, IA 50011Website: www.ece.iastate.edu

5.2 Faculty Advisor

Dr. Degang J. ChenOffice: 329 DurhamOffice Phone: 515-294-6277Home Phone: 515-233-0516Fax: 515-294-8432Home Address: 2205 Van Buren Ave. Ames, IA 50010-4518Email: [email protected]

43

Page 51: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

5.3 Team Members:

Andrew W. Cook – Team LeadMajor: Electrical EngineeringPhone: 319-400-8422Address: 407 S 5th St. #106, Ames, IA 50010Email: [email protected]

Wesley Adreon - DocumentationMajor: Electrical EngineeringPhone: 608-712-7484Address: 3107 Lincoln Way, Ames, IA 50014Email: [email protected]

Dantrayl L. Smith – Communications CoordinatorMajor: Electrical EngineeringPhone: 901-219-2387Address: 204 Jewel Dr. #11, Ames, IA 50010Email: [email protected]

Kong-Wei Soon - DocumentationMajor: Electrical EngineeringPhone: 703-956-0847Address: 4912 Mortensen Rd. #124, Ames, IA 50014 Email: [email protected]

5.4 Summary

Due to the rapid advancement of technology, the used of electronic home improvements devices has becomes more common. The team’s task is to create an electronic device that is affordable and appealing consumers. One of the improvement can be done in home improvement is to provide user with a comfortable lighting system. Electrical energy waste is also one of the problems in every household due to user habit of not turning off unused appliances. The creation of automated nightlight can exactly accomplish this objective. Two of the most appealing factor of automated nightlight is its ability to improve home living quality while effectively reduced electric consumption. With its low production cost, it has the potential to becomes one of the must have electronic device in every home.

The team’s background in electrical engineering education for the past three years has definitely provided the necessary information on designing this product into success. The plan is to use light sensitive device as a means to detect the presence of user. A loop will be implemented to regulate the state of device. For example, presence of user in certain range will change the electrical parameters of the device, and this change will be sent to logic circuit to

44

Page 52: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

determine the proper state of the device. This process will continue repetitively for all time. A back up power will also be implemented to make sure the continuity functioning of device. Extensive testing of device in various conditions will be conducted and any errors are to be corrected to ensure the reliability of device.

5.5 References

1. Microelectronic Circuits, fourth edition. By Sedra and Smith. Oxford university press, 1997.

2. How to make printed circuit boards. By Team Dec03-093. Field and Wave Electromagnetics, 2nd. Edition. By David K. Cheng.

Prentice Hall, 19894. Fundamental of Digital Logic with Verilog design. By Stephen Brown,

Zvonko vranesic. McGraw-Hill, 20025. Engineering Circuit Analysis, 6th. Edition. By William H. Hayt, Jack

Kemmerly, Steven M. Durbin. McGraw-Hill, 20026. Optoelectronics and Photonics: Principles and Practices. By Safa O. Kasap.

Prentice Hall, 20017. Microwave Transistor Amplifiers, analysis and design. 2nd. Edition. By

Guillermo Gonzales. Prentice Hall, 19968. Fundamental of Photonics. By Bahaa E. A. Saleh, Malvin Carl Teich. John

Wiley & sons Inc., 19919. EE/CprE 491 Senior Design Course Notes. By John Lamont.10. EE/CprE 491 Senior Design Coursepack Supplement. By John Lamont.11. Fundamentals of Engineering Economics. Chan S. Park. Prentice Hall,

200312. http://www.kpsec.freeuk.com/powersup.htm. Accessed 11/10/05.13. http://circuits.cf.ac.uk/eLab/opto/opto.htm. Accessed 11/10/05.14. http://www.ee.washington.edu/conselec.htm. Accessed 11/10/05.15. http://ww1.microchip.com/downloads/en/DeviceDoc/41171a.pdf. Accessed

11/10/05.16. http://members.misty.com/don//led.html. Accessed 11/10/05

45

Page 53: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix A;********************************************************;; The LED flash control processing;; Authors : Andrew Cook; Kong-Wei Soon; For: Senior Design; Team: May 06-19; Purpose: This program is to just turn a bank of; LED's on and off. This program will be; the first part of the program that will; be used to define the entire operation; of the PIC.;********************************************************

list p=pic16f84a include p16f84a.inc __config _hs_osc & _wdt_off & _pwrte_on & _cp_off errorlevel -302 ;Eliminate bank warning

;**************** Label Definition ********************ra0 equ 00 ;RA0 bitra1 equ 01 ;RA1 bitra2 equ 02 ;RA2 bitra3 equ 03 ;RA3 bitra4 equ 04 ;RA4 bitcnt500u equ 0c ;500usec counter Addresscnt1m equ 0d ;1msec counter Addresscnt100m equ 0e ;100msec counter Addresscnt500m equ 0f ;500msec counter Addresscnt1s equ 10 ;1sec counter Address

;************* Pattern Data Definition ****************; '1':OFF '0':ON

;will be used for seeing initial operation of program.;Will be modified again to better fit our purposes.p40 equ b'00000'p41 equ b'11111'p49 equ b'10101'

;**************** Program Start *********************** org 0 ;Reset Vector goto init org 4 ;Interrupt Vector goto init

;**************** Initial Process ********************* org 5init bsf status,rp0 ;Change to Bank1 movlw h'ff' ;Set input mode data movwf trisa ;Set PORTA to Input mode clrf trisb ;Set PORTB to Output mode bcf status,rp0 ;Change to Bank0

46

Page 54: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

movlw h'ff' ;Set LED off data movwf portb ;Output data

;**************** Key Scan Process ********************;this is to see what signals are present at each pin of ;the PIC.keyscan btfss porta,ra0 ;RA0 ON(Low level) ?

;If there is ambient light present call keyscan ;Yes. Call Pattern 0

movlw p49 ;will turn on only 3 LED's and await detection

movwf portb ;outputs the 3 LED's to high since there

;is no ambient light present btfss porta,ra1 ;RA1 ON ?

;will look for human presence

;Main power supply is also present call ptn1 ;Yes. Call Pattern 1 btfss porta,ra2 ;RA2 ON ?

;will look for human presence

;main power supply is off call ptn2 ;Yes. Call Pattern 2 ;btfss porta,ra3 ;RA3 ON ? ;call ptn3 ;Yes. Call Pattern 3 ;btfss porta,ra4 ;RA4 ON ? ;call ptn4 ;Yes. Call Pattern 4 goto keyscan ;Retry

;*********** Pattern 0 Output Subroutine ***************;This routine will be used if there is ambient light presentptn0 call t500m ;will go to a delay of .5s before going back

;to see if there is ambient light presentgoto keyscan

;*********** Pattern 1 Output Subroutine ***************;This defines when each of the LED's are on.ptn1 movlw p41 ;Set pattern data movwf portb ;Output data call t1s ;Wait 5sec call t1s

call t1scall t1scall t1s;will look to see if there is still someone in the field;if there isnt anyone in the field, then it will continue;otherwise, it will move back to the top of ptn1btfss porta,ra1 ;RA1 ON ?

;will look for human presence

47

Page 55: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

;Main power supply is also present call ptn1 ;Yes. Call Pattern 1

call t1s ;Wait 5sec call t1s

call t1scall t1scall t1smovlw p49 ;Set pattern data

movwf portb ;Output data return

;*********** Pattern 2 Output Subroutine ***************;This defines when each of the LED's are on.ptn2 movlw p41 ;Set pattern data movwf portb ;Output data call t1s ;Wait 1sec call t1s

call t1scall t1scall t1sbtfss porta,ra2 ;RA2 ON ?

;will look for human presence

;main power supply is off call ptn2 ;Yes. Call Pattern 2

call t1scall t1scall t1scall t1scall t1smovlw p49 ;Set pattern data

movwf portb ;Output data return

;********************************************************; Timer Subroutine for 10MHz clock;********************************************************

;************* 1msec Timer Subroutine *****************t1m movlw d'2' ;(1) Set loop cnt1 movwf cnt1m ;(1) Save loop cnt1tm1lp1 movlw d'249' ;(1)*2 Set loop cnt2 movwf cnt500u ;(1)*2 Save loop cnt2tm1lp2 nop ;(1)*249*2 Time adjust nop ;(1)*249*2 Time adjust decfsz cnt500u,f ;(1)*249*2 cnt500u-1=0 ? goto tm1lp2 ;(2)*248*2 No, continue decfsz cnt1m,f ;(1)*2 cnt1m-1=0 ? goto tm1lp1 ;(2) No. Continue return ;(2) Yes. Cnt end ;Total 2501*0.4usec=1msec

;************* 100msec Timer Subroutine ***************t100m movlw d'100' ;Set loop counter movwf cnt100m ;Save loop counter

48

Page 56: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

tm2lp call t1m ;1msec subroutine decfsz cnt100m,f ;cnt100m - 1 = 0 ? goto tm2lp ;No. Continue return ;Yes. Count end

;************* 500msec Timer Subroutine ***************t500m movlw d'5' ;Set loop counter movwf cnt500m ;Save loop countertm3lp call t100m ;100msec subroutine decfsz cnt500m,f ;cnt500m - 1 = 0 ? goto tm3lp ;No. Continue return ;Yes. Count end

;************** 1sec Timer Subroutine *****************t1s movlw d'2' ;Set loop counter movwf cnt1s ;Save loop countertm4lp call t500m ;500msec subroutine decfsz cnt1s,f ;cnt1s - 1 = 0 ? goto tm4lp ;No. Continue return ;Yes. Count end

;********************************************************; END of LED flash control processing;********************************************************

end

49

Page 57: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix B Automated Nightlight

Instruction Manual

Installation

1. Remove the back casing of the nightlight to insert the 9volt battery.

2. Insert 9V Battery

3. Slide the back casing back on the nightlight.

Now the nightlight is ready to be plug into the socket of the hallway.(Note to user: The nightlight should be plugged into the top outlet due to the infrared sensors to be fully operational with its surrounding.)

Operation Mode

This section will describe the operation of the nightlight under normal conditions as well as power outages.

Normal Operating Conditions

Once the nightlight has been plugged in to the wall socket the nightlight will begin working without the user having to interact with it. The nightlight should be tested upon initial use the best time to test the nightlight is during low daylight hours or nighttime hours. Once the nightlight has been plugged in properly the user should turn the light out in the hallway. All five LED’s should be lighting up properly. To test the nightlight just walk back and forth in the hallway to see if the nightlight’s LED’s brightness is dimming as the user gets farther from it, and brighter when the user gets closer to it.

Power OutagesThe nightlight will operate similar to the normal conditions except incase of power outages only three of the LED’s will be operational due to the nightlight running off batter. Thus the nightlight will be operating just the same as normal conditions.(Note to user: During a power outage the nightlight will only last up to twenty-four hours running on battery back-up.)

Warning!The nightlight is not intended to be used as a main light source for a room such as a

ceiling illumination

50

Page 58: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix CNarrow Width Hallway Testing

Test Date(s):______________ Name:______________

Approx. Width of Hallway:_______________ Time:__________

Refer to Instruction Manual for proper use.

Objects In Hallway: ___Yes ___NoIf yes, describe:

Did the nightlight turn on when you passed in front of it?

Did the nightlight slowly decrease lighting after you passed in front of the nightlight?

Did the nightlight keep a very low light level during the night hours?

Does the nightlight turn off during the day or when an external light source is detected?

51

Page 59: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix DWide Width Hallway Testing

Test Date(s):______________ Name:______________

Approx. Width of Hallway:_______________ Time:__________

Refer to Instruction Manual for proper use.

Objects In Hallway: ___Yes ___NoIf yes, describe:

Did the nightlight turn on when you passed in front of it?

Did the nightlight slowly decrease lighting after you passed in front of the nightlight?

Did the nightlight keep a very low light level during the night hours?

Does the nightlight turn off during the day or when an external light source is detected?

52

Page 60: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix EBattery Back-up Testing

Before testing, please read disclaimer.

Test Date(s):______________ Name:______________

Approx. Width of Hallway:_______________ Time:__________

Refer to Instruction Manual for proper use.

Does the nightlight still operate after the main power has been removed?

Did the nightlight increase lighting as you passed by?

Did the nightlight slowly decrease lighting after you passed?

Did the nightlight keep a very low light level during the night hours?

How long did you leave the main power supply off?

Did you see a decrease in performance the longer the battery powered the circuit?

53

Page 61: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix F

Disclaimer

The team only asks that the outlet that the nightlight is shut off. There is no need to shut the power off to the entire home.

Also, the team does not resume any responsibility for any electrical damage done to personal items. This phase is only done at the consent of the tester, and the tester has the right to refuse to test the battery back-up circuit.

54

Page 62: Automated Nightlightseniord.ece.iastate.edu/projects/archive/may0619/final... · Web viewFinal Report Project Team: May 06-19 Client Iowa State University – Senior Design Faculty

Appendix GIllumination Testing

Test Date(s):______________ Name:_____________

Approx. Width of Hallway:_______________ Time:__________

Refer to Instruction Manual for proper use.

Is the nightlight:______ too bright? ______ too dim? ______ just right?

Is the color of the LED’s:_____ too harsh? _____ too dull? _____just right?

Are all 5 LED’s Operating? ____ Yes ____NoIf no, please darken which LED’s are not operating.

FOR BATTERY BACK-UP USE ONLY

Please refer to the manual for this operation step. Also, please read the disclaimer before doing this step.

Is the nightlight:______ too bright? ______ too dim? ______ just right?

Is the color of the LED’s:_____ too harsh? _____ too dull? _____just right?

Is the color of the LED’s:_____ too harsh? _____ too dull? _____just right?

Are all 3 LED’s Operating? ____ Yes ____NoIf no, please darken which LED’s are not operating.

55