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.

Modular 555 power cycler

Overview

As part of the final for Energy, Rashida and I are dealing with 555 timer circuits and intermittently power cycling a rover. For this class I’d like to create a modular 555 timer circuit that is A) adjustable in its cycle, and B) modular in its use.

Here are the schematic and calculations for the 555 timer circuit. Rashida uses a different configuration of the 555 timer, and is planning on allowing the resistors and capacitor to be adjustable.

I plan to sacrifice some of the adjustability in favour of a mostly SMD (and thus smaller) board. To allow for a bit of flexibility I will use a potentiometer as R2, and include two selectable capacitors.

Technicals

R2: As seen here, R2 affects the time off in relation to R1 (time on). Unfortunately with the basic setup the time off can never be more that 50% of the duty cycle. Rashida’s solution is to us an ‘improved’ 555 timer circuit, my solution is to use a logic inverter in front of the relay.

BOM

  • 47 uF capacitor
  • 470 uF capacitor
  • Transistor (or logic inverter)
  • 500K resistor
  • 500K potentiometer
  • Toggle switch
  • Relay

Philips Hue for Games: Beyond the Screen

Video games are framed by the computer screen. The world of the game exists within that rectangle, and the ‘real’ world exists around it. What if we use connected lighting systems to extend the environment of the game beyond the screen?

For this project I have created a simple game of pong in which how well you are doing in the game is reflected by the world around you. Using a Philips Hue Bloom (or any “hue”, “sat”, and/or “bri” capable light), your progress in the game affects the brightness and colour of the room you are playing in.

Very simply, the longer you play, the more pleasantly cool and desaturated the light around you becomes. Whenever you ‘lose’ the light progresses some increment back towards a glaring, saturated red.

Continue reading “Philips Hue for Games: Beyond the Screen”

A Tiny Project

This week’s Homemade Hardware assignment is to do something interesting with an ATtiny. I have decided to make a useless light toy thing.

Uploading code to an ATTiny is slightly more involved than to something like an Uno. Fortunately we can use an Uno as an uploading interface (as described on the class site). You can do this with a breadboard and jumpers, but it’s helpful and repeatable to use a programming jig. Here’s mine:

I scrounged the junk shelf for some inspiration and found a film container. It looks like a nice diffuse material and is small enough to offer a challenge to put something interesting inside. It fits just enough PCB for an ATTiny plus a Sparkfun accelerometer breakout.

With the component parts in place I got to work figuring out what this useless toy thing would do. With an accelerometer I can know which direction is down. The film can has a natural ‘rollability’ to it, so I figured the fun little playful characteristic of this thing could be that its lights always point one way when you’re rolling it.

Fun fact: a neopixel strip can bend in on itself to become… a neopixel circle!

Tom Igoe told me specifically that I’d fail Light and Interactivity if I brought in a rainbow LED project, so I’ve chosen to get all my rainbow LED kicks in this class.

Two accelerometer axes (x and y) with some throwbacks to highschool geometry (arctan2), and a little bit of filtering (SimpleKalman) provided the code necessary to calculate down. Here’s a graph of the sensor readings.

Yellow and Dark Blue indicate raw X/Y accelerometer data. Red shows arctan2 (i.e. angle from x axis) of that data, Light Blue shows filtered and scaled angle.

After getting the interaction right okayish, the rest was simply a matter of soldering it on to small enough a through-hole board to fit into the canister. I enjoy this part as it feels like a puzzle.

Next steps will be to add a switch so that I can turn it off. As it currently stands there is a USB charging port for the LiPo, but to turn it off you must unplug the battery. This is not ideal.

I’d also like to refine the look, perhaps add a more thoughtful colour scheme, and work on making the change of colour more definite. I do like the subtle shift in colour, but I worry that the slow change is not very noticeable. I would like to try a few other outputs, such as having each colour ‘tick’ over to the next slot if a certain threshold is met.