Energy Final – 3/3

Things left to do today:

  1. program board with Timer
  2. buy Rockite, Epoxy
  3. epoxy solar panel and other electronics to interior of acrylic enclosure
  4. make wooden 3.5″x3.5″x3.5″ box, and smaller box inside from cardboard to prototype how the pouring around the acrylic enclosure will be like
  5. make several test concrete boxes before doing it for real
  6. Do it for real

Programming Board w/ Timer

The key thing for me to find out today is how using the Low Power library messes with the timing of the MCU. I know that the low power works by shutting the MCU off for several seconds. From this site, I learned about Rocketscream Electronic’s LowPower library.

I started by using the blink sketch, but using:

LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

instead of the “delay(1000);” of the traditional blink sketch. Using my phone timer, I see that it does indeed cause a delay of approx 8-8.5 seconds. (Probably in imperfect reflexes for timing it o my phone).

I also confirmed that:

LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

leads to a delay of approx 16.5-17 seconds.

This means I will need to build in this 8 second delay into my sketch.

Calculations:

  • 60 seconds / 8 seconds = 7.5 increments of 8S per minute
  • 7.5 x 60 minutes = 450 increments of 8S per hour
  • 450 x 12 hours = 5400 increments of 8S per 12 hours

which means a delay of 12 hours can be written as:

for (int x=0; x<5400; x++) {

LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

}

To test this I will delay for one minute, which by my calculations, should be a loop of 7.5 so that:

for (int x=0; x<7; x++) {

      LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);

}

is about 59 seconds. (I couldn’t put 7.5 on a loop).

Using the Low Power library also means I cannot rely on the WDT (Watchdog Timer) for tracking time. Which means, I’ll have to do this purely using the 8S delay.

LED Light Plan for Dark Hours

Using the following graphic from TimeandDate, there are three phases of “getting dark” before it’s considered night: civil twilight, nautical twilight and astronomical twilight. Astronomical Twilight (AT) occurs when the Sun is between 12 degrees and 18 degrees below the horizon, when the sky is still dark but a faint change in light colour can be seen.

The LED will start it’s journey toward brightness after Dusk Astronomical Twilight and begin it’s journey toward darkness after Dawn Astronomical Twilight.

However, AT occurs at different times at different months, and also depending on Daylight Savings.

Dusk AT:

  • Jan: 5:44pm – 6:17pm
  • July: 9:45pm – 10:37pm

Dawn AT:

  • Jan: 4:11pm – 4:50pm
  • July: 3:19am – 4:10am

Since I plan to have everything encased in concrete so as to be unable to access the components, I can only set the timing once, and it has to work with the day/night cycles of all seasons.

I will start the light at 8 pm and end it at 5am – that’s 9 hours. The lighting plan for the single Neopixel shall be as follows:

8pm-9pm: 0,0,0 – 10,10,10
9pm-10pm: 11,11,11 – 20,20,20
10pm-11pm: 21,21,21 – 30,30,30
11pm-12am: 31,31,31 – 40,40,40
12am-1am: 41,41,41 – 50,50,50
1am-2am: 50,50,50 – 41,41,41
2am-3am: 40,40,40 – 25,25,25
3am-4am: 24,24,24 – 10,10,10
4am-5am: 10,10,10 – 0,0,0

Referencing my earlier calculation of: 450 increments of 8S LowPower MCU shut-down per hour, the code shall be:

 

 

 

 

 

 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *