All posts tagged LEDs

Highchair Blinky

Here’s my third baby/toddler blinky toy, and first official entry to the canon of IKEA hacks… the blinking high chair, aka the Antiloputer.

This is four arcade buttons and four smart full-color LEDs, drilled into an IKEA Antilop high chair (a spare tray is $5). The brain is a 5v Adafruit Pro Trinket, powered by four AA batteries.

The default mode is the same as the blinky my dad made for me long ago: press the red button and the red light lights up, press the green button and the green light lights up, and so on.

Holding down all the buttons at once lets you switch modes: mode two is like mode one, except each light stays on until the next one is pressed. Mode three is like a typewriter, and mode four is a step sequencer.

This was my first time programming with the FastLED library to control the LEDs. Download the code here.

highchair

I suspect the high chair wouldn’t make it through airport security — below is what it looks like inside… Normally, baby legs are protected from the electronics (and vice versa) by a piece of heavy cardboard.

highchair-inside

The buttons are attached between the regulated 5v power rail on one side, and pins 10-13 on the other, with a 10k ohm resistor running to ground from each. The LED data is on pin 9, and power for the LEDs also comes from the 5v power rail, through the Trinket. I did this since the 6v coming directly from the batteries is too much for the NeoPixels.

The Trinket can only provide 150 mA, which is pushing what four LEDs will draw at max brightness. Fortunately, the FastLED library has a line where you can specify the max current, and it will dim the LEDs as needed. Genius.

highchair-board

The LEDs are below the high chair tray, aimed up through small holes. I hot glued translucent plastic containers from an art store over the holes, which glow nicely. Be warned, babies are stronger than hot glue, although there’s no danger if the containers get ripped off. You could probably skip the holes and containers, since the LEDs are bright enough to show through the tray.

Also check out the BABYTRON for more blinking.

Switches!

My grandfather built a panel of light switches from WWII surplus for my dad as a toddler, and my dad built a panel of buttons connected to indicator lights for me. So now, I’ve built the Model C, a set of light switches for my daughter. It’s easier than holding her up to play with the house lights.

switches

These switches are connected to white LEDs, powered by two C batteries. The switches are hot glued to holes drilled in a board, covered with plastic containers from an art store.

I used the LED wizard to figure out what resistor to use. Burnt out LEDs stink, literally.

Next up, the Model D, using programmable LEDs in a high chair.

[UPDATE] The lights are in holes beneath translucent plastic containers. I put some cheap plastic Easter eggs inside, and voila! Now in color!

switches-color

Toddler’s Cardboard Computer

My one-year old daughter looooooves buttons, and always wants in on the action when someone’s using a computer… so I transformed her new car seat box into the BABYTRON, inspired by the Burroughs B205.

It features a keyboard, arcade buttons, and a strip of LEDs from Blinkinlabs.

The LEDs have a built-in controller, so no wiring was required beyond USB power. In fact, the whole computer was assembled only using glue, tape, scissors, and string. The buttons don’t control anything — but they do make a satisfying “click” when pressed.

There are several ways to talk to the Blinkinlabs LEDs. I’m familiar with Adafruit’s NeoPixel library, so I told the Arduino IDE that it was a Leonardo, assigned data to pin 13, and uploaded my sketch. Code here.

I kept the brightness of each LED below 20 out of 255, because they’ll hurt your eyes if fully on. It’s also running off a portable USB battery pack, so I wanted to keep the power draw fairly low.

I did consider adding a tape drive, using a paper plate behind a round plastic cover from a food delivery container, powered by a LittleBits motor. Next time.

It turns out that this is ideal for someone who’s able to stand up while holding onto something, but can’t walk on their own. My daughter’s younger friends love it. But she’s now savvy to the buttons not doing anything, and is most interested in the power button — the one that mom and dad push. Time to build something else and recycle the BABYTRON.

(Wire) Stripper Cake

This is a case of knowing your audience: my friend Matt is deeply involved in the world of creative DIY electronics, and appreciates a good (ie. terrible) pun. So for Matt’s bachelor party, fellow groomsman Ethan and I arranged for a stripper to pop out of a cake — but in this case, it was a wire stripper (an electrician’s tool) animated by a jumble of electronics, in a cake which we built.

After dinner, we lit the candles on the cake (it was also Matt’s birthday), and in the dim light of the BBQ joint, the illusion was convincing.

Cake

But once Matt made his wish and blew the candles out, the top opened up revealing a stripper dancing on a stage, complete with flashing lights and music!

Cake

The cake’s frosting is a sheet of white foam material from an art store, held on with Velcro stickers. The decorative chocolate frosting is brown caulk.

Beneath the frosting is a laser-cut plywood frame, with threaded dowels, nuts and washers. The top has a hinged lid with the stage slotted and glued inside.

Cake

Cake plans
Cake plans
Cake plans

A hidden power switch in the back provides 6V from four AA batteries to an Arduino Duemilanove microcontroller, which we programmed to run the show.

Cake

First, all the lights flash red, as a motor with built-in gear reduction box pulls a string attached to the lid’s counter-lever, opening the lid and raising the stage. (We used this motor driver).

Cake

Cake

Once the stage is up, the lights change to a cycling rainbow pattern. We used four of Adafruit’s 8-NeoPixel strips, all chained together in series. The first NeoPixel strip is on stage, lighting up the wire stripper.

Cake

Other NeoPixel strips are on the middle ring, lighting the inside of the cake in all its mad scientist glory. The white foam frosting is translucent, so the whole cake glows brightly on the outside.

Cake

Beneath the stage, a motor with an elliptical wheel makes the wire stripper kick its leg and dance the can-can.

The original plastic geared motor for this section melted when we tried to solder on the power cables. The Radio Shack replacement didn’t have enough torque. So we used a spare littleBits motor. It later burned out because we’d run out of time and didn’t regulate the voltage, but by then it had done its job.

Cake

Music is from a chip I ripped out of a greeting card years ago, wired up to a small speaker. It plays the theme from “The Good, The Bad, and The Ugly.”

Cake

When you’ve had enough of the show, you can reach in through the top and press a microswitch (center of the picture, on the middle ring), which stops the dancing, turns all the lights to blue, and closes the cake up again.

Cake

We built the whole thing in very little time, and it has a cobbled-together, hot glue aesthetic. Not the finest engineering, but Matt loved it, which is all that matters.

Cake

Blinky Love Note

I made a blinky love note for my sweetheart this Valentine’s Day, because what’s more romantic than Morse code?

morseblinky

A single LED paints a 6″ x 6″ canvas with light. It first tells a story through color, and then slowly pulses a secret message in Morse code, fading from deep to light pink.

The smart LED is run from a 5v Adafruit Trinket, powered by 4 AA batteries. Download the code here. (This just blinks “hello world.” The secret message will remain secret).

LED Strip Clock

I just put together a clock with Adafruit’s 60-NeoPixel LED strip, running off a Teensy 3.0 microcontroller. The flexible 1-meter strip has 60 RGB lights, so different colors represent the second, minute, and hour — you can read it like a normal clock if it’s in a circle, but you can also leave it in a straight line or drape it over something for the Salvador Dalí look.

Version 1 of the clock code advances the second using the delay() command, and moves the minute every 60 seconds and hour every 60 minutes. It’s a good exercise in procedural logic, but loses time quickly.

Version 2 uses a crystal soldered directly onto a Teensy 3.0, which will keep time if you attach a watch battery. Look at the Teensy Time Library page for more info.

The LED clock lets you pick different color schemes, add faint dots every 5 or 15 minutes (or none), and turn on blinking hour “chimes.” Right now you need to set these options in the Arduino IDE and re-upload, but I’ll add the ability to change that with buttons or a knob at some point.

View or download the code here.

pixelclock1

I don’t have any pictures of the final clock in action — I gave it to my dad.

pixelclock2

[UPDATE 5/24/14]

I’ve discovered some design problems with this project. First, Adafruit recommends adding a capacitor between the – and + on the NeoPixel strip, and a 300 to 500 ohm resistor between the Teensy’s data pin and the NeoPixel data-in (at the NeoPixel end of the connection). This doesn’t affect the clock’s performance, but protects the NeoPixels from damage.

Second, I’ve gotten reports from someone who built this project that occasionally the second-hand LED stays on until the next time it passes by. I got a lot of glitches the first time I had v1 hooked up, but that got resolved when I used a different power supply. But the Teensy 3.0 uses 3.3V logic, and the NeoPixels are powered at 5V.

The Adafruit NeoPixel Überguide says that the data has to be at least 70% of the power or its message will get lost, and 3.3V / 5V is 66%. Close enough to work most of the time, but I’m guessing that the glitches occur when the signal doesn’t get through.

The best thing to do is add an I2C-safe Bi-directional Logic Level Converter to boost the 3.3V data to 5V. But if you’re using a Teensy 3.1 which has 5V tolerance on all digital pins (and presumably won’t get damaged by talking to a 5V device), then try this revised code for v2. I added redundancy to the erase and write message, to give it a better chance of getting through.

I’m checking to make sure that, glitches aside, nothing will get damaged with this setup. Stay tuned…

LED Candle in a Jar

I’ve been wanting to create a small light with realistic fire animation, so hot off the workbench in time for mid-winter: a flickering LED candle.

Its brain is a programmable microcontroller, running a smart RGB LED via a single data pin, housed in the lid of a jar. I used Adafruit’s Atmel-powered Trinket — a tiny, inexpensive board available in 3.3V or 5V flavors.

Here are three prototypes:

1) A self-contained 3.3V candle with a single Flora NeoPixel, powered by a tiny rechargeable 150mAh lipo battery inside the lid, with a pushbutton toggle power switch hot glued to the outside of the lid.

lantern3v

2) A 5V single-pixel candle, with Trinket on the outside for powering via USB, plus an extra 2.1mm socket for external wall or battery power. I used a nail to punch holes in the lid for the wires, and a diagonal cutter for the power socket. The Trinket is held down with hot glue.

lantern5v1

3) A 5V 8-pixel candle using Adafruit’s 8 NeoPixel Stick, with all electronics inside the lid and a 2.1mm power socket on top. The Trinket can handle 150mA output, which is right around the stick’s draw when all pixels are set to candle flame yellow (R=255, G=100, B=10) — but the stick jumps over 200mA when fully lit, so it gets its power upstream from the Trinket.

lantern5v8

The jars have a white paper disc at the bottom and a tracing paper tube running the jar’s height. I plan on replacing them with some theatrical lighting diffusion so nothing bursts into flame — probably not a risk, but you never know.

The Arduino code runs a basic fade on the green pixel, causing it to dip down and back every 120 milliseconds, roughly 8 times per second. When the green dips, the light gets dimmer and redder, as if it’s losing oxygen.

An RGB mix of 255, 100, 10 (on a scale of 0 – 255) looks like a pretty good candle flame yellow to me. The starting green pixel value is “grnHigh.” You then set how much below grnHigh the green pixel should dip for normal burning, and when it’s flickering more. “grnLow” is grnHigh minus the dip value.

The main function is a basic for-loop, called fire()

void fire(int grnLow) {
  for (int grnPx = grnHigh; grnPx > grnLow; grnPx--) {
    strip.setPixelColor(0, redPx, grnPx, bluePx);
    strip.show();
    delay(fDelay);
  }  
  for (int grnPx = grnLow; grnPx < grnHigh; grnPx++) {
    strip.setPixelColor(0, redPx, grnPx, bluePx);
    strip.show();
    delay(fDelay);
  }
}

So green starts at grnHigh, the max green value, and decreases until it reaches grnLow, then goes back up again. fDelay is calculated by doing some math with the number of steps to keep the cycle time constant.

The next set of functions all call fire() with adjusted dip and delay time. Your options in increasing amount of animation are: on(), burn(), flicker(), and flutter().

The main loop just looks something like this, with the variable as the number of seconds you want each animation to run:

void loop() {
  burn(10);
  flicker(5);
  burn(8);
  flutter(6);
  burn(3);
  on(10);
  burn(10);
  flicker(10);
}

The Adafruit NeoPixels officially run on 5V, but according to the power page of the Adafruit NeoPixel Überguide, small numbers of NeoPixels can run off 3.7V. (I’m powering them from the 3.3V pin on the 3.3V Trinket, and it seems to work). The thing to consider is that green and blue pixels draw more power, so they’ll be dimmer and the whole RGB effect will be warmer. So grnHigh, bluePx, burnDepth, and flutterDepth all need to be tuned higher for the 3.3V version. I eyeballed 3.3V next to 5V, and include both values in the sketch’s comments.

lanternOn

For the 8-pixel strip (above), I created a color and flicker-depth gradient that was more exaggerated toward the top, and not at all at the bottom. It’s supposed to look like the flame height is dancing. It looks more convincing, but the portability of the battery-powered 3.3v model’s pretty nice — and the lid fits on any Ball jar (below).

ITPjar

Get the full code here: https://github.com/timpear/NeoCandle