Reading this page, I understand there's a 200.0 mA limitation on VCC/GND, and 40.0 mA per I/O pin.
I'd like to power a few (~10-20) LEDs (Item) from the Arduino using PWM to dim them (all at once, not individually), ideally having the Arduino powered from a wall socket with a simple USB charger device.
My understanding is that (and please correct me if I'm wrong!):
I require 20.0 mA per LED, which means powering 10 of them would already max out the 200.0 mA on Vcc, and is not desireable.
Vcc is the input for unregulated power between 7-12V which the Arduino then converts to regulated 5V, and would be used if I were to attach a 9V battery.
5V is used for providing regulated 5V to the Arduino directly.
USB already provides regulated 5V, and thus, if I were to run the Arduino off an USB Cable attached, I would find balanced 5V on the on the 5V pin which comes straight from the USB source.
USB should give me 0.5 A at least, or even up to 3.0 A if coming straight from a dedicated charger device.
If I were to:
Power the Arduino via USB
Connect 20 LEDs @ 20.0 mA (= 400.0 mA) on a prototype board, connecting all cathodes to the GND on the Arduino, and connecting all anodes (with an matching indivudal resistor on each) to the drain of an n-channel mosfet (with the 5V pin on the Arduino board connected to the source), and a PWM signal to the mosfet gate (+ transistor to GND)....
...would I fry the board? And if so, how could I possibly overcome that limitation?
Yes you would fry the board. You are confusing where this current is coming from. If it is coming from a pin it is passing through the chip and so counts towards the total for the chip. The fact that he USB can supply more is irrelevant.
The best way is to run the LEDs at 10mA you will not notice it is very much dimmer.
Alternatively use a transistor or other sort of led driver to divert the current requirement to that chip.
Grumpy_Mike:
Yes you would fry the board. You are confusing where this current is coming from. If it is coming from a pin it is passing through the chip and so counts towards the total for the chip. The fact that he USB can supply more is irrelevant.
The best way is to run the LEDs at 10mA you will not notice it is very much dimmer.
Alternatively use a transistor or other sort of led driver to divert the current requirement to that chip.
Dropping the current to 10mA sounds like a good plan; as I don't need them to be too bright, anyway - thank you for your advice!
I've tried to put this down in a schematic, with 3 LEDs so far (2x blue,1 x green); I didn't put in all of them, but let's just pretend I end up with 3x green and 9x blue.
To my understanding, the LEDs (running at ~3.0V-3.2V) will drop to ~8.2mA with the 220 Ohm Resistor, and should, with 12 in total, be safely around ~100.0mA consumption. I'd pull those from the 5V pin, and control the set of green and blue ones individually with 2 PWM pins and a mosfet.
I'd very much appreciate a quick feedback on the circuit (should be attached to the post) - does that seem right?
If you are going to drive the LEDs with a FET then you are not taking the current from the pins of the Arduino and so there is no limit to worry about on the pins.
I had assumed you were letting the pins provide the power.
The circuit is fine but a bit over kill for what you want to do.
Grumpy_Mike:
If you are going to drive the LEDs with a FET then you are not taking the current from the pins of the Arduino and so there is no limit to worry about on the pins.
I had assumed you were letting the pins provide the power.
The circuit is fine but a bit over kill for what you want to do.
The reason for the 'overkill' is the spacing, I have 3 segments with each 1 Green + 3 Blue LEDs which are ~20cm apart, so it looks like:
[Arduino]<- 30cm wire x3 ->[1 Green LED, 3 Blue LEDs]<- 20cm wire x3 ->[1 Green LED, 3 Blue LEDs]<- 20 cm wire x3 ->[1 Green LED, 3 Blue LEDs]
I want to control all blue and all green LEDs, so I need 2 PWM outputs. One PIN would not be sufficient to drive all 9 Blue LEDs, and I just didn't want to pull 2 extra wires to power segment #2 and #3 from a different PWM pin.
Thank you for having a look at the circuit - it's really much appreciated!
If you are driving the LEDs through a FET like in that diagram one pin is enough because the current is not coming from the pin. The only pin current is to turn the FET on and off. I would put a 120R resistor between the gate and the pin just to be on the safe side.
Grumpy_Mike:
If you are driving the LEDs through a FET like in that diagram one pin is enough because the current is not coming from the pin. The only pin current is to turn the FET on and off.
...yes - that is exactly why I decided to use a FET, and what I was trying to explain. Hence the 'overkill' solution.
Grumpy_Mike:
I would put a 120R resistor between the gate and the pin just to be on the safe side.