Custom Clock using Raspberry Pi Zero and Python.
The program runs on Raspbian in headless mode. It asks for weather status to openweathermap.org API at regular basis, data is saved into disk (card) as cache to reduce calls.
A settings.json file stores configuration for location, metric and alarm.
Touch screen functionality is built around PySimpleGUI library, offering UI capabilities in a very small size using tkinter.
Display is a 5" LCD screen from Waveshare detailed here, as this screen doesn't have a bright sensor, I added a routine to check light in the enviroment using a photoresistor and turn on or off the screen with a relay, this behavior can be also managed using the main physical button.
In the main event loop, time is checked against the configured alarm time, if they match, the buzzer starts to sound until the main button is pressed.
Alarm can be turn on/off using the touch screen; when alarm is active, the notification led is on.
┌─────────────────────────────────────────┐ │ A B C D 1 2 3 4 5 6 7 8 │ │ │ │ G H │ │ │ │ I J │ │ E │ │ F K L │ │ │ └─────────────────────────────────────────┘
Position | Component |
---|---|
A | LED 1 (pin 7) |
B | RELAY (pin 5) |
C | GND (pin 6) |
D | +5V (pin 4) |
E | SCREEN |
F | SCREEN |
G | BUTTON CABLE |
H | BUTTON CABLE |
I | LED CABLE - |
J | LED CABLE + |
K | PHOTORESISTOR CABLE |
L | PHOTORESISTOR CABLE |
1 | BUZZER (pin 16) |
2 | DHT 11 (pin 18) |
3 | PHOTORESISTOR (pin 15) |
4 | LED 2 (pin 11) |
5 | BUTTON (pin 13) |
6 | |
7 | GND (pin 20) |
8 | +3V (pin 17) |
Prototype 1
Prototype 2
Prototype 3
Prototype 4