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.

Overview

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

Arduino

Web

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();
      numberOfTries++;
      Serial.println("Trying to get epoch");
      delay(1000);

    }
  }

24 Hour Responsive Light (Fabrication)

Similar to original Long Distance Reading Lamp, this bedside light is intended in its final form to connect people over distances. For this first iteration, however, my goal is to create a solid 24hr response cycle – a ‘default’ state, so that the lamp can work well as a standalone bedside light.

After experimenting with a few form factors (I really wanted to make a nice cylinder, inspired by Casper’s Glow Light), given the time constraints of this assignment (and the wallet-constraints of being a student), I settled on a cheap ($9), off the shelf diffuser. This allows me to focus more time on the interaction and progression, and less on fabrication and (potentially expensive) materials.

Hacking the light fixture to accommodate my extra circuitry wasn’t too complex, though I took care to make sure that the AC circuit was safe.

An underwriter’s knot helps provide strain relief.
Carefully soldered into the base of the socket, with as little wire exposed as possible.