Motion Clock Page

Home                               Craigs Pages                               Heathers Pages

Dec 2022

Sometimes I have a hard time sleeping and any light in the bedroom like from a clock radio can be a part of the problem. So one night when I was trying to sleep I came up with the idea of a clock that would display the time and date only on command. In this case the command would be me waving my hand anywhere near the clock. The next morning I got up and rummaged through my parts drawer and picked out a LILYGO T-Display ESP32 module with integrated ESP32 with WiFi capability, an LCD display and battery management, a PIR motion sensor that I have used on numerous projects, a small SPST power switch and a 1200 mAH LIPO battery.

Software wise, I decided to code in ESP32Forth because I really enjoy doing so and I already had a library of Forth modules available for NTP (Network Time Protocol), for time, timezone and daylight savings time correction, for driving the ST7789 LCD and for drawing text on the display which would all be necessary to bring this creation to life.

See my ESP32Forth page for the details.

The clock runs normally on battery power but can also run from a USB power supply. I don't know yet how long the battery will power the device between charges because I turn the clock on at night and off in the morning. The Forth software is structured so that when the PIR sensor detects motion, the code wakes up and logs into my local WiFi network and accesses a NTP server for the seconds since 1970. My code then extracts the time and date and displays it in partial segments. The ESP32 is then put back into deep sleep mode until motion is again detected. The time and date are displayed as follows with a two second delay between each segment:

Time (like 10:43) then
AM or PM then
day of the week (like Wed) then
the month (like Dec) then
the day of the month (like the 14th) then
the year (like 2022)

I displayed the time and date this way because it is easier to understand when I am half asleep.

To finish the project off, I designed the housing for the Motion Clock in OpenSCAD and 3D printed it on my Prusa printer. I  machined the front panel out of Red acrylic.

The pictures below show the finished product which was completed in only 2 days; hardware, software and packaging.

Front view of Motion Clock displaying the time (hours and minutes).

The power switch is on top and the FIR sensor is on the bottom. Front of chassis is 1/8" Red acrylic.

Overall dimensions of the clock are:
Width: 2 5/8"
Height: 3 3/8"
Depth: 1 5/8"

The PIR sensor is capable of detecting motion from up to 10 feet away which is more than sufficient for my needs.

A slot in the housing allows access to the USB connector on the LILYGO T-Display module. The USB connection can be used for powering the clock, charging the clock's battery and/or programming the ESP32 on the module.

NOTE: the power switch must be on when charging the battery. Low Voltage 8-Channel I2C Switch With Reset (Rev. D)

Another side view of the clock displaying the year segment of the date.

Here is the back of the housing which was printed in black PETG on my Prusa 3D printer.

Click here to view my ESP32Forth development tree/workspace which contains code for this project along with a bunch of other ESP32Forth projects.

Questions and comments to me Craig at:

Home                               Craigs Pages                               Heathers Pages