Current project: Microcontrolled LEDs to go into hair extensions. Serious topic! - Page 1
Forum section: electronics / beginners

author: thedigitalprincess
author_rank: Contributor
timestamp: July 22, 2010, 03:55:02 pm
content: Ok, so in my spare time, I enjoy making and then selling (usually a custom work) funky weird hair extensions made from tubular crin (craft ribbon) called Cyberlox. Fun things, but they're even more awesome if they light up.This is what they look like, there are two "falls">http://sphotos.ak.fbcdn.net/hphotos-ak-ash1/hs549.ash1/32059_392809982922_50188822922_4247985_2001523_n.jpgSome colours are highly UV reactive and glow like crazy things. This is my friend Gem, we were at a goth club >http://c1.ac-images.myspacecdn.com/images02/82/l_2a26368b40f243d2b24f6c27d4ba651c.jpgSome goth clubs don't have blacklights and we like glowy things, so here we go...So story starts here...A programmer friend of mine had purchased some UV LEDs (but this is going to work with all colours really, just need voltage adjustments). So basically he has been trying to create strings of LEDs that are controlled by an AVR micro which is programmed via his Arduino. He has had problems burning onto the PICs, which would be cheaper to use in this case, so we're looking at using AVRs. If we used sequential logic, we would have at least 3 chips going.What we want to do is create strings of these arranged in the charlieplex configuration so it becomes a light chaser when programmed. The programming allows the LEDs be dimmed. Up to 30 LEDs can be run from one chip, so 5 strands of 6 LEDs in each "fall".Problem is, we need to keep under budget, so we can make somewhat of a profit (or at least break even) when these are sold on. We want to be able to use the cheapest and lightest form of power available. This has to include batteries and a holder to put the batteries in so the person who purchases it can change the batteries as required. We can get away with using AAA batteries, but only if we use 3V on these LEDs, which isn't so bright. The batteries can get heavy, so we're thinking coin cells. We want these LEDs to operate at 5V. Weight is the key issue, we can't have them too heavy because it's not fair on one's scalp to pull the hair so hard. Cyberlox are very light to wear, so we want to keep it as light as possible.The budget is $20AUD for the project, because the hair extension customers won't want to pay an extra $50-$100AUD for this sort of thing.Any suggestions for batteries, battery holders and Arduino advice?And by the way, I'm only very new to Microcontrollers, we've only just started our lessons at TAFE/college, so think of me as a layman!Cheers!L.PS ~ We wanted to use EL wire in these hair extension bobbies, but the inverter is too big and too heavy, so LEDs were the next option!

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 22, 2010, 05:12:49 pm
content: i wish i could help, but there are criteria that i dont understand:1) charlieplex configuration?2) 5 strands of 6 LEDs in each "fall"sorry, i'm a nerd guy that gets clumsy when dragged to a party.all i know for now, is that:1) your fren in the 2nd pic is gorgeous! so i guess, so do you!2) the 1st picture is scary!3) the leds in the hairy thing in the 2nd picture is like all over! not 5 not 6i doubt that one or two 5V cell battery will last for an hour with those bright LEDs.

author: Zad
author_rank: Super Contributor
timestamp: July 22, 2010, 05:40:32 pm
content: Charlieplexing is a method devised by a bloke at (I think) Maxim, for multiplexing many LEDs on not many wires. It takes advantage of 2 points.a) An LED only illuminates when forward biased, so you can put 2 LEDs back to back and illuminate one or the other depending on the polarity of the voltage.b) LEDs drop a specific voltage. This means that, for example, if you have a single LED in parallel with a series chain of 2 LEDs, only the single LED will light, the voltage being insufficient for the series pair to illuminate.If you havenwires, it enables you to illuminate n*(n-1) LEDs. 2 wires = 2 LEDs, 3 wires = 6 LEDs, 4 wires = 12 LEDs and so on. The down side is that only 1 can be illuminated at once, and that each wire need to be capable of being driven high as well as low.Here is a page from my notebook that I drew when I was tryng to find out how to create a long string of multi-colour Christmas lights. It may or may not help, as I was thinking as I went along:Edited to add: how about using flexible PCB for each fall, rather than wires? Not cheap though, I must admit.

author: Unknown
author_rank: Unknown
timestamp: July 22, 2010, 05:46:04 pm
content: My $ (AUS or US) 0.02:- I'm assuming you already know this, but you can just use an AVR micro, no need for a complete Arduino board, which would be way too large. Not sure why it would be much more expensive than PIC in this case, just pick a device that's cheap and large enough (ATmega48?), and program it in C. AVR and PIC would both work fine. If weight is an issue, you should use SMT (SOIC/SSOP/TQFP) packages, the smallest you can comfortably solder. Use in-circuit programming so you don't a socket.- Charlieplexing to save pins sounds fine, you can do both continuous (at least for the human eye) and various patterns.- What kind of current do the LED's draw? Can you drive it from logic pins or do you need some sort of transistor array (eg. ULN2803)?- Since the micro is probably idle most of the time, you could design a boost converter with PWM from the micro as controller, this would allow you to get more juice from the batteries, with just a few external components (logic level MOSFET, inductor and fast diode).Example project, which even powers the AVR itself from the boost converter..- Do you incorporate the batteries into the extensions or do you put it on the back? Seems plenty of room to hide two wires running down the neck, but you'd need to spend a few extra $$$ for housing and attachment.- I don't think coin cells would have enough juice, but 2AAA might be OK. Just do the math with average current draw and battery capacity. If you don't use a boost converter, make sure to check the discharge curve, because you might only be able to use a fraction of the capacity before the voltage gets too low. I would stick to batteries that are easily available. If you're really pressed for power/voltage, you could consider CR123 lithium cells, these are widely available, but often expensive (unless you buy them in bulk).

author: thedigitalprincess
author_rank: Contributor
timestamp: July 23, 2010, 12:43:07 am
content: Quote from: shafri on July 22, 2010, 05:12:49 pmWhat you don't understand:1) I don't know much about it either, but it is an effective way to save pins on a chip.2) Don't worry, I'm a nerd girl, but I'm an alternative chick too, so nerd + goth = party animal. Easiest way to explain a fall... It's a hair piece that "FALLS" over a ponytail. Anywho, I sell them in pairs, so they go on pigtails, thus will require 5 strands of 6 LEDs (we will be putting them inside the tubes) on each fall.What you do know:1) My friend IS gorgeous and I love her! Me? I'm a trashbag >http://sphotos.ak.fbcdn.net/hphotos-ak-snc3/hs324.snc3/28821_428028470534_590260534_5852658_2252538_n.jpg2) I love my foam head! She's pretty!3) That's about 3 or 4 large UV lamps shining onto them.We're looking for a portable glowing solution!

author: thedigitalprincess
author_rank: Contributor
timestamp: July 23, 2010, 12:58:42 am
content: Quote from: alm on July 22, 2010, 05:46:04 pm- We're using the Arduino as a burner for the chip. We want to use a PIC to save on costs. $2.50 for an AVR vs. 70c for a PIC? I *CAN* probably do some SMT soldering, I find it hard and fiddly, but it can be done.- We are doing a light chaser sort of thing, one lights up, next one lights up dimmed, first one dims, 2nd one lights up fully etc etc. We're not doing any "drive the clock so fast that it's just continuous to the naked eye" things. We want flashy stuff! We can sell them to ravers too, because a continuous light is boring for a raving kid on E.- We can drive it from Logic pins. My friend's multimeter is busted, but we managed to get a reading out of it for around 0.01A. That could be anything from 10mA to 20mA, so it's a grey area for now.- An inductor would just add more weight. He wanted to use one. I said no. Unless there are small enough ones that weigh nothing? Heavy falls give big headaches.- What I have thought of is to make a little material pocket to hide the chip and battery holder. This will tie to the elastic that holds the fall over the ponytail. It will hide under all the ribbon tubes. The LED strands will go inside the tubes, out the top and into the material pocket. I'll have to get my friend to take a picture of the strand of LEDs. Basically it's just a bunch of wires stuck together with LEDs poking out.- We will figure out what the current is when I get my Fluke!Thanks for the help!

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 23, 2010, 01:38:21 am
content: analyzing the zad's sketch, i think this comes into the hand of probability section, if you wanna light up 30 LEDs, you need 6 IO pins... 2 X 6C2 = 30 LEDs (multiplier 2 is for charlieplexing, 2 LEDs), the limitation is the light sequence...for IO pin (node) 1-6each pair of nodes = 2 LEDs:1213,2314,24,3415,25,35,4516,26,36,46,56its a 6 bits: 2^6 = 64 polarity permutations

author: thedigitalprincess
author_rank: Contributor
timestamp: July 23, 2010, 01:43:48 am
content: I should probably post up the video when my friend sends it to me so you get the idea

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 23, 2010, 02:27:35 am
content: here is the truth/polarity table... u pick the sequence:csv is the textual table, but no coloring (in case u dont have microsft excel *.xls)x=no polarity (each node in the pair got similar state... HI-HI or LO-LO) light green colored-=reverse polarity (red colored)+=forward polarity (blue colored)i shud get a royalty for thishope i programmed it correctly

author: sciurus
author_rank: Newbie
timestamp: July 23, 2010, 02:46:04 am
content: She's just picked a dodgy picture, I swear she's not usually black and white.The charlieplex bit is already working fine, all abstracted away to a simple array of brightnesses.Dimming is done in software via PWM-style strobing, not hardware ("I CAN FIX IT IN SOFTWARE DAMNIT!")The main problem at the moment is power. Both in terms of weight, and getting enough to drive these things bright enough. Also lack of hardware knowledge. I'm a software guy, all I know is the LEDs light up because I do something in the digital world. Outside of that, I have no idea what's going on!We're using an ATtiny13 currently, hopefully 5 I/O pins should be enough (not using the reset pin). No real reason we can't get something bigger, I just looked for smallest number of pins in a DIP form.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 23, 2010, 02:55:04 am
content: yup yup! i forgot... the PWM! for the dimming! use of transistors if the mcu pins cannot handle the power.5 IOs.... 2X 5C2 = 20 LEDs only2^5 = 32 pol. permutationsrefer to the first 32 row in the polarity table.i suggest you modify the spec to 5 strands 4 LEDs or vice versa.

author: thedigitalprincess
author_rank: Contributor
timestamp: July 23, 2010, 04:18:15 am
content: Quote from: sciurus on July 23, 2010, 02:46:04 amAhh, I thought you didn't join forums Squirrel!Anywho, he's cleared it all up cos I'm too much of a no0b at electronics to design what he did. *hides in shame*And shafri, that is one huge truth table :O

author: thedigitalprincess
author_rank: Contributor
timestamp: July 23, 2010, 05:30:58 am
content: Here is the video!Finally got it edited haha.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 23, 2010, 08:41:35 am
content: Quote from: thedigitalprincess on July 23, 2010, 04:18:15 amyou havent seen "the" bigger one! as i said... you pick the "sequence" that you likefrom the video, i think its hard if not impossible to implement the PWM+charlieplex without any supporting circuitry. i can see overlapping PWM control between adjacent LEDs.the easier is one PWM for each LED.ammendment: conversion from 64bit to 32bit table = column 23-56 only, and 1st 32 row only, scrap the others.

author: Mechatrommer
author_rank: Super Contributor
timestamp: July 23, 2010, 08:50:00 am
content: why dont u take one of those in the video, try to see the circuit how they did it.

author: Unknown
author_rank: Unknown
timestamp: July 23, 2010, 09:35:02 am
content: Quote from: thedigitalprincess on July 23, 2010, 12:58:42 am$2.50? I believe your friend mentioned ATtiny13, it's (US)$1.33 at Mouser in SOIC, and $1.41 in DIP. ATTiny12 is $1.19 in SOIC, $1.27 in DIP. If you need more pins, you could consider ATtiny24 or ATtiny2313, all are well under $2.50. But a PIC would be just as good, depends on what you can easily write software for and program.I would go all SMT for this project, since both size and weight is critical. You could get a very tiny board with SMT components on two sides. SMT soldering gets easier with practice, but you have to be able to reliably and quickly assemble it.Quote from: thedigitalprincess on July 23, 2010, 12:58:42 amSo no high power LED's, although that measurement is probably useless, since the accuracy likely means that this could be anywhere between -0.02A and +0.04A or something like that. No datasheet for the LEDs to check? The peak current might be higher if you do PWM/charlieplexing, but it sounds like you might be able to drive it directly from a pin if the supply voltage is high enough. At 20mA per pin, VOHis 4V with VCC=5V. With VCC=3V, VOHis 2.3V at 10mA, no spec for 20mA (probably significantly lower). So VCC=3V would be cutting it pretty close to the LED voltage, and you can't really increase the peak current for PWM/charlieplexing with a max. current of 20mA at 5V (40mA absolute max).Quote from: thedigitalprincess on July 23, 2010, 12:58:42 amSo do extra batteries. An efficient DC-to-DC converter means you can make more efficient use of one battery, and might be able to use something like 1AA (if the capacity is enough, if the average current is something like 100mA (converted to 5V, 25mA), one 800mA battery should be plenty for one night. If you want a small inductor, you might want a higher switching frequency, something ancient like LM2575 will require larger inductors. Have a look at the National Semiconductor simple switcher series, they have a design tool that let you input various parameters, and optimize for size or efficiency. They even specify inductors. Their devices might be a bit pricey, and they are mostly limited to SMT packages (as is almost any modern device). The disadvantage is that this may be harder to solder, the advantage is that's a lot smaller and lighter. Checking the dimensions/weight of the inductors might give you an idea what's feasible at what frequency/efficency, even if you end up using other devices.Quote from: shafri on July 23, 2010, 08:41:35 amI don't see why you can't combine them, your PWM frequency just has to be higher than the multiplex frequency. Eg. PWM LED1 for 5ms (at twice the current/duty cycle), then PWM LED2 for 5ms, rinse and repeat. This should be invisible to the human eye (apologies to any flies in the audience).

author: sciurus
author_rank: Newbie
timestamp: July 23, 2010, 01:29:33 pm
content: $2.50 aussie dollars, maybe they can be had for cheaper, not too sure. On the plus side, that is with free shipping. I actually wrote the code for a PIC10F206 initially, worked fine in a simulator but damned if I could even get a LED to come on at all, even using a some super-simple skeleton code. Probably something bloody obvious, but I have the AVRs, and they worked first time, so that's where I refined it.We'll probably go SMT eventually, see how things go. Unfortunately they're dealextreme LEDs. Cheap, plentiful, undocumented.I'm gunna let digi figure out all that stuff about inductors. That's way out of my area. I still don't see the problem with wires running down to a 9V battery in a pocket somewhere with a voltage regulator.The LED also aren't overlapping, they're meant to fade like that.

author: ModernRonin
author_rank: Contributor
timestamp: July 29, 2010, 12:19:45 am
content: Quote from: sciurus on July 23, 2010, 02:46:04 amFor any portable application, power is always the problem!If I were you, I'd ask myself the following questions:1) Can we find the space in our goth outfits to hide a 2 AA or 2 AAA battery pack? (Energizer lithium AAs are pretty light and will last a surprisingly long time.)2) Can we buy MintyBoost kits from LadyAda to make 5V (or whatever V you want) from our 3V worth of batteries?http://www.ladyada.net/make/mintyboost/index.html

author: Zero999
author_rank: Super Contributor
timestamp: July 29, 2010, 09:44:07 am
content: You can get some pretty light weight lithium ion batteries which come in extremely thin packages that can easily fit into pockets sown into clothing. I have some gathering dust, I'll send you a picture and will even post some to you, if you pay for shipping.