Tessel + NeoPixels + Web + More

About a year ago I bought a Tessel and a few NeoPixel combinations to start developing beyond the screen. Since I hadn't done any soldering since my Theremin craze, I had to get familiar with that again, but otherwise it was largely straightforward to jump in. I made a few small things like a "wreath" that changed colors depending on what holiday you were currently approaching. There was also what I called a baby monitor that used the ambient module to listen for noise (such as a cry) and fade in a soothing color and then fade it out.

My most recent small project revolves around a light show. My wife wanted to buy something that would cast light against a wall and move it to entertain our son. I suggested we try to build it ourselves with the Tessel, and now I have the initial version available on GitHub. Yes, we are talking kid eyes, and NeoPixels are bright, so it's important to note this is a proof of concept only. The ideal way to do this ultimately would be to put the Tessel and NeoPixels behind an object such as a dresser. That way you are just admiring the glow against the wall.

Here is the current code in action (not behind the dresser, simply to show what the NeoPixels are doing):

I'm taking a 60-LED strand of NeoPixels, using the handy Npx abstraction for working on Tessel, and setting up a 60 frame animation. I divide the strand into sections of ten NeoPixels, assign a different color to each section, and then move them one by one in each frame.

function colorWave() {
for (var c = 0, len = NEO_LENGTH; c < len; c++) {
var anim1 = npx.newAnimation(1);
anim1.setPattern(initialPattern(c, NEO_LENGTH));
npx.enqueue(anim1, DELAY);
}
run();
}

function initialPattern(start, length) {
var ra = [];
for (var i = start, l = start + length; i < l; ++i) {
var imod = i % length;
/* set color based on segments of 10, and push to array */
}
return ra;
}

function run() {
iterations++;
npx.run().then(function() {
if (iterations < 20) { //run this again
run();
} else { //turn off
npx.enqueue(npx.newAnimation(1).setAll('#000000')).run().then(function() {
npx.queue.pop(); //remove the "OFF" animation for future plays
});
}
});
}

The most interesting part was getting a server running so that I could pass commands to it to play and stop. Take a look at the code on GitHub (and the README) for the example. With these pieces in place I can push this code my Tessel, the animation will queue up, the server will set up, and then I can go to my controller page, press Play, and the light show begins.

That's it for now, but it got me thinking about other projects for parents. What I'd like to do next is also have the Tessel (and ambient module) listen for noise activity and push instances to Parse to chart out those times. The hypothetical use case here being for tracking a baby crying and how many times he or she woke up in the night.

Fitbit for baby. Because parents never remember how many times they got up the previous night.

When I do that I'll post about the process of sending data from the Tessel as well.