Am I drawing too much power from the board?

Hi there, I am trying to troubleshoot a board design for a touch sensitive toy I am developing based on Atmega8 with the internal osc configuration. It uses 10 super bright white LEDs which sink 20ma each, all of them connected with a respective 68r resistor and in series on pin 8. I have an 8ohm 0.3w speaker connected to a 100r resistor then to a BC337 (single transistor amp configuration, other leads go to +5v and GND) then to pin 9. The capacitive sensor is connected to pins 4 and 2 with a 10M ohm resistor inbetween the same as in the capsense library example. The code works fine, and I thought 1A usb adaptor would be fine for this, and it was for a little, but the project seems very unstable and I saw a spark on the power outlet.

Am I frying some electrons here?

Should I split the leds into several pins or this would not help me at all?

What should I look for, I mean, what kind of question should I ask to google so I can figure out what's heppening?

Thank's a bunch, keep hacking stuff.

A digital output pin can source/sink at most 40mA, all pins together not more than 200mA.

Are you driving all 10 LEDs from pin 8? If so, you are definitely drawing too much current. The maximum is 40mA per pin. Even if they are on different pins, it's relatively much for the chip, since the recommended maximum current is 200mA for the entire chip, with an absolute maximum of 300mA. The 5V regulator on the Arduino board is only capable of delivering 500mA, so you may want to consider using a separate power supply for the speaker and the LEDs. As for the sparking outlet, this is probably because there's some corrosion on the contacts, and not due to high current.

I am not using the arduino board, so the current does not come from the Arduino voltage regulator, I am using an 1A USB power adapter. The speaker is using a transistor and it's collector is connected to 5V, should the LEDs use a similar approach, using a resistor to step down and a transistor to boost up from 5V? Is this concept correct? If not, how can I work around the issue without changing too much my design without having to withdraw a few LEDs?

This is the easiest way to power the LEDs, you could use a 12V power supply if you want to have a lower current draw (so you can use a smaller transistor), but for just 10 LEDs, the first one is fine as well.

Please note that this schematic is for white or blue LEDs only, other colours have a much lower voltage drop.

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png?

Thanks.. Tom.. :)

This is the easiest way to power the LEDs, you could use a 12V power supply if you want to have a lower current draw (so you can use a smaller transistor), but for just 10 LEDs, the first one is fine as well.

If I use your example I’ll be fine then? ;D

That’s great! thank’s a lot

schematic attached

schem.pdf (233 KB)

That schematic is sinking all the current through one Arduino pin. The Arduino will fry.

PieterP provided useful circuit diagrams.

DrDiettrich: PieterP provided useful circuit diagrams.

The first diagram would work, but the base resistor in the first diagram should ideally be 1k to saturate the 2N2222/BC337 (between 1:10 and 1:20 base:collector current). The second diagram won't work, because four LEDs have a Vf of 4*~3.3volt = 13.2volt. Three LEDs and a 100ohm resistor per string would work. Base resistor should be calculated for 1/10 of collector current for saturation. Ic = ~40mA, so Ib = 4mA. R = (5volt - 0.7volt) / 0.004Amp = 1075. A 1k base resistor would do. Leo..

You are absolutely right about the base current, screwed up the calculations with that one, however, I'd like to point out that most white LEDs will run happily @~3V (14-18mA), but you could indeed get higher intensity by using only three in series.

Thank you PieterP and Wawa for the input.
Which is very nice since I have loads of 1k laying around and proly no 2k7 whatsover

I’m attaching the new version of the schematic, since I was there I took the time to tide things up a little bit, it looks a lot cleaner now.

As a final question, is 100nf a good value for decoupling cap?

Thank you all for your support.

schem2.pdf (17.8 KB)

Yes, 100nF is perfectly fine. The 100R for the speaker seems a bit too low, this would be (5V-0.7V)/100R = 43mA, which is too much, I'd use at least 270R.

I'd leave the final resistor values to the user, according to the really used LED and supply voltage. 10R look a bit low to me, the resulting current will vary heavily with the supply voltage.

I'd start with 100R and many LEDs in series, then reduce the number of LEDs until they light up. Then adjust the resistor value for the intended brightness, but not below 22R.

Some people suggest 1k base resistors always, to safely saturate the (small signal) transistors. Power transistors, with less amplification, may deserve lower values, or another driver stage.

You are using 10 LEDs in parallel, each drawing ~16mA. That's ~160mA collector current.

You need ~16mA base current for that. So a (5 - 0.7) / 0.016 = ~[u]270ohm resistor[/u]. Leo..

I don't see a need for such a high base current. But it will not damage the transistor nor the output pin, of course.

True. 1k (4.3mA) could still be ok for 160mA collector current. Saturation voltage will go up a bit though. LEDs don't get the full 16mA, and the 2N2222 could get warm. A few milliamps more base current could avoid those problems. Leo..

I did what you guys suggested and it is working accordingly. Which is great news, I put my finger on the 2n2222 and did notice just a tiny bit warm, not sure how much is too much, although the LEDs look bright enough that i couldn’t spot any difference from the previous version, one thing that got me a little bit confused at first was that the 2n2222 is EBC and the BC337 is CBE, then I need to make sure I don’t get them swapped if I ever print this PCB.

i’m attaching the new version with the new added changes.

and again, thanks a bunch for your support, you guys are great!

schem3.pdf (17.8 KB)

The BC337 and 2N2222 are electrically almost identical. Not a problem if you use the same ones for the speaker and LEDs. Watch the pinout though. Not all 2N2222 have the same pinout.

PieterP: The 100R for the speaker seems a bit too low, this would be (5V-0.7V)/100R = 43mA, which is too much, I'd use at least 270R.

Not quite. The transistor is used as emitter follower, so base current depends on collector current. Peak collector current could be 500mA for an 8ohm speaker, so I guess ~5mA base current. But maybe wise to use the same value base resistor as used for the other transistor (270ohm). Leo..

I put my finger on the 2n2222 and did notice just a tiny bit warm, not sure how much is too much,

If you can not hold your finger on it for longer then 5 seconds, then it is too hot. Otherwise it is fine.