Both versions of the code work in essentially the same way. The only difference is in how they grab time from the Internet.

Connect the QT Py to a PC with a good data capable USB cable so that the CIRCUITPY folder shows up. Then open up code.py in a text editor.

Look for these lines near the top of the code listing:

# --| User Config |--------------------------------
WAKE_UP_HOUR = 7  # alarm time hour (24hr)
WAKE_UP_MIN = 30  # alarm time minute
SLEEP_COLOR = (0, 25, 150)  # sleeping time color as tuple
WAKEUP_COLOR = (255, 100, 0)  # wake up color as tuple
FADE_STEPS = 100  # wake up fade animation steps
FADE_DELAY = 0.1  # wake up fade animation speed
NEO_PIN = board.SCK  # neopixel pin
NEO_CNT = 12  # neopixel count
# -------------------------------------------------

To set the alarm time, change WAKE_UP_HOUR and WAKE_UP_MIN as desired. Note that the hour uses 24 hour format.

While waiting for the alarm time, the SLEEP_COLOR will be shown on the NeoPixels. Once the alarm time is reached, the color will fade to WAKEUP_COLOR. Use (red, green, blue) tuples to change either of these colors.

The speed of the fade effect can be altered by changing FADE_STEPS and FADE_DELAY.

If you end up using different NeoPixels or attach them to a different pin, change NEO_PIN and NEO_CNT as needed.

NTP Version Only

For the NTP version of the alarm, there is also a TZ_OFFSET parameter. Use that to set your local time in terms of hourly offset from UTC.

Arming and Resetting

Once the alarm time is set, simply reset the board or cycle power. The board will fetch the current time and then wait for the alarm time.

Once the alarm triggers, it will stay lit. To re-arm the alarm, simply power cycle the board. Pressing the reset button would also work, if the reset button is reachable.

Troubleshooting

If the board fails to connect to the local wifi network, the NeoPixels should blink red. If that happens, double check the ssid and password settings in your secrets.py file.

For other issues, connecting to the serial console is the best option. There are several print statements in the code. Being able to see these, and any other error messages, will help determine where and why things are not working. For details on connecting to the serial console, see here:

This guide was first published on Jul 12, 2022. It was last updated on Jul 12, 2022.

This page (Using the Alarm) was last updated on Jul 11, 2022.

Text editor powered by tinymce.