Charlieplexing LEDs with an AVR ATmega328

3 Comments

This is the first in a two-part series. This first article made me realize there’s a lot of ground to cover and we’re already in the tl;dr territory.

How many times has this happened to you? You have a little LED project with an AVR ATmega328 microcontroller (or Arduino) at its core and you need to light up a boatload…. A dingyload of LEDs. Maybe it doesn’t happen a lot to you. It’s happened on three recent projects for me. My latest two LED projects are a timekeeping piece that illuminates 21 characters from behind and a simple LED chaser thing.

As usual I wanted to keep the component count down on these projects. I also tend to prefer not to use a ton of ICs with busses between them and whatnot, if I can help it. So much darn soldering and stuff. Meh. Luckily, back in 1995, so the Wikipedia story goes, a super-smart dood named Charlie Allen at Maxim Integrated devised a super-ingenius way to control a large number of LEDs using a not-so-large number of microcontroller pins. The method is called, “Charlieplexing” and it seems a but daunting, at first, but it’s not that bad once you figger it out.

The core of this concept is based on the fact that diodes only allow current to flow in one direction. The “D” in “LED” stands for “diode.” Ergo, LEDs are diodes. LEDs only light up when connected a particular direction. Put two diodes in parallel BUT in the opposite-facing direction and you can turn on one or the other simply by switching the polarity of the ends of the circuit. Fun! Diagram:

Two LEDs in Parallel

Two LEDs in Parallel

Let’s assume I have a 3V little coin cell running this thing and limiting resistors and CCRs are not our thing, today. Why not? Anyhoo… Looking at the diagram, you see I’m using GPIO pins from an Atmel ATmega168 AVR microcontroller (it was readily available in the library in Fritzing, the program I used to throw together the drawring diagram schematic thing above). If I configger A0 and A1 as outputs and then set A1 HIGH and A0 LOW, I can turn on LED1. If I flip the states of the two pins and make A1 LOW and A0 HIGH, LED2 will light. Here’s a animated GIF of how it works with direct connections from the LEDs to 3V lithium coin cell on a breadboard:

Parallel opposite polarity LEDs flipping state

Parallel opposite polarity LEDs flipping state

Watch carefully and you’ll see that I switched the positive and negative to make one or the other LED light. Easy as pie. Imagine each wire from the battery is a GPIO pin from a microctonroller. All I’m doing up there is making one HIGH and one LOW and then flipping them back and forth.

More

VN:R_U [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:R_U [1.9.22_1171]
Rating: 0 (from 0 votes)

Making Mad Props for meltmedia’s Interactive Superhero Marketing Launch: Techno HAMMER

1 Comment

I believe I’ve mentioned it before: I work at an amazing web and software development shop called, “meltmedia.” We have a gaggle of highly talented software engineers, web developers and designers. Sometime back in 2011, meltmedia was in search of  a new tag line to kick off a for-real live marketing campaign. Marketing was something melt hadn’t worried about before then.

While in San Francisco at the 2011 Apple World Wide Developer Conference, in a bourbon-fueled barrage of submissions to the company’s on-line suggestion box for new company tag lines, I came up with, “We are Interactive Superheroes.” It stuck and I won a $90 bottle of bourbon. Woohoo! To be clear, I am fueled by many things: Caffeine, sugar, soda, etc., not just bourbon. I like chocolate milk. I happen to be a major bourbon geek and had been sampling fine bourbons at a speakeasy in San Francisco called, “Bourbon & Branch” before I went back to the hotel and started submitting dozens of mostly silly ideas for meltmedia’s new tag line.

For the short attention span version of this, here is a photo of the three partners of meltmedia in their full costumes with their props:

meltmedia Partners in Full Costume and Props

meltmedia Partners in Full Costume and Props

More

VN:R_U [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:R_U [1.9.22_1171]
Rating: 0 (from 0 votes)

RoboStocking – AVR, Servo, Motor, IR Sensor, and BOOM!!! Merry Christmas!

No Comments

At the office, we decided we were going to have a stocking decorating contest for Christmas. The rules were pretty lax, so I immediately thought of interactivity and electronics and blinky lights and whatnot. Well, that, and there was no way in you-know-what that I was going to hot glue glitter and spongy letters to a stocking with electricity being involved.

Here is a video of the final product to pique your interest:

How did I do it? Easy. Some AVR programming (through my usual Arduino hackery) and some simple electronics and BOOYAH! Motion activated stocking with a Santa sign and some jingle bells.

More

VN:R_U [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:R_U [1.9.22_1171]
Rating: 0 (from 0 votes)

AVR Serial Communications Using XBee RF Modules

No Comments

I was contacted by Element 14 (Newark.com) recently about doing some product test drives using some of the products from their line card. I took two to three seconds to think about it. I know, tough one…

XBee S2 ZigBee RF modules by Digi International

XBee S2 ZigBee RF modules by Digi International

I have been chomping at the bit to use ZigBee wireless technology in a project. Digi International makes some REALLY cool and easy-to-use ZigBee RF modules that bring ZigBee technology down to a level that even I can implement without more than a few terse passes at a wireless book and a couple of datasheets. So, the first piece of loot I requested from Element14 was an XBee S2 module. I would love to link you to this module at Newark.com, but it appears to be gone. That is sad. BAck to our story… There was a spending limit on my test-drive loot. I ordered one XBee S2 module on my tab. The other XBee module was sent to me courtesy of Element14.com.

The ultimate project is based on a need at our house: We hang out on the back patio quite a lot and when we invite guests over, even after we ask them to just come on in, they ring the doorbell and we can’t hear it out on the back patio. The leave disappointed that we would not be home when we said we would be. I’m kidding. Usually they do walk right in.

More

VN:R_U [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:R_U [1.9.22_1171]
Rating: 0 (from 0 votes)

Desktop Warp Core – The Early Years

No Comments

Well, we’ve moved into a new and larger space at the office and we sit at these massive wood and steel desks as teams. Our team decided we needed more “flare” at our desk, so, of course, a big-ass warp core was the first thing that popped into our heads. How hard could that be?

The rings of the warp core will be clear-ish fiberglass. The original master, over which we’ll make a fiberglass mold for all eight rings, is made of a giant laminated wood block we need to turn on a big lathe.

Laminating 2x6 pieces of pine for the ring master mold

Laminating 2x6 pieces of pine for the ring master mold

More

VN:R_U [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)
VN:F [1.9.22_1171]
Rating: 0 (from 0 votes)

LED Mood Lamp

2 Comments

EDITOR’S NOTE: I’ve attached PDF files of the pentagon PCB and the motherboard PCB. If I had time to label them and make them pretty, I would, but this was never designed for mass production or consumption. Use at your own risk and frustration.

For those with a short attention span, I give you a photo of the completed project (my biggest to date):

Completed LED Mood Lamp

Completed LED Mood Lamp

If you’re interested in the story of this things, continue reading…

This idea came about randomly as a gift idea for my wife. I’ve built useless machines, clocks, etc. for other people (and myself), but hadn’t built anything for my wife. I’m not sure what she’s going to do with this thing, but it’s the thought that counts.

More

VN:R_U [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +10 (from 10 votes)

USB Foam Dart Launcher Assimilated (Partially)

No Comments

A coworker walked up to my desk and handed me this USB-controlled Nerf-esque dart launcher thing from Think Geek because it wasn’t working. If it was dead, I thought I’d at least get a number of little motors and gears and whatnot. I took it home, removed all the screws and completely dismantled it to see how it works. It’s ingenious inside. I won’t get into it, but it’s pretty cool.

More

VN:R_U [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +2 (from 2 votes)

Update: LED Reading Lamp Materializing

No Comments

For those of you with short attention spans, like me, here is a quick and lame video I threw together in iMovie:

I am building this for the new awesome bed I will be building this winter for our bedroom. There will be two of these lamps, one for me and one for my wife on either side of the headboard. The LED head will have a metal (or whatever I end up finding) shroud on it to keep light pollution down to a dull roar for the other person who might be sleeping.

More

VN:R_U [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +3 (from 3 votes)

LED Reading Lamp

2 Comments

It’s been a little while since I updated the site. I’ve had a lot going on. There are a number of new builds I will be posting in the coming weeks. This is about the latest.

Problem: At night, when I read in bed and my wife is trying to sleep, the lamp on the night stand is kinda bright and obnoxious and, even though she says it doesn’t, the light disturbs her. I had been using a little USB-powered LED lamp that I bought for my laptop on long night time airplane rides. However, I can’t charge my iPhone while I’m using that light. Only one USB cable available at the night stand. Also, that light isn’t quite bright enough for my liking. What to do?

Build a reading lamp out of stupidly bright and nearly stupidly tiny LEDs.

Here is the proof print for the light’s PCB which will be mounted on the end of a flexible “gooseneck” that will extend from the night stand or from the headboard of our as yet unbuilt bed:

PCB Proof for LED Reading Light

PCB Proof for LED Reading Light

More

VN:R_U [1.9.22_1171]
Rating: 5.0/5 (1 vote cast)
VN:F [1.9.22_1171]
Rating: +1 (from 1 vote)