Introduction: A Charlieplexed Elf Hat

Picture of A Charlieplexed Elf Hat

Putting LEDs in things that didn't already have them for whatever reason is cool to any geek and non geek alike. My wife came home from work with a Christmas Elf hat, and told me that it is now a part of her uniform until after Christmas. There was nothing special about it, and we just felt it could use some jazzing up. I told her I would stick a few LEDs in it just to make it stick out. Simple enough task, but she had a different idea. A few LEDs just wasn't going to do for her, she wanted 10 LEDs that blinked and flashed in different patterns.

There are a lot of options to choose from to accomplish such a task, so I started digging through my parts bin to get some ideas of what I had available to use. I could have purchased an addressable led strip, and slapped an Arduino on it and called it done, but that was just too easy. At the end I decided to use charlieplexing to do what I needed. I had not done it before, and it seemed like a good challenge.

I'm not going to go into detail on how charlieplexing works, mainly because if you search Instructables, and Google, you'll find lots of explanations of charlieplexing. Its a very simple concept to follow.

Video: Youtube Video

Step 1: The Parts List

20 x LED's - You have a few choices, and the one you choose will determine also how much work it takes to put it together. You could choose 20 individual LEDs and solder all 20 to your project. You could also use a bi color LED like the ones used in this Instructable: https://www.instructables.com/id/The-RedGreen-LED-G... I was on a time crunch, and only able to find one of these at my local radio shack, but if I had found 10, it's the option I would have went with. Another option is a RGB LED and using only red and green, which is what I did. I had a roll of RGB 5050 SMD LEDs that I had left over from another project, so I put them to good use on this one.

10 x Resistors - This varies depending on which documents you are reading about charlieplexing. Most put 1 resistor on each pin and we needed 5 pins to power 20 LEDs. I hooked one resistor up to each RGB LED. I used 10 100 Ohm resistors (Brown Black Brown). The value depends on your resistors, but will most likely be somewhere between about 75 and 150 Ohm. If the resistor value is too big, your LED's will be dim. If they are too small, more than one LED will turn on at the same time.

1 x Arduino - I used an arduino pro mini 3.3v in my project for a few reasons. One, it was small and easy to hide in the hat. Two, it was 3.3v and was near the voltage for each led already. Third, and most important, I already had a few laying around.

Wire - I had a bit of 30 gauge wrapping wire laying around that I felt would work fine to connect to the LEDs them selves. For the wire coming from each Arduino pin I felt that I needed something bigger to allow power to flow better down the line. I found a few rolls of 16 gauge in the bin and decided it would be a good choice.

1 x Micro switch - Used as a power switch

Power - Trying to keep the size and weight down my first choice in batteries was a CR2032. This worked just fine for about 6 hours of use then the red LEDs stopped working, the power drained too fast. Next, I decided to go with a 9v battery. It was small and didn't add much weight to the hat and was still easily hidden. This lasted for about 3 days running 8-9 hours a day. There is a long time between now and Christmas, and I will end up buying a lot of batteries, so I am now looking for a small rechargeable battery that will last all day and can be charged at night. I will update things after I decide on which I will go with.

Step 2: Wiring Everything Up

Picture of Wiring Everything Up

First I had to connect the 5 16 gauge wires to the Arduino. I used pins 5 through 9 in my project. I also used alternating color wire, to make things a little easier when it comes to connecting LEDs to the correct pins.

Having chosen to use SMD LEDs surely took a little more work, but the end result is still the same. I connected my 30 gauge wires to the red and green pin as these where the only colors I cared about, Christmas and all. After connecting all the wires, you will need to group pins 2 with 4 and pins 3 and 5 together. This is the positive of the red to the negative of the green and the positive of the green to the negative of the red. By doing this, I can supply power one way and red will light up, then switch the direction and green will light. If you used a red/green led with one cathode and anode, things would be a lot easier for you and this can be skipped.

Next, begin connecting the LEDs to the wires from the arduino like the picture shown. Start with connecting one LED leg, if using red/green, or one pair of wires from your SMD, to the first wire and the other pair to the second wire. The next led is connected to wire 2 and 3. Third is connected to wires 3 and 4. Continue to do this until all LEDs are connected following the pictures provided. Note that I also connected a resistor to one pair of wires coming from each LED.

Step 3: The Code

Now for the fun part. Making the leds do something. I am still playing around looking to add more effects but I did manage to create a few.

Make sure you define the pins that you used.

<p>#define NUMBER_OF_PINS 5<br>byte pins[] = {9,8,7,6,5};</p>

Step 4: Adding Everything to Your Hat

Picture of Adding Everything to Your Hat

This is up to you on how you would like to add the LEDs to your hat. At first I was going to put them all in a row, but my wife had a better idea, make 2 rows staggered. She took her time and hot glued all the LEDs in place and secured the wires to make sure they don't go anywhere. We had to be very careful with this as the 30 gauge wire I had used is very thin wire that broke a few times while installing and had to be repaired.

***** My wife has the hat on right now and I didn't get any pics of this step. Will take some when she gets home and upload. *****

Step 5: Admiring Your Work

Now that everything is connected and secured you can put on your hat and just wait for the compliments to roll in.

Video: Youtube Video

Comments

Lori Simpson (author)2014-12-01

I really like the 14500 1200mAh 3.7V lithium ion by UltraFire! They're affordably priced on Ebay. You could run two of those and possibly keep it powered the whole shift. Kudos!

tammasus (author)2014-11-18

Ooohh!! LEDs! Post a video?pretty please!

farrelan (author)tammasus2014-11-18

First time posting but for some reason you cant see video on mobile.

peppypickle (author)2014-11-18

nice! awesome project - perfect timing for the holidays :)

About This Instructable

427views

1favorite

License:

More by farrelan:A Charlieplexed Elf Hat
Add instructable to: