-
Notifications
You must be signed in to change notification settings - Fork 130
Digital Clock
Here are some brief instructions on how to build a large, bright digital clock whose color and brightness can be remotely controlled from MH.
This is built out of an Arduino (Pro Mini 3.3V) and a Tasmota (Wemos D1 Mini) hooked up to dual 8x8 dot matrix WS2812 programmable LED boards. The Tasmota takes care of the time duties, running NTP plus timezone and DST calculations, as well as providing a nice UI for the color/brightness controls for the LEDs. The Arduino receives time and color info from the Tasmota over the serial interface and calculates which LEDs should be set on the display. The Arduino has a custom narrow font to make it all fit into an 8x16 format. It isn't waterproof but can be located in a window or glass door to be visible outdoors. Even in direct sunlight and at half brightness the LEDs are readable from a significant distance:
The Tasmota has a web interface that makes it easy to remotely control it from MH. This can be as simple as a couple of time_cron
blocks that dim the display in the evening and brighten it in the day so it doesn't blind anyone at night. Those WS2812 are pretty bright!
if (time_now($Time_Sunset)) {
set $Web_Request 'get_url -quiet "http://1.2.3.4/cm?cmnd=Color%201,1,2"';
start $Web_Request;
}
Where $Web_Request
is a process_item and 1.2.3.4
is the IP address of the Tasmota.
It is also possible to tie the get_url
request into the MH motion sensing code so the LEDs only get bright when someone is present which should extend the life of the LEDs.
Tasmota config, which can be entered in the console, is:
Backlog DeviceName Clock_Controller; SetOption17 1; Baudrate 19200; Timezone 99; TimeSTD 0,1,11,1,2,-300; TimeDST 0,2,3,1,2,-240; Template {"NAME":"Clock Controller","GPIO":[0,0,0,0,0,1376,0,0,0,0,0,0,0,0],"FLAG":0,"BASE":18}; Module 0
Rule1
ON Event#Update DO SerialSend %timestamp%,%mem2% ENDON
ON Time#Minute DO Event Update ENDON
ON Color DO Backlog Mem2 %value%; Event Update ENDON
Rule1 1
The configuration above is for EST/EDT but modify the TimeSTD
and TimeDST
commands as appropriate. Also note that the WS2812 defined in the template is a dummy device used to enable the GUI controls. No WS2812 need to be attached directly to Tasmota.
The Arduino sketch is available upon request.