Lilypad MP3 Battery Choice

I need to choose which Lithium Ion battery I will use to power an electronic quilt project that uses a Lilypad MP3

The quilt is 30" square.

There are five sets of LEDs that turn on in sequence.

#1 five blinking LEDs, then these go off

#2 three LEDs that just turn on, then these go off

#3 three LEDs that just turn on, then these go off

#4 three LEDs that just turn on, then these go off

#5 all six LEDs from #3 & #4 blink

The sewing distance from the LilyPad MP3 player to the LED strands can be as much as 16 inches

My question is which of the 3.7 V LiPo batteries would be best? Does the mAh rating matter as long as it is 500mAh or above? or is it better for me to go as high as 1000mAh?

Thanks. . . our Nelson Mandela electronic quilt is going to the White House from Learn 2 Teach, Teach 2 Learn. We have the program working, the quilt made and the prototype circuit sewn. We are just doing the final circuit sewing now!

You need to add up all the current ratings for the LEDs and all the devices you will be using. If you want to go a step further, just add up the devices + the most LEDs that will be on at one time. Once you have that, it’s just simple math on how long it will last with a certain battery.

So if your devices and LEDs needed 500mA, then a 500mAh battery would last an hour. If you have a 1000mAh battery, it would last 2 hours.

What LEDs are you going to use ? What color are they ? Do you have a link to them and the conductive thread you’ll be using ? The potential problem with a single cell LiPo is that as it discharges it drops in output voltage. Down to 3.3 or 3.0 or less by the end of it’s useful charge. That may be too small a voltage for some LEDs, given the resistance that will be in series with them. The end result may be less brightness and/or less runtime than you expected. It all depends on the LEDs and how much current you want to drive through them.

I am using lilypad LEDs (https://www.sparkfun.com/products/10044) in white, red, yellow and purple.

I am using this conductive thread: https://www.sparkfun.com/products/11791

The largest strand of LEDs I am lighting up at one time is six and the LilyMP3 is playing a recording at the same time.

zackboston:
I am using lilypad LEDs (https://www.sparkfun.com/products/10044) in white, red, yellow and purple.

I am using this conductive thread: https://www.sparkfun.com/products/11791

The largest strand of LEDs I am lighting up at one time is six and the LilyMP3 is playing a recording at the same time.

Good info ! Now did you have some idea/concept of how you were going to wire the LEDs to the LP MP3 board ? I'm seeing a problem you may have already solved. That is there are only 12 "sew tap" (ala I/O pins) and 4 are devoted to speaker outputs and may not be re-assignable. Another 3 are GND, Vin and 3.3V out ... which certainly can't be I/O pins for LEDs. That leaves 5 pins to control a lot of LEDs.

Just to illustrate what I think might be a problem (or two) …

First I assume you have the LilyPad “LEDs” wired in parallel (as shown below) and not in series. You don’t have enough voltage out of a single cell LiPo to make more than a single “LED” light up if wired in series … which kind of defeats the purpose.

As to whether you can run the sets of LP “LEDs” of a single LiPo and which is better, 500 mAH or 1000 mAH … I’ll say either should work and it’s a question of runtime. Obviously the bigger battery will last longer than the smaller one, though by how much is debatable.

What I expect is that as your “LEDs” do their dance, the blue and violet and white ones will get dimmer first. That’s because they need a higher voltage to run when compared to green and then yellow and then red LEDs. Your 3.7V LiPo really starts out at ~4.2V if fully charged and then drops, with use, down to 3.8V-3.9V fairly quickly. Over the majority of it’s runtime the voltage will then slowly drop to ~3.3V and then quickly drop to under 2.8V … if you let it. Don’t let it ! That can damage the cell. Different people pick different voltages to stop usage, anywhere from 3.3V - 2.8V. I doubt there’s actually that much difference in the runtime. So let’s pick 3V as the cutoff point to prevent battery damage. I expect you’ll not even get that far as I expect any blue/violet/white LEDs to be off, or to be so dim as to be worthless before the battery gets to 3V.

All LEDs need some minimum voltage across them before they will begin to flow current and illuminate. This voltage, in general, varies with the color of the LED. Reds need perhaps 1.8V, yellow perhaps 2V, green maybe 2.2V-2.4V and blues and whites need 3.0V-3.4V. And there’s more than that to it. The LP “LEDs” you linked to are actually an LED and a 100 ohm resistor in series with it. And then the conductive thread isn’t as good a conductor as normal wire. It adds a notable resistance, about 28 ohms/foot, to the circuit. And so you see these pictured in the the diagram below. Whenever current flows through a resistor, there’s a voltage created across it. And all the voltages for all these resistors and the LED must add up to equal whatever the battery voltage is at that time. Meaning the actual LED has less voltage across it than the battery voltage.

Typically circuits push perhaps 20 mA of current through a normal (not high power) LED to make it “bright”. Perhaps 5 - 10 mA will still be considered OK. Below that … it depends on your taste and the darkness of the room.

So let’s churn some approximate numbers. Let’s look at a red “LED” at short and long distances (thread length) from the battery and LP mainboard (MP3 board).

6" distance, red “LED” 20 mA requires 4.5V battery voltage. Ooops !

6" distance, red “LED” 5 mA requires 2.5V battery voltage.

16" distance, red “LED” 20 mA requires 5.4V battery voltage. Ooops !

16" distance, red “LED” 5 mA requires 2.7V battery voltage.

And for a white “LED” …

6" distance, white “LED” 20 mA requires 5.7V battery voltage. Ooops !

6" distance, white “LED” 5 mA requires 3.6V battery voltage.

16" distance, white “LED” 20 mA requires 6.7V battery voltage. Ooops !

16" distance, white “LED” 5 mA requires 3.9V battery voltage. Hmmm ??

So you can see you won’t be getting the max brightness that you could from the blue/violet/white “LEDs” using a single cell LiPo. Perhaps you’re OK with what you’ve got. Doubling up on the thread to those “LEDs” can help but it’s no cure. And that’s why there are [LP LEDs (no quotes) that don’t have the 100 ohms resistor included. You can also see how the decreasing voltage will reduce the current to all the “LEDs” and how the blue/violet/white “LEDs” will drop out first, perhaps even before you use most of the energy stored in the battery. So a 1000 mAH may not really buy you that much more runtime.

Lastly I should mention that a digital pin on a LP mainboard or MP board can only source or sink 40 mA max. Current in parallel circuits adds directly. So 10 mA through each of the “LEDs” in parallel means N*10 mA to be sourced or sunk by the LP pin (assuming no “driver” in between). In the case of the 3 “LEDs” shown, that’s 30 mA and while that might, just maybe, be OK, a better limit would be 20 mA into/out-of any pin. And that means you might drive 2 or 3 LP “LEDs” per pin … I think you had more than 2-3 in mind for any 1 set of “LEDs”.

http://dlnmh9ip6v2uc.cloudfront.net/dat … 3-v15a.pdf

https://www.sparkfun.com/products/11791

https://www.sparkfun.com/datasheets/Dev … ad-LED.pdf

https://www.sparkfun.com/datasheets/Dev … 50OVS4.pdf (red/yellow/green LEDs)

https://www.sparkfun.com/datasheets/Dev … 6QWF-D.pdf (white LED)

https://www.sparkfun.com/datasheets/Dev … ANB4-H.pdf (blue LED)](LilyPad LED Micro - White (5pcs) - DEV-10753 - SparkFun Electronics)

Wow! Thank you. I am digesting this and actually trying out one of the circuits. We already tested the circuit with alligator clips and we know it works with them (but your point about the conductive thread means that it won’t necessarily work once we sew it.

I will send you a full circuit diagram soon and tell you what happened when we test the first part of the circuit today.

zackboston:
I will send you a full circuit diagram soon and tell you what happened when we test the first part of the circuit today.

Kewl. :mrgreen:

OK. I ordered an 850 and 1000 Lipo battery and a little Lily button board (instead of making my own homemade touch sensor). We are using hacked computer speakers which worked very well on our alligator clipped prototype.

Here are a few photos of the actual quilt we are building the electronics into (pieced together. . . it is still being sewn) It’s 30" x 30" including a 4" boundary.

https://www.flickr.com/photos/28629285@ … 0457907984

https://www.flickr.com/photos/28629285@ … 0457907984

Here are two circuity diagrams. One, to give you the general layout within the design and the other to give you the nuts and bolts of the wiring:

https://www.flickr.com/photos/28629285@ … 0457907984

https://www.flickr.com/photos/28629285@ … 0457907984

These are some random photos of our process. We are documenting Nelson Mandela’s first visit to US after he was released from prison in 1990. He came to Boston and had a special gathering for Boston youth. Mel King, our executive director at the South End Technology Center @ Tent City, introduced him to the big gathering at the Hatchshell. We did a lot of research and design work to get the quilt where it is now, so I really want to finish it up. L’Merchie Frazier, a fiber artist and the ed director of the Museum of African American History has been our mentor and is finishing up the quilt sewing and I am finishing up the final sewing of the electronics!

p.s. if you want to see the whole process from introducing electricity and sewing light up pin badges to now, go to our set. . .

https://www.flickr.com/photos/28629285@ … 0457907984

OK, this diagram really brought the project into view, circuit-wise.

https://www.flickr.com/photos/28629285@ … 0457907984

From what I can see the “T2 circuit” is trying to drive 5 LP “LEDs” in parallel. I’ll do some calculations but I’m a bit worried about that. All the others only have 3 “LEDs” in parallel and while that may not be ‘best practices’, it’ll probably work. You’ll have decide if those “LEDs” are bright enough.

One more question … if I’ve understood your post above, only one circuit is on at a time. Do I have that right ? Could the “LEDs” in the below alternate being on/off ? That is #3 is on, #4 is off then #4 is on, #3 is off ?

#5 all six LEDs from #3 & #4 blink

EDIT : Also what color are those 5 LP “LEDs” ?

Yes all of the different parts are on at different times, never all together.

Yes, we could alternate 3 and 4!

The 5 LEDs are yellow regular (not micro). I am sewing the circuit right now so I will be able to tell you what happens with those 5 LEDs.

Thanks!

also, if the 5 LEDs are really a problem, we can go down to 3. . .

zackboston:
also, if the 5 LEDs are really a problem, we can go down to 3. . .

I think we can find a way to stay with 5. Meanwhile here's your "T2 circuit" as a schematic showing all the LEDs and resistances. In this case I've "wired" them directly to a LiPo battery and plotted the currents, assuming (last night) that they were white LEDs (I'll get back to this), while the battery discharged from filly charged at 4.2V to usefully discharged at 3.0V.

(click on to open and enlarge)

That should look familiar to you. In this case I gave the conductive thread an assumed resistance of 2 ohms since the distance between “LEDs” was so short. Now here’s the results of that circuit.

(click on to open and enlarge)

The problem area is apparent at the fully charged battery voltage. A sum of the 5 LED currents shows that they “want” to draw ~44 mA. That’s more than the 40 mA MAX allowed by the LP pin specification. Now make those LEDs yellow, not white, and they’ll “want” to draw even more current. And yet as the battery discharges and the voltage becomes lower, the problem goes away. So here’s some potential solutions to think about.

  1. Reduce the LEDs from 5 to 3. I would say only do this as a last resort. Let’s see if we can find a solution that doesn’t compromise your vision of what your project should be.

  2. Don’t charge the battery fully. This is interesting and simple solution. You can look at the plot (and I can make one for yellow LEDs) and pick off the voltage that keeps the LP pin safe, say about 30 mA MAX draw. That thing is are “you” always going to be around to take the battery off the charger at the proper point ?

  3. Use more hardware. The essential problem is that you have 5 pins to control 14 LEDs. I might have pointed you to a different platform to use, perhaps not LP at all, earlier on in this project. But you have what you have and one time tested way to “expand” the number of output pins is via shift registers. In your case two 8-bit SR’s would require 3 pins to control (perhaps 4 if you want easy blinking) and give you 16 pins in return. You could put a LP “LED” on each pin of the SRs and have complete control of each and every one. The only limitation is that you could only have 7 of the 8 pins on at any single moment, for reasons similar why the LP pin is limited to 40 mA MAX. That’s not a problem with your project. Here’s some URLs to look at.

https://www.sparkfun.com/products/10680

http://dlnmh9ip6v2uc.cloudfront.net/dat … 4HC595.pdf

http://bildr.org/2011/08/74hc595-breakout-arduino/

Yes the software has to change but it isn’t too hard and as seen above, people have already worked out a library of software functions that make SRs easy to use. IMO, if you have the time and space, this is the best solution.

  1. Charlieplex the LP output pins. This adds no more hardware but the software can be a bit more conviluted to understand at first. Basically the idea is to (at least) break up the T2 circuit into 2 new circuits, T2a and T2b, that have 2 and 3 “LEDs” in them (respectively). Now you’re down to a safe limit of current drawn. The beauty of Charliplexing is that it takes advantage of the directional nature of the LED and the fact that pins can be outputs, high and low states AND ALSO be an input, which permits no current to flow, either into or out-of the pin. These articles explain the concept fairly well.

http://www.instructables.com/id/Charlie … e-Arduino/

http://makezine.com/projects/charlieple … r-arduino/

This may be the easiest of the solutions but like the above hardware solution, requires a radical rewiring of the “LEDs”.

  1. Do nothing. Perhaps you’ll be lucky and the LP pin won’t fail due to trying to source too much current. After all the circuitry internal to the LP pin has some output resistance and as the current drawn increases, the voltage lost internal to the LP will increase and so the actual voltage at the pin will decrease. This will tend to limit the current drawn by the “LED” circuit but at the expense of extra heating internal to the LP “Arduino”. And that’s one way they burn out. Maybe you’ll be lucky … maybe you won’t. I wouldn’t take the “Do nothing” approach.

One experiment I recommend you do (if you haven’t already) is use those alligator clips (I saw in some pics) to create 4 circuits; two with red or yellow “LEDs” numbering 2 “LEDs” and 3 “LEDs” per circuit. Two more circuits with white or blue “LEDs”, again w/2 “LEDs” in the circuit and w/3 “LEDs” in the other circuit. Come up with some test code that just turns each circuit on, one at a time, for 5 seconds or so. Start with a fully charged battery and let it run until the battery is “dead”. Every so often measure the battery voltage and the voltages at each of the LP output pins. Also note how bright you think the “LEDs” are vs time. This will give you a good idea as to whether 2 LEDs/pin or 3 LEDs/pin is bright enough and how long the battery can last. And on that note …

LiPos can be tricky. You don’t want to overcharge then and you don’t want to drain them completely. You need a proper LiPo charge to charge them or a fire is likely. When using them you need to be sure that they never discharge below a certain voltage. 2.8V is the lowest I’ve heard, many people stop usage at 3.0V (or even 3.3V) just to be sure. Discharging a LiPo below it’s “dead” voltage will likely so damage the LiPo it can’t ever be recharged. And again there’s a chance of fire. So be carefully on how you charge and discharge a LiPo. Some have protection circuits in them to prevent certain bad conditions, some don’t. I wouldn’t rely solely on the internal protection circuitry.

Meanwhile I’ll look at how to Charlieplex all the “LEDs”.

Wow you are taking me back to my electrical engineering days. . . smile (that was the late 1970s and early 80s!). I did nonlinear filters tho on underwater signals. . . so more mathematics than circuits. smile.

Yes, I see the problem very clearly. I am going to have my multimeter all ready when those lipos come in tomorrow or thursday. I like the “monitor the voltage in the Lipo like a hawk” solution the best.

I also like the test you propose.

We ditched the purple LED and replaced it with a white one.

And I did not know that about the Lipos. Wow. You are truly schoolin me.

I am copying everything out and putting it on a wiki about the MP3 and LiPos. So your knowledge and generosity in sharing will have a very useful life for many of my youth teachers.

We used a Lily MP3 in another project bc the youth teachers fried an Uno MP3 shield soldering and I didn’t have enough money to order another one. It worked out great, but mostly because we had already figured out a lot of stuff from having prototyped the Quilt late in the Spring.

I will keep you posted as I keep experimenting

btw, here is 7 minutes that documents the 7 months of our Learn 2 Teach, Teach 2 Learn program. It’s kind of fun. . .

http://youtu.be/VfoLRgVR1gY

zackboston:
Wow you are taking me back to my electrical engineering days. . . smile (that was the late 1970s and early 80s!).

Same here. Went to "Tiny TU" for undergrad work. NE for grad courses. OK, now knowing a bit more about your background I can explain more clearly and in less words (gads !) than I usually do.

As for Charlieplexing (CP) … with 5 pins I think you can control all 14 LP “LEDs” indiviually, just as w/SR’s. But to get 2 or 3 or 5 on at the same time you need to quickly turn on, delay, turn off each LP “LED” that appears to be on quickly enough that out human eyes can’t see the off time … aka PWM. There’s an advantage to the SR solution, it doesn’t have to do PWM to get any “LEDs” on at the same time. That CP code my be more complex that your peeps are willing to handle in the time allotted. So I’m looking to CP the pins so each pin runs a “circuit” of 2-3 LP “LEDs”. That way I think I can make the code simpler but I’ll post later tonight what I’ve been able to do (or not).

Suffice it to say … 5 LP “LEDs” all daisy-chained, driven off a single output … probably not a good idea. It might work for a while … or maybe even forever … but I wouldn’t stake my job on it. :twisted:

Ok here’s one way to CP 4 LP output pins so as to control 6 independent circuits. Said circuits being 2 or 3 LP “LEDs” in parallel (though I used a single LED to depict said circuit below). It’s not the only way, and I won’t claim it’s even the best way to do it, but it’s a way for you to start thinking about how to CP the “LEDs”. Note that I’ve used red and black lines for the same single physical conductive thread, just to better illustrate the voltages applied at different times. Any electrical junction of 2 or more threads is depicted with a fat black circle.

(click on to open an enlarge)

I’ll let you assign which LP pins correspond to the above pins A, B, C and D. But the circuit numbers correspond to the aforementioned circuits.

Here’s something of a logic table … double check it and make sure I’ve not screwed something up.

Circuit 1A on (only) - Pin A = high, Pin B = low … all other pins are inputs

Circuit 1B on (only) - Pin C = high, Pin D = low … all other pins are inputs

Circuit 1A & 1B both on - Pins A, C = high, Pin B, D = low

Circuit 2 on (only) - Pin B = high, Pin C = low … all other pins are inputs

Circuit 3 on (only) - Pin A = high, Pin C = low … all other pins are inputs

Circuit 4 on (only) - Pin B = high, Pin D = low … all other pins are inputs

Circuit 5 on (only) - Pin D = high, Pin A = low … all other pins are inputs

With more thinking you could come up with a CP scheme that allows individual control of each of the 14 LP “LEDs” but you would then have to cycle (PWM) among the CP states to get the appearance of multiple “LEDs” on at the same time. That’s something that might be easier to do w/SR’s. Why do that … might be nice to depict Mr Mandela’s travels with an "animated path of “LEDs”, that individually light up (1 then 1+2 then 1+2+3) as he travels from point A to point B. Just a thought … :twisted:

Feel free to ask questions re: the above. Sometimes it’s all so clear in my mind … in others … not so much. :mrgreen:

I thought about it some more last night and if you’re not going to try to save I/O pins and if you’re not going to go and CP each individual LP “LED” then there’s a better solution than the above Charlieplexing (I think). I say better in that it’s simpler to code for, simpler to understand, simpler to wire and will perform (brighter LEDs) better*. See if you agree.

(click on to open an enlarge)

I suspect you can figure out how to command the pins (input vs output, HIGH vs LOW) all by yourself. The “trick” that needs some verification (test w/a full battery) is circuits 3 & 4. The idea is that there’s not enough battery voltage to turn on any 2 LP “LEDs” in series. Certainly true if they are both white and/or blue, a little iffy if they are both red. When pin “D” is an input that’s the situation. When pin “D” is an output then it’s either a LOW or a HIGH which provides a better ground or a better 3+V than is otherwise the case and so circuit 3 or circuit 4 will light up.

And though I’ve not shown it above, I assume there’s some on/off switch between the battery and all the circuitry. The circuit 3/4 configuration will have some low current draw.

*Here’s why I say this will perform “better”. Any time a LP pin sources current there’s a drop internal to the LP itself and so the pin voltage will be less than the supply voltage. As the current drawn rises, the drop does and drastically over 20 mA. Like to more than 1V ! Same thing if a pin sinks current. So if you have an “LED” between two pins, you get a double hit. And with 2 or 3 LP “LEDs” being driven … well it won’t be a good thing when the battery is in it normal working range of 3.8 - 3.3 V. The wiring above only has 1 pin in the active circuit, either sourcing current or sinking it.

ps - if the “trick” above doesn’t test out, if the “LEDs” are on enough to be seen, then you can go back to a more traditional CP scheme. I just thought the above was easier.

It occurs to me that there are at least 2 other “add more hardware” solutions, that may be simpler than the SR approach … if you don’t mind doing a little soldering. I discounted these since I usually read LP and conductive thread = no soldering, but perhaps I’m wrong in this case. So for your consideration …

What you really need to “drive” these multiple LP “LEDs”, when there are 3 or 5 in parallel, is a “driver”. One such common driver IC is this one, a ULN2803.

https://www.sparkfun.com/products/312

https://www.sparkfun.com/datasheets/IC/uln2803a.pdf

What it is is a set of 8 transistors all packaged into a single IC. When you provide a logic HIGH on the input, the output provides a ground, otherwise it’s an open circuit (specifically it’s an open collector type output). To use it you’d connect the + ends of all LP “LEDs” to the battery voltage and the - ends of each circuit to it’s specific driver output. Each T2-T5 LP pin goes to one input on the IC. One pin of the IC goes to the battery ground. Since you only have 4 circuits and the IC provides 8 channels, you only use 1/2 of the IC.

Another solution (if you can’t find the above IC in time) is to implement the same concept using 4 discrete transistors (2N2222A) and 4 resistors (1K ohm). You’d have to put them on some sort of protoboard but I suspect even a solderless breadboard (a small one) with the components and wires RTV’ed down would work. There would 4 identical channels, each of which would look like this;

Now perhaps soldering or even breadboarding isn’t in the “course” but I thought I should mention the above just in case. Both shift the 20 - 50 mA load from the LP pin to the transistor. Then the LP pin only has to provide a few mA to control the many mA. Your programming stays the same as it was before.

Great news. . . the first part of the circuit that has the heaviest load works with the mp3 plugged into the computer! Yay! And the song is triggered and lights go off at just the right time!

https://www.flickr.com/photos/28629285@N02/15149647362/