Back to Parent

Outcome


Problem Statement

This project was inspired by my friends who have seasonal affective disorder (SAD) who have purchased sunlamps to help regulate it. Many of these lights have functions that allow simulation of sunrises to allow the body to wake up naturally so that the user feels well rested. 

Goal

The goal of this project is  to emulate the sun setting and rising in an IoT device that allows users to easily begin their nighttime and morning routines. This will be done primarily through IFTTT integration so that the user can start this process from the comfort of their bed.

Parts

The following parts are incorporated into this project:

1 x Particle Photon

1 x Adafruit Neopixel Ring 24 x 5050 RGB 

1 x Phone with IFTTT application 

1 x Pushbutton

1 x Switch


Process

Having limited experience with prototyping electronics. I started small by creating a circuit that published an event when a push button was pressed. This proof of concept would allow me to utilize this as a shell to activate portions of code based on a button press.

Show Advanced Options

Once this was completed, the next task was to interface with the NeoPixel RGB ring. Adafruit has an Arduino library available which has basic commands for the ring. This library along with the functions allowed me to program the gradual transition from yellow to red to simulate the sunset. 

Show Advanced Options

After, a switch was added so that the user could turn off the NeoPixel without having to unplug the Particle Photon. This was challenging because the way in which the NeoPixel sends information to each of its RGB LEDs. After the signal specifying the color reaches the LED, it will stay that color until otherwise specified. If the NeoPixel loses power, it will not turn back on until the circuit is closed and a signal is sent to the LEDs. To fix this. The switch is set as an input so that when the switch turns off, the Photon tells the LEDs to display no color. When it turns on, it the NeoPixel will glow a bright yellow.

Once the colors of the sunrise and sunset fading patterns were refined, I then implemented IFTTT to turn activate these functions. This was done by creating a push button on the phone that sends an event to the Particle cloud. The Photon uses a subscribe command to look for the event name and execute the function once it is received. The entirety of the code for the Sunrise Lamp, as well as the wiring diagram, can be found below.

Show Advanced Options
Sunset lamp diagram bb
Show Advanced Options

Outcome

The culmination of this project resulted in successful integrating a smartphone with a Particle Photon in order to create a lamp that cycles between "Sunrise," "Sunset," and "off" in order to allow users to get into the proper mental state to start and end their day. For the purposes of this demo, the transition times are quick. Changing variables in the code could allow the transitions to fade over the course of several minutes.

Show Advanced Options

Reflection

Troubleshooting code can be incredibly frustrating. There was one point where I spent two hours attempting to run my code only to find out that I had missed a semi-colon to close a line. This error had been cascading down my code resulting in it failing to compile. A keen eye and good documentation of what needs to be done can help save time when you are prototyping and developing code. This first leap into the world of interconnected devices has gotten me excited for my next prototypes as I continue to grow comfortable with code and circuitry.

Drop files here or click to select

You can upload files of up to 20MB using this form.