Word clock
Hardware
It's described in the blog post by me.
Features
- show the time in rainbow color schema
- show a color schema based on a CO2 PPM value that needs to be handed in via MQTT topic (see API for reference)
- light up all LEDs to have a beautiful panel of letters instead the time
- adjust the brightness via API and via an existing AWTRIX that has a LUX sensor and MQTT API enabled (it then asks the AWTRIX API once a minute for the current LUX value and adjusts it's brightness accordingly)
- connect to Wifi to fetch the current time and to connect to an MQTT to provide an API
Requirements
- add the NodeMCU board to Arduino
- open "Settings" and add
http://arduino.esp8266.com/stable/package_esp8266com_index.json
as "Additional boards manager URL" - open "Board Manager" via "Tools" > "Boards"
- search for "NodeMCU" and install esp8266 package
- select board "Tools" > "Boards" > "NodeMCU 1.0"
- optional: raise the transfer speed to not wait too long during upload (921.600 worked fine for me)
- open "Settings" and add
- install following dependencies via the Arduino IDE:
- EspMQTTClient (https://github.com/plapointe6/EspMQTTClient)
- NTPClient (https://github.com/arduino-libraries/NTPClient)
- ArduinoJSON (https://arduinojson.org/)
- PubSubClient (https://pubsubclient.knolleary.net)
- FastLED (http://fastled.io)
- copy
config.h.dist
toconfig.h
and adjust the config options - adjust the
MQTT_MAX_PACKET_SIZE
option in thePubSubClient
library to 250 to allow proper AWTRIX lux sensor support
From PubSubClient: "The maximum message size, including header, is 128 bytes by default. This is configurable via MQTT_MAX_PACKET_SIZE in PubSubClient.h"
- following FastLED issue via FastLED/FastLED#733 (comment):
error: 'boolean' has a previous declaration as 'typedef bool boolean'
typedef bool boolean;
^
Known limitations
- DST is not yet respected (plan is to announce this via MQTT)
- the AWTRIX part is not yet optional. One can remove the code segments that start with
// TODO only include if AWTRIX is enabled
API
There is an MQTT based API available. The topics can be specified in the config.h
.
Color schema
MQTT_SUBSCRIBE_COLOR_PPM_TOPIC
: send an integer to this topic and the clock will adjust it's color schema based on the value. Thresholds are 800, 1000 and 1400. It will use a purple, a blue, a green-yellow and an orange-red color schema for the ranges between those thresholds. If something is send there it will stay in this color schema until the next reboot orMQTT_SUBSCRIBE_COLOR_RAINBOW_TOPIC
is triggered.MQTT_SUBSCRIBE_COLOR_RAINBOW_TOPIC
: send anything there and the clock will move back to the classic rainbow color schema.
Clock mode vs full mode
MQTT_SUBSCRIBE_VIEW_FULL_TOPIC
: send anything there and the clock will enable all LEDs making it a colorfull panel instead of a clockMQTT_SUBSCRIBE_VIEW_TIME_TOPIC
: send anything there and the clock will show the time again
Brightness
MQTT_SUBSCRIBE_BRIGHTNESS_TOPIC
: send a value between 0 and 255 there and the brightness will be adjusted to that value
Time offset
MQTT_SUBSCRIBE_OFFSET_TOPIC
: send the offset in seconds to this topic and the clock will change it's display time to UTC + offset. This can be used to work around the non-existing DST option.