A Smart Night Light Stuffy


Front of Stuffy
Fig 1 - LED on front
Back of Stuffy
Fig 2 - Lilypad and light sensor
Coding the stuffy
Fig 3 - Coding

A project tinkering with coding, hardware, mathematics and design. Plus its a very cool and interesting thing to learn!

 

Items used

Download my Arduino code for the Night Light Stuffy on Github.

 

View my Arduino code on Pastebin

 

All items are available from your local electronics hobbyist store or from Sparkfun.

 

How its made?

 

A thrift store stuffy is given a second life as a smart night light. The Lilypad board is sewn with conductive thread to the back of the stuffy and connected to the Lilypad RGB light emitting diode (LED) board and the Lilypad light sensor.

 

From online resources available at lilypadarduino.org, an Arduino sketch reads the input from the light sensor and depending on the level of light in the room activates the LED.

 

In bright light (like daytime) the LED turns off, as the surrounding area gets darker and the intensity of the light changes, the LED cycles to blue, to green, and finally to red (darkness).

 

This is a very simple design, but lays the foundation for more complex interactions.

Why its delicious?

 

Design

This project teaches several things to a learner. You learn to sew and figure out challenges when stitching into a very pliable and three dimensional material like a stuffy. Its a much different than stitching into thin straight cloth. How do you make a stitch through the "fuzzy" fabric? How to do you tie off the ends at the circuit boards? These are challenges to overcome.

 

Engineering

You learn about how a sensor works. The light sensor produces different voltages depending on light intensity hitting the sensor. You understand how a sensor is wired up and sends a signal to the Arduino micro-controller. In engineering terms, the sensor is acting as a voltage divider.

 

Math

You also have to understand the math inside the system. The sensor produces a voltage value which fluctuates. That reading to be converted into a scale (ratio and proportion) and that scale is mapped to a set of intervals which correspond to different colors (a decimal number line).

Fritzing Diagram
Fig 4 - Fritzing Diagram

Computational Thinking

You also need computational thinking. How do you write code that takes math and makes it into a living and reacting thing. How do you to read sensor values and compute corresponding colors. In computing science (CS) terms, you are using the concepts of variables and data types, decision statements, functions to bring code to life.

 

Writing

You also have to write. A good programmer should leave lots of documentation (comments) inside their code. The comments explain what each line or block of code does. You'll also need to know how to spell - at least in the language your coding. Can't spell properly, the program comes to a screeching halt. You'll have to fix it because no one else will.  So when you want to come back and make it even more awesome, you'll remember what you did.

 

"Extra Credit"

You have a entire hardware and software platform to work with here. What if at night you want the LED to oscillate in intensity, like a heartbeat pattern? Somewhere you probably heard about sinusoidal functions (rising and falling). What does that look like in real life? How fast will the oscillation happen (periodicity)? Its time to dig out your trigonometry. [Edit: I did another blog post if you really want to know how its done]

 

This project has a ton of skills and applied thinking in it. You start with it being basic and then get as creative as you want. It covers a wealth of mathematical, applied skill, and writing. If you are really good with your design you could even sell them!

 

Breathe new life into stale exercises. Run (not walk) to this world of technology. You and your students can spend hours tinkering and experimenting with math, science, logic, and creating.