Arduino Grow-Light Timer | DS3231 Clock & MOSFET Control
A DS3231 supplies the wall-clock time for an Arduino grow-light schedule. A MOSFET switches the lighting load according to whether the current time falls inside the programmed interval.
The key idea
Comparing the current time with the schedule lets the controller recover the proper state after a restart. An interval that extends past midnight needs logic covering both portions of the day.
What to remember
- Distinguish calendar time from elapsed time since startup.
- Re-evaluate the desired light state when the controller restarts.
Check your understanding
If a controller reboots midway through the lighting period, what should it do?
Show the explanation
Read the clock and apply the state specified for the current time.