Light Wk 2: Candle

Code here

When you touch the circle “button”, the light will go to flickering state. If the button is pressed for 2 seconds, the light goes to “wild” flickering state. If the button is pressed for another 2 seconds, the light will go off. After 5 seconds of being off, the candle will light up again.




This week, I was excited to a.) capture the beauty and movements of a candle, b.) switch my work flow so that I program more. My personal goal was to try and spend less time on fabricating and challenge myself with the code.

a.) I first tried to map out how the LEDs of the Neopixels are numbered. This helped for making arrays and knowing how the indexing would work.

steps and numbering

b.) I observed the candle and ideated the various states that I wanted to recreate.


c.) Based on the flickering/ blowing out candle observation, I decided on 2 states, but initially ended up with 4 states: a.) calm, b.) crazy, c.) wild, d.) off.

Calm = normal state
Crazy = flickering
Wild = randomly wild flickering (like right before a candle blows out)
Off = when it’s so wild that it eventually blows out.



d.) Simple fade: I first attempted to do a simple, pulsing fade that loops through all the neopixels. Here is my code for that. 


e.) Different intensities: I tried to create my initial 2 states (calm and crazy). I used a touch sensor to switch between the states, but was not set on using it as my final sensor. I was still hoping to play around with different sensors.

Code is here. 


d.) testing piezo (ultimately unstable, therefore fail): I tried testing the piezo, but when I console logged it, the reading of the amount of movement was very unstable and hard to get the lights to show the different states.

Here is the code for my attempts with the piezo.


e.) testing accelerometer: I really wanted to try the accelerometer for the candle. I was hoping that the more you move the candle, the more it would flicker and eventually go out like a flame. Unfortunately, I ran into road blocks with my code and my soldering for the accelerometer went loose. I also realized from this test that the interaction would be weird if I had the wires attached to the arduino like that.

In the end I decided against using it for the final piece, but did enjoy trying to learn how to use an I2C accelerometer. Here is my code for that. 


f.) Timer: I just had to bring this up because it caused a headache for me. At first I used the Simple Timer Library. This was helpful but realized it counted the seconds from the start of the program. In order for me to have my touch sensor react to the amount of seconds that is being pressed, I needed to record that press time into a new variable. I ended up not using the Simple Timer Library, but writing my own if statement to create a timer that starts when the button is pressed.


g.) Form: Unlike my usual flow, I focused on the form after I had figured out my code. This was very hard for me to do since I normally want to jump into making the physical product. Nonetheless, it was good practice for me to push myself. By Monday, I was able to start making the the enclosure and diffuser.

I thought of different types of diffusers: resins, paper cylinders, already found containers (gum bottle). See sketch below.


In the end, I decided upon a crystal. I found the refracted light in the crystal rock to be so magical. It really distorted the light so it was hard to tell the source. It also reminded me of the rocks used in fireplaces. See below for example.


I decided to go with it and focus on how to enclose the touch sensor and Neopixel in a way that would go well with the rock. I went simple and used white acrylic I already had to build a box to house the touch sensor.


h.) Fabrication: see subtraction post for details on milling.

first I started with measurements.

I also wanted to make some holders for the touch sensor and the neopixel to sit on nicely. See sketches below for my mounting ideas. I combined with my subtraction homework to use The Other Mill, to get a 2.5D part.

Soldered my Neopixels and sensor on a pcb board.

Enclosure close to being done!


After doing this I realized, I am not a big fan of the white acrylic. It made the enclosure look slightly translucent, but it was too late in the game to change. Ideally, it would be black acrylic, not white.

I added the crystal on the top and added in one extra in between calm and wild state, called crazy state.

Final, final code is here. 



Stumbled upon some helpful blogs, resources and libraries throughout this project. Need to be sure to keep these in mind for the future:

Accelerometer MMA8451 Data Sheet: