A smart 3D printed light clock/lamp, that includes, but is not limited to; WIFI and manual control, Clock mode, multiple animations, and transitions.
If you have interest in buying one and live in The Netherlands, feel free to contact me.
You can skip to Quick start guide if you already own a smart-clock, and just want to run the set-up.
You can skip to OTA updater if you just want to update it.
- [Quick start guide](#quick-start-guide) - [Creating a unit](#creating-a-unit) - [Hardware](#hardware) - [Creating the model](#creating-the-model) - [Desk model](#desk-model) - [Wall model](#wall-model) - [3D printed only](#3d-printed-only) - [CNC](#cnc) - [PCB & wires](#pcb--wires) - [Firmware ](#firmware) - [Compile](#compile) - [BIN](#bin) - [Features](#features) - [Button](#button) - [LED status](#led-status) - [Potentiometer](#potentiometer) - [WIFI page](#wifi-page) - [Setup](#setup) - [Getting it’s IP](#getting-its-ip) - [Control](#control) - [Soft settings](#soft-settings) - [Clock mode](#clock-mode) - [Task List](#task-list) - [OTA (Over The Air update)](#ota-over-the-air-update) - [Full reset](#full-reset) - [Specifications ](#specifications) - [Input voltage](#input-voltage) - [Power consumption](#power-consumption) - [Appendix](#appendix)
Follow the following steps to setup the lamp, stop after the first step if you do not want to set up Wi-Fi.
Optional for WIFI:
There multiple types of model, the 'DESK model' is used in this readme as example project. But the other models have the same features, just a different shape.
All STL files for 3D-printing have a predefined tolerance of 0.2mm build-in.
The model is Desk.ipt, for this model there are 4 files that need to be printed.
This model and PCB is 'Work In Progress'!
There are 2 variants, and fully 3d printed model, and a CNC model.
The model is Wall Clock.ipt, for this model there are 2 files that need to be printed.
The model is Wall Clock CNC.ipt.
Please refer the in the appendix - PCB & schematic for the schematic, but here are some common notes about the schematic, for example in Input voltage and power consumption more information is given about the specifications of the electrics.
The firmware needs to be flashed once to enable OTA BIN file upload. Either with Arduino IDE and compile it, or using a BIN uploader of choice.
Arduino sketch The whole sketch is the 'Arduino' folder.
ESP32 must be added as an additional board manager in Arduino IDE.
FastLED can be downloaded though the built-in library anager in Arduino IDE.
Arduino-WIFIManager (already included).
Arduino-Button (already included).
Arduino-Stable-analog-read (already included).
Uploading a BIN file with a cable to the ESP can be done by any ESP32 BIN file uploader. this step is required for the first flash time.
The BIN files themself can be found at releases. The newest version is always recommended and can be updated with OTA.
Although these options change a bit over time, here is a list of 3 actions what the button generally does, these can also change in different modes.
In the back of the desk model is a LED (below the button). This is also the LED on the PCB of the ESP (LED_BUILDIN) this LED reflects thes errors:
Some statuses are also reflected by the LED strip itself, but due to the difficulty driving these in some WIFI modes, these are static set at the start of the status.
The 4 Potentiometers are Red, Green, Blue, and White. Where white stand for the luminescence. When any of the RGB Potentiometers are turned the mode will switch to on/manual and the RGB value will be shown.
The 2 most important pages are the Setup page, where the user can setup the light. And the main landing page where the UI is that the user uses to contol the smart-clock.
The setup page will be accessible and shown in APmode, but can also be access by going to smart-clock.local/ip. An example of this page is shown in the figure on the right. The password is replaced with starts, and cannot be received without changing the firmware. Leave fields blank (or for the password leaving only stars) to not update those values upon sending this forum. By default the SSID and password is limited to 16 characters by the firmware, and the total bytes that can be stored in memory is limited to 128. Going over these values results in unexpected behaviour.
User devices that support mDNS, like Windows and Apple, can use smart-clock.local/info to obtain its IP.
Alternatively the IP can be shown in the LEDs themself. To trigger this see Button. The LEDs are divided into 10 sections, and each byte in the IP range will be shown one at a time, to goto the next section press the button shortly again. The numbers are like a clock and in clockwise direction, top/right is 0 and the one right/down of that is 1. Where RGB will be the order of the numbers, so red will have a x100 multiplication and green will have x10, so when the IP is 198.168.1.150 and it shows the last section (150) then section 1 will be Red, 5 will be green and 0 will be blue. This is shown in the figure below
The control page is the default landing page the user will land on. An example of this page is shown in the figure on the right.
An example of the settings page is shown in the figure on the right.
There are multiple soft settings, these are settings that can be changed after the sketch has been uploaded, but are still saved so they can be restored after a reboot. The most up-to-date values can be found in the top of the WiFiManagerBefore.h source file, and can only be set in smart-clock.local/ip. These settings are saved EEPROMSaveDelayMS (Default 30000ms) after the last change of SoftSettings, or directly after APmode and in the smart-clock.local/ip page. Note that the character " and TAB (EEPROM_Seperator) cannot be used, these will be replaced with ' and SPACE respectively. Leave black to skip updating these, use spaces ' ' to clear the values
For the use of clock mode the right time zone needs to be set up, these are stored in timeZone (Default to Amsterdam).
Clock mode can only be started when WIFI has been connected and the user switches mode, after switching to Clockmode the lamp will turn PURPLE/GREEN/PURPLE/GREEN this means it is getting the time from a time server.
Also the clock can be manual updated with smart-clock.local/time?h=3&m=59&s=50 where H is hours, M is minutes, and S is seconds. The clock also automatically updates every day at 4:00
Furthermore the clock has some softsettings like ClockHourLines, but these are descibed in Soft settings
This page can be accessed on by opening the settings menu and clicking on the button 'Tasks' There can be 16 tasks, and the first 8 will be saved to EEPROM and will be restored after boot. By default the SYNCTIME had been added at 4:0:0
The format of Tasks "TimeH,TimeM,TimeS,TaskType,Var"
Some examples of TaskType and Var: TaskType (x but converted to name) - Var (x but can be converted to name)
This page can be accesed on smart-clock.local/ota (or 'IP/ota') and enables you to update firmware over WiFi. On this page is a 'choose file' button where the new version can be selected. Make sure the right, compatible, most updated file is selected ("Smart_clock.bin"). This can be downloaded from releases. After which the 'Upload' button needs to be press for the update process to begin, the unit will automatically update and reboot afterwards. Note that SoftSettings are preserved.
If a full reset is desired it can be achieved by going to 'smart-clock.local/reset'. But note that accessing the page will directly wipe all SoftSettings from existence and there will be no way to restore them back. If the wipe was successful it will be reported back and will execute a restart.
The power supply is either 5V or 12V. The difference in the voltage is the used LED strip. If the WS2812B is used it would need to be 5V, but if the WS2815 (with redundant data lines) is used then 12V is required.
The pinout of the DC jack has by default positive polarity. Meaning the outer tube -as shown in the figure right- is the ground connection. The lamp will fail to work otherwise (but is able to handle the shock).
The lamp will consume 18Watts at maximum, so as an example for 12V a 1.5A (or 5V at 3.6A) power supply is required to allow full brightness. Although actual measurements came closer to 12Watt.
The idle power consumption is about 0.65Watt (measured with LEDs turned off, and WIFI turned on)