Fireplace
Fairy at Table
Fairy in Trees
Circuit Test
Wiring
Material List:
Fairy house diorama
4 string lights
CPX Board
5 Cables
Copper tape
Adhesive tape
Expected interaction: When someone turns off the lights, the string lights, in the shape of fairies will light up. The fireplace will flicker. When the lights turn on, the string lights will turn off.
Overall, I really enjoyed working on this project. It felt good to take an old piece of my art and continue its life with new skills I have learned. I had a high sense of self efficacy for the hardware and artistic elements of this project. I felt confident because I had made similar wiring choices during the group project and this past experience was scaffolding for me. I was less sure about the coding, however felt ready to problem solve.
Shaping the string light wires took a lot of in the moment problem solving and flexibility. I enjoyed this challenge as I found ways to make the shapes I wanted for fairy wings, secured the wires within the branches of the fireplace and pine cones, and then find a subtle way to run all the wires either along the bottom or back of the structure so they could connect to the copper tape for the CPX board.
The more challenging part for me was the coding (many versions of code included below). In my original vision of the project, when the lights turned off, the fairies would turn on and the fireplace would flicker. This would remain true until the lights were turned back on. However I ran into a few problems with the code. Firstly, I couldn't find a way to make the fireplace flicker indefinitely. As a pivot, I set it to flicker 30 times before remaining consistently on. As I worked with the code, I came up with the idea of having have the fairies turn on one after the other instead of all at once. I was hoping to create a sense of the fairies flying home and then lighting the fire, which turns on last. This was not in my original idea and was a fun way to expand the project as I saw the different ways I could manipulate the timing.
The next challenge I faced was the light sensor. When I use the On Light function, the CPX board was able to sense darkness and activate the fairies very effectively. However, I could not get the fairies to turn off once the lights came back on. The other option I used was setting the light threshold. However this proved unreliable. Although I adjusted the number along a wide range, I could not find a threshold that consistently reacted to the lights being on or off. This was disappointing, however I chose to use the first set of code for the final presentation because it bet demonstrated the initial input and reaction.
Beyond this project, something I have been struggling with lately is time management. I find I unexpectly have days full of meetings, classes and activities, starting at 9am and often not fully ending until 10 or 11pm. After a few days of this, I find myself so exhausted I need a day or two with nothing scheduled. This intense fluctation is not sustainable as I move through the semester and I am trying to create more balance. In this final project, I encountered a few unexpected turns and had to be creative in both the hardware and software. As I continue to work on scheduling, I will try to notice when I start to feel tired in my day and adjust according to what my body is telling me. One tool I use when struggling with time management is blocking out periods in my calendar each day for intentional rest. In this project I was systematic in my approach and created multiple options as solutions. By both building in intentional rest, and scheduling fewer things each day and spreading them out to different days, I can employ multiple forms of problem solving that are systematic, especially as I use my calendar to support this.
Final Code Option 1 - Problem: Does not turn off when lights come back on
input.onLightConditionChanged(LightCondition.Dark, function () {
// wait
pause(200)
// turn on top fairy
Top.digitalWrite(true)
// wait
pause(2000)
// turn on trees
Tree.digitalWrite(true)
// wait
pause(2000)
// turn on table
Table.digitalWrite(true)
for (let i = 0; i < 30; i++) {
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
// turn off fireplace
Fireplace.digitalWrite(false)
pause(100)
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
}
if (input.lightLevel() < LIGHT_THRESHOLD) {
// turn off fireplace
Fireplace.digitalWrite(false)
// turn off top fairy
Top.digitalWrite(false)
// turn off trees
Tree.digitalWrite(false)
// turn off table
Table.digitalWrite(false)
}
})
let LIGHT_THRESHOLD = 0
LIGHT_THRESHOLD = 0
let Fireplace = pins.A1
let Top = pins.A2
let Tree = pins.A3
let Table = pins.A4
Final Code Option 2 - Problem: Light Sensor unreliable
let LIGHT_THRESHOLD = 50
let Fireplace = pins.A1
let Top = pins.A2
let Tree = pins.A3
let Table = pins.A4
forever(function () {
// if the darkness is above a threshold value
if (input.lightLevel() > LIGHT_THRESHOLD) {
// turn on top fairy
Top.digitalWrite(true)
// wait
pause(2000)
// turn on trees
Tree.digitalWrite(true)
// wait
pause(2000)
// turn on table
Table.digitalWrite(true)
// wait
pause(1000)
for (let i = 0; i < 30; i++) {
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
// turn off fireplace
Fireplace.digitalWrite(false)
pause(100)
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
}
} else {
// turn off fireplace
Fireplace.digitalWrite(false)
// turn off top fairy
Top.digitalWrite(false)
// turn off trees
Tree.digitalWrite(false)
// turn off table
Table.digitalWrite(false)
}
})
Attempt 1
// use the light sensor to control neopixels when
// there is a lot of light, all are pink when it is
// dark, they sparkle
let LIGHT_THRESHOLD = 20
let Fireplace = pins.A1
let Trees = pins.A2
let Table = pins.A3
let Bed = pins.A4
forever(function () {
// if the darkness is above a threshold value
if (input.lightLevel() > LIGHT_THRESHOLD) {
// turn the pin on
Fireplace.digitalWrite(true), light.setBrightness(6)
// wait 500 milliseconds (half a second)
pause(20)
// turn the pin off
Fireplace.digitalWrite(false)
// wait 500 milliseconds (half a second)
pause(5)
} else {
// light all neopixels pink
light.setAll(light.rgb(255, 20, 147))
}
})
Attempt 2
let LIGHT_THRESHOLD = 50
let Fireplace = pins.A1
let Top = pins.A2
let Tree = pins.A3
let Table = pins.A4
forever(function () {
// if the darkness is above a threshold value
if (input.lightLevel() > LIGHT_THRESHOLD) {
for (let i = 0; i < 15; i++) {
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
// turn off fireplace
Fireplace.digitalWrite(false)
pause(100)
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
}
// turn on top fairy
Top.digitalWrite(true)
// wait
pause(2000)
// turn on trees
Tree.digitalWrite(true)
// wait
pause(2000)
// turn on table
Table.digitalWrite(true)
} else {
// turn off fireplace
Fireplace.digitalWrite(false)
// turn off top fairy
Top.digitalWrite(false)
// turn off trees
Tree.digitalWrite(false)
// turn off table
Table.digitalWrite(false)
}
})
Attempt 3
input.onLightConditionChanged(LightCondition.Dark, function () {
for (let i = 0; i < 15; i++) {
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
// turn off fireplace
Fireplace.digitalWrite(false)
pause(100)
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
}
// turn on top fairy
Top.digitalWrite(true)
// wait
pause(2000)
// turn on trees
Tree.digitalWrite(true)
// wait
pause(2000)
// turn on table
Table.digitalWrite(true)
})
input.onLightConditionChanged(LightCondition.Bright, function () {
// turn off fireplace
Fireplace.digitalWrite(false)
// turn off top fairy
Top.digitalWrite(false)
// turn off trees
Tree.digitalWrite(false)
// turn off table
Table.digitalWrite(false)
})
Attempt 4
input.onLightConditionChanged(LightCondition.Dark, function () {
let LIGHT_THRESHOLD = 0
for (let i = 0; i < 15; i++) {
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
// turn off fireplace
Fireplace.digitalWrite(false)
pause(100)
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
}
// turn on top fairy
Top.digitalWrite(true)
// wait
pause(2000)
// turn on trees
Tree.digitalWrite(true)
// wait
pause(2000)
// turn on table
Table.digitalWrite(true)
if (input.lightLevel() < LIGHT_THRESHOLD) {
// turn off fireplace
Fireplace.digitalWrite(false)
// turn off top fairy
Top.digitalWrite(false)
// turn off trees
Tree.digitalWrite(false)
// turn off table
Table.digitalWrite(false)
}
})
let LIGHT_THRESHOLD = 50
let Fireplace = pins.A1
let Top = pins.A2
let Tree = pins.A3
let Table = pins.A4
Attempt 5
input.onLightConditionChanged(LightCondition.Dark, function () {
// turn on top fairy
Top.digitalWrite(true)
// wait
pause(2000)
// turn on trees
Tree.digitalWrite(true)
// wait
pause(2000)
// turn on table
Table.digitalWrite(true)
for (let i = 0; i < 30; i++) {
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
// turn off fireplace
Fireplace.digitalWrite(false)
pause(100)
// turn on the fireplace and flicker
Fireplace.digitalWrite(true)
pause(100)
}
})
let LIGHT_THRESHOLD = 0
let Fireplace = pins.A1
let Top = pins.A2
let Tree = pins.A3
let Table = pins.A4
forever(function () {
if (input.lightLevel() < LIGHT_THRESHOLD) {
// turn off fireplace
Fireplace.digitalWrite(false)
// turn off top fairy
Top.digitalWrite(false)
// turn off trees
Tree.digitalWrite(false)
// turn off table
Table.digitalWrite(false)
}
})