Sunrise Alarm Clock: Difference between revisions

From Adam Colton
Jump to navigation Jump to search
Line 60: Line 60:


I will need 7 pins to drive this, one PWD to drive the backlight.
I will need 7 pins to drive this, one PWD to drive the backlight.
Once I get the control voltage on V0 dialed in, replace the pot with two resistors.


=== DS3231 ===
=== DS3231 ===

Revision as of 00:41, 3 April 2019

An alarm clock that turns on LEDs at a specific time. Replaces the hacky version of a timer on the standing lamp.

Power

From the wall I have 15V at 1 A, which can run the LEDs.

I will use one of the small buck modules to step that down to 5v for the logic. I can either give the board 5v via "5v" or 9v via "Vin".

I'd also like to put a large capacitor on the 15v input, if the power is cut, it should be able to keep everything running for a few seconds, maybe a few minutes.

LEDs

An individual LED is rated at 1W and 3-3.3V, so 1/3A.

At 15V, we'll have a current limiting resistor, 4 LEDs in series and then a control FET. The 4 LEDs will be at about 3.3V each, so 13.2V. Which means the resistor should drop 1.8V. At 1/3A, this means it should be about 6Ω. This also puts it at 0.6W, so use a few resistors in parallel.

I probably want at least 8 LEDs, so there will be two strips, but they can share the FET.

Controls

  • Set the time
  • Set the alarm by time and day

Nightlight function turns on the light at a low level.

Input will be buttons, output is an HD44780 display.

Logic

Most of the time the Arduino will be in sleep mode with one interrupt on the buttons and one on a timer.

The "nightlight" button will turn on the LEDs on a low level for 1 minute. ↑ and ↓ will increase and decrease the time by 1 minute. → and ← will increase or decrease the brightness.

If the light is on (either from alarm or nightlight), "nightlight will turn off the LEDs".

Any of the control buttons will turn on the screen. Initially it displays the time. ↑ and ↓ scrolls through config options:

  • Set Time
  • Set Alarm
  • Cancel/Uncancel Next Alarm

I think the timer loop will be ~10 minutes at a time. Arduino wakes up, check the seconds until the next alarm. If the next alarm is >600s away, it goes back to sleep for 600s. If the alarm <600s it goes back to sleep for that long and sets a flag to turn on the light on the next wake.

Alarm is stored in EEPROM. To save read/write, when the device starts up, load the alarm into a variable. When the alarm is changed, it is changed in memory and only when the device goes back to sleep is it saved out to EEPROM.

OR

The ds3231 has a built in alarm, should probably just use that.

DST

I don't think the DS3231 has DST built in. I can hard code DST dates for something like 20 years (much longer than I expect the clock to be in use).

Pins

  • LCD: 4 data, 1 brightness, 1? r/w
  • LED: 1 PWM
  • Buttons: 1 per button (can do serial, but I should have plenty) +1 interrupt
  • DS3231 RTC: 3?

Build Plan

HD44780

Wire this up with some buttons, get a sort of "hello, world" working.

Done.

I will need 7 pins to drive this, one PWD to drive the backlight.

Once I get the control voltage on V0 dialed in, replace the pot with two resistors.

DS3231

Get this working so I can both set and read the time. Just output over serial. Buttons to control.

Requires getting a library.

LEDs

Drive a FET with the Arduino to control LED brightness. Will probably need to be BJT → FET.

Sleep

Test putting the Arduino to sleep and waking it up with both timer and input.

Prototype

Throw everything in a sterilite box, just to test it out for a few weeks. Use a full Duo.

Final

Put the controls on perfboard and make a box with a control panel.