Lilypad power supply

I am setting up a small beginner project with the lilypad. I have programmed my lilypad through a Diecimila to light a LED on 13 and power a buzzer on 12 (in a heart-beat pattern).

This works well when I power the lilypad through the Diecimila (although there is something odd in this set-up: "digitalWrite(lightPin, LOW)" sets the LED on not off, same for the buzzer).

But when I use the lilypad's own battery power supply, this doesn't work very well. The 'heartbeat' is weak, the light low, and the lilypad resets often.

  • Am I just using too much power for such a small battery? (I have tested this with a number of new batteries, and they all show the same problem - in fact they seem to drain quickly when I use them)

  • Or am I making a mistake in putting all this together, and doing something dangerous/foolish?

See my setup at: http://www.flickr.com/photos/marrije/2301284261/

Thanks in advance for any help!

It's not clear in the pics, but it seems that you connected the led to the +Vcc and to an output pin. This explains why the led turns on with (LightPin, LOW). The led needs a positive voltage at anode and a relative negative (read as GND) at cathode. The positive (+Vcc) is always connected. The other terminal of the led, connected to Arduino pin goes +Vcc when HIGH (turning led off) and goes GND when LOW (turning led on). The same with the buzzer. You can change this connecting the led cathode to GND and anode to lilypad pin. So the led will light with (LightPin, HIGH).

About the power comsumption problem, lilypad works with 2.7 to 5.5 volts. Your battery seems to be a 1.2 v. ( I don't know if the battery holder has a charge pump circuit), and it has a little current capacity. The buzzer drains to much current, and the same with the led, without the current limiter resistor. Leds usual current comsumption is about to 15 or 20 mA (with resistor). And there is a small led on baterry holder too. And the lilypad comsumption. I think it's too much current for your battery, that decreases battery voltage, causing lilypad to reset.

Hi...

I don't have an answer for the rest of your questions (although I wouldn't be surprised if a lack of battery strength may be causing issues), but this rang a bell:

(although there is something odd in this set-up: "digitalWrite(lightPin, LOW)" sets the LED on not off, same for the buzzer).

From looking at one of your photos it seems like what you are seeing is as a result of how you have the LED wired.

The photo seems to show it wired from the positive power rail (assuming your red cable is for +ve) through the LED into the Arduino pin. In this configuration if both "ends" of the LED are positive (which is what happens when the pin is HIGH) then no current flows, thus the LED does not light. If the pin is LOW then current can flow "from" the +ve power rail through the LED into the microcontroller pin.

Now, this is all something I didn't understand very well until a while ago, so my explanation may not be 100%. Also, the term used in this situation is that the pin "sinks" current (meaning it's acting as the ground). If the LED was wired to ground (0V) then the pin would be described as "source"ing current.

Here's some links explaining the "sink" and "source" concepts (by people who are actually sure of what they're talking about :D).

I'll leave it as an exercise to work out how to make it behave as you expected it to. :-)

--Phil.

Edit: Apparently I took too long to write that. :-)

The battery setup is correct. You're using the right battery.

But, you need to put a resistor in series with your LED. Try a 1K to start. So your circuit should look like this, if you want your LED to come on when you set pin13 high:

GROUND--------1K resistor-------LED---------PIN 13

The LED without a resistor is drawing a ton of current whenever you turn it on. The problem is made worse by turning on the motor & the LED at the same time. When the power supply can't produce enough current, its voltage will drop. If it drops below 2.7, the lilypad will reset.

Thanks, everybody, for your kind help with this very newbie problem. I'm going to get a better grounding in electronics, and work your suggestions into my projects.