Mason Jar Snow Globe
2017-12-19 | By Adafruit Industries
License: See Original Project Circuit Playground
Courtesy of Adafruit
Guide by Peli de Halleux
Shiny Snow Globe!
Circuit Playground Express are here to cheer you up.
In this project, we will use the 10 NeoPixels of the Circuit Playground Express to light up a DIY snow globe. For the body of the globe, we'll use an everyday mason jar, you can find these in your hardware or grocery store.
Sounds simple? Let's do it.
Materials
Pick a jar and an extra lid to build the snow globe. The extra lid should be large enough to hold the Circuit Playground Express. You will also need a tool to cut into the lid and a glue gun.
Building the base
Place the Circuit Playground Express inside the lid and mark both sides for the JST and USB connectors. Cut out openings and make sure you can squeeze the cables in.
Connect the globe
Build your favorite snow globe using one of the gazillion tutorials online. I just used water, glycerin, and glitter. When you're done, use glue to secure the lid to the bottom.
Unplugging...
Once the glue is solidified, you can carefully "unplug" it from the lid. It is now molded/casted to the lid and easily sits on it. Since water and electronics don't work well together, it's easier to keep the Circuit Playground Express while working on the liquid part of the globe...
Pro tip: Automatic stirring
Dip a Playmobil underwater motor in your globe to keep these glitter particles moving!
Light show
An easy way to get started is to run a bunch of animation in a forever loop. Go to https://makecode.adafruit.com and drag various animations from the LIGHT drawer. Download the code to your board and voila!
loops.forever(function () {
light.showAnimation(light.rainbowAnimation, 2000)
light.showAnimation(light.runningLightsAnimation, 2000)
light.showAnimation(light.cometAnimation, 2000)
light.showAnimation(light.sparkleAnimation, 2000)
light.showAnimation(light.colorWipeAnimation, 2000)
light.showAnimation(light.theaterChaseAnimation, 2000)
})
Clap clap
We would like to be able to turn on and off the light easily. The board is tucked under the globe so buttons or gestures are not really doable... which leaves us with the microphone!!!
Using the on loud sound, we switch the animation on and off. We use a variable on to keep track of the animation state (true = on, false = off).
When the variable on turns false, we cancel the current animation and clear the LEDs. The forever loop keeps running in the background but only animations when on is true.
let on = false
input.onLoudSound(function () {
on = !(on)
if (!(on)) {
light.stopAllAnimations()
light.clear()
}
})
on = true
light.setBrightness(255)
loops.forever(function () {
if (on) {
light.showAnimation(light.rainbowAnimation, 500)
}
})
Have questions or comments? Continue the conversation on TechForum, DigiKey's online community and technical resource.
Visit TechForum