24 Hour Responsive Reading Lamp (Behaviour)

This post is a follow-up to the fabrication post about the same project. Still a work in progress.


Lamp: Mkr1000 + Hue + Neopixels

The lamp is a combination of a Mkr1000, Neopixels, and Philips Hue. The Mkr1000 acts as a server, listening for http requests from the user-interfacing web-client, requesting time data from the WiFi router, and sending http requests to the Hue Bridge.

User Interface

Very bare bones at the moment, the web interface allows for users to select various functions for the light (for example, Candle Mode or Timing Mode).

The interface is made in p5.js. Once a button is clicked an http requests is formed and sent. I was having trouble/errors with the response, so the sketch ignores any responses.

Code Overview



Problems encountered

Epoch value and timer

The only timelapse documentation I have at the moment of the lamp is quite glitchy; for a while I could not determine what the problem was.

It turns out for some reason the ‘get epoch’ function from the WiFiRTC example was intermittently returning zero. I modified the code to continue requesting epoch forever:

Get Epoch
if (numberOfTries >= maxTries) {
    Serial.print("NTP unreachable!! Trying again");
    while (epoch == 0) {
      epoch = WiFi.getTime();
      Serial.println("Trying to get epoch");


Leave a Reply

Your email address will not be published. Required fields are marked *