Skip to content

Individual ECM project to implement an energy saving automatic outside light using a PICKit microcontroller and C.

Notifications You must be signed in to change notification settings

martinteh/Embedded_C_Individual_Project

Repository files navigation

Individual project - Energy saving automatic outside light

Learning outcomes

The principal learning objectives for this project are:

  • Implement a working microprocessor based system to achieve a more complex real world task
  • Develop your ability to independently plan, organise and structure your code
  • Improve your grasp of the C language and writing your own functions

Brief

Outside lights that respond to ambient light levels are commonplace (i.e. street lights, porch lights, garden lights etc). These types of lights switch on at dusk and then turn off at dawn. However, energy and money can be saved if these lights are switched off during the small hours of the morning (for example, between 1am and 5am), when there are very few people around. Many councils in the UK have implemented/trialled this idea for street lights (https://www.bbc.co.uk/news/uk-england-derbyshire-16811386). Your task is to use the knowledge of microcontrollers and hardware that you have gained in labs 1-3 from this module to develop a fully automated solution.

Specification

Design and program a device that meets the following requirements:

  1. Monitors light level with the LDR and turns on an LED in low light conditions (i.e. night-time) and off in bright conditions (i.e. daytime)
  2. Displays the current hour of day on the LED array in binary
  3. Turns the light off between approx. 1am and 5am
  4. Adjusts for daylight savings time
  5. Maintain synchronicity with the sun indefinitely
  6. Be fully automatic (requires zero maintenance after installation)

Please use this GitHub repo to manage your software development and submit your individual project code.

Supplementary information and help

At first the task may seem quite straightforward but there are several points that often prove more tricky. The first is how to test code during development? You could test in real world conditions but you would be limited to one test cycle per day and this would severely slow down your development and debugging progress. To get around this you could implement a "testing mode" and pretend that a day lasts 24 seconds. This could be done using a #define directive to switch between "normal" and "testing" modes for your code.

Adjusting for daylight savings time is not too tricky. The clocks always change (in the UK) on the last Sunday in March (they go forward an hour) and the last Sunday in October (they go back an hour). One method of achieving this is to initialise what day it is when device is first switched on (using manual input) and then keep track of the days that pass and what the day of the week it is. Another method might be to automatically figure out what time of year it is (see below). Also don't forget about leap years!

No clock is perfect, they can all run slightly fast/slow and can by influenced be external factors such as temperature. Ultimately this will result in drift over time and eventually the time will drift so far out of sync with real time that it is meaningless. For the purposes of our device the main requirement is that it remains in sync with the sun. You could use light from the sun to keep your clock in sync. Although the length of daylight varies considerably during the year, the midpoint between dusk and dawn only varies by a few minutes. This is termed solar midnight approx. 12am or solar noon approx. 12pm. One method of staying in sync with the sun is to use the LDR and record/calculate when these times occur and adjust your clock accordingly. The length of daylight also tells us information about what time of year it is and can be used to help us know when to adjust for daylight savings time.

Day length http://wordpress.mrreid.org/2010/10/31/why-change-the-clocks/

About

Individual ECM project to implement an energy saving automatic outside light using a PICKit microcontroller and C.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published