Watch
The Nook system can also be controlled by a smartwatch. The display can report on the current status of the system, with buttons controlling the system. This allows the system to be controlled from anywhere the watch can be carried.
For the watch, I used a Watchy as a base. This is an ESP32-based device with four buttons, a 200x200 e-paper display, PCF5863 real-time clock, BMA423 accelerometer, and vibration motor. Some initial code is available for the watch. The code is Arduino-based, minimal, incomplete, and does not scale well beyond simple custom face displays.
I have written a replacement system for the watch. This system makes more heavy use of the underlying FreeRTOS system and tasks, along with greater ESP-IDF use (as opposed to Arduino).
Part of the overhaul was an input system that turns button presses into events, with an understanding of more complex presses (eg. multiple buttons together, long-press, etc). This allows great flexibility in actions, and versatile control without needing to look at the watchface.
Upon certain button-presses, the watch connects to the Nook system, exchanges information with it, and allows the system to be observed and controlled from the watch. The inputs are similarly simple to other inputs in the Nook system, with the server deciding how they will be handled, with server-side configuration.
A couple of examples of this interaction and the input system are:
- A long-press of the two upper buttons together from the basic watchface will connect to the Nook system, upon which the Nook system will restore system to a fairly default state, restoring ordinary lighting to the whole house.
- A press of two buttons in sequence will enter a menu system, from which a range of tasks can be performed. The state of the Nook system and the menu system are shown on the watch, with buttons allowing navigation through this system.
This system uses FreeRTOS tasks more heavily. The existing components are not bug-free, and not well-tested with multiple tasks. I improved stability through a few means. I fixed bugs and then later rewrote the PCF8563 driver. I added I2C redundancy checking to the existing I2C driver, then rewrote it entirely to use the underlying ESP-IDF code. I have been gradually replacing and adding to this system, with a view to improving the quality of the controlling system.
I have also done some work reverse-engineering the Arduino build over the top of ESP-IDF, which is notoriously difficult to successfully build fully. In doing this, I can configure the underlying ESP-IDF system, rather than being stuck on the settings used when the released Arduino libraries were built.
The watch can also tell the time.
For more information on the Nook system, click here.