OffLite: An IoT Prototype
A conceptual response to the UN Goals for Sustainable Development, offLite is a prototype for a device intended to reinforce the conservation of electricity in homes, by notifying occupants that they did not shut off a light switch after leaving a room. When used, offLite will prompt curiosity about generation, record frequency and habits, and quantify environmental and monetary costs of simply forgetting to turn off a lightbulb.
A brief user research phase to assess stakeholder’s understanding of electricty generation and consumption was conducted to begin the project, incorporating an online survey distributed to parents, and a “user interview” with my two children, ages 7 and 9. The research found that: kids think they leave on lights ‘sometimes’, once a day for a minute; that light comes from the “sun, electricity, wires, power plants, electric company, and the Gorge dam”; and that their electricity came from sources including wind, nuclear, coal, and hydroelectric power plants. The research findings informed both the project scope and certain details of sensor settings.
The offLite prototype uses the Adafruit ESP8266 “Feather” Microcontroller as a versatile and simple method for incorporating sensors and running relatively simple programs. Installed as a sort of ‘button’ or trigger, a PIR motion sensor was attached to ground, signal, and USB-level 5V power for optimum performance. PIR Sensitivity was reduced to about 30%, and the Timer set to minimum, meaning that the Sensor would prioritize nearby, active motions, and would reset itself quickly to keep ‘looking’. The Adafruit TSL2591 Lux Sensor complemented the PIR in this prototype with its capacity to quickly and accurately measure area light. Although capable of IR and full-spectrum measurements with high detail, offLite used only the visible light calculation in its operation. The Adafruit SSD1306 OLED module was used as a complement to a simple piezo buzzer for visual and audible feedback. A small lithium-ion battery provided power for the prototype’s first trials. The sensors were remotely installed in a custom-built LEGO enclosure which hid them among toy shelf clutter, linked by 36” lengths of 22 gauge solid core wire. Server connections were monitored on a separate laptop.
The offLite prototype uses a microcontroller to combine a pair of independent sensing devices with several outputs which create gentle reminders and an intercept point for contextual learning about electricity. When installed surreptitiously in a kid’s room, offLite will look for movement around the room while monitoring the ambient light level. A period of ‘high’ light level absent any movement suggests that the occupant of the room has vacated the area, and does not intend to return in the short-term, so the prototype’s software advances from simple monitoring to several provocative actions. Electricity generation information is first provided via a call from the microcontroller to an API focusing on renewable power generation. An audible alert then emanates from the device to urge immediate light switch action. As a part of a server/client relationship, offLite both sends and receives data from a cloud service, extending its reach and capabilities.
A number of iterations were explored in the code design. The program needed to use one sensor as a ‘gating’ feature, allowing entry into the next sensor, and finally to the feedback stage and outgoing communication. It was originally thought that a chronological series of millis() timers could govern the three phases of sensing and feedback, but problems were encountered with overlapping timers, and earlier loop timers were over-riding the subsequent function timers. The concept of switch and case was also briefly explored as an alternative to nested if functions. A simpler solution that worked fine as a bespoke prototype was to install a counter that incremented on loop passes, timed with a delay of five seconds. In the final iteration of the software, the counter looks for a number greater than ‘6’ to move into the alert phase. Any movement would reset the counter to ‘0’ and thus begin again the 30-or-so second ‘no movement’ timer. As a simple loop and prototype this was a successful way to structure the code.