Question is, why use the analogue pins on a Mega as digital out.
Did you run out of pins (for LEDs).
Yes, analogue pins have the same output specs as other digital pins.
~20mA max, and 40mA absolute max.
But if you're driving lots of LEDs, then you must also watch max port (group of 8 pins) current and max chip current.
Leo..
I am just doing some tests with analog and digital pins and want to calculate the Amps. When i made a project with Arduino Uno i run out of digital pins, so i decided to connect the LEDs with analog pins and worked. For that reason, sometimes i connect LEDs with analog pins.
To sum up, are these below correct?
Is the Voltage of an analog pin 5 V?
Is the forward voltage drop of a LED about 2 V?
If i put a resistor 330Ω, how do I calculate the current?
1. What is the max current of a digital pin, a 5V pin and a 3.3V pin?
I have read many different values and I'm a little bit confused. For instance:
For a digital pin: 40 mA MAX for one pin, 200 for all together.
For 5V pin: 400 mA (Is 400 mA for every 5V pin or for all together?)
For 3.3V pin: 150 mA (Is 150 mA for everry 3.3V pin or for all together?)
2. If I connect on the same 5V pin of arduino 3 components, how can i calculate it in order to make sure that they can work the same 5V pin?
The 3 components can be: LCD screen 16X2, MQ3 Sensor, GPS Module Neo 6M. Do i have to search in their datasheet about the current that every component needs, then do the sum of the 3 currents and check if the finally value is more than the 5V pin's current?
Depends on which Arduino we're talking about.
Max chip current can be 200mA (Uno) or 400mA (Mega).
Then there is port (group of 8 pins) current (100mA).
It's all in the datasheet if the chip(s) used.
A 5volt I/O pin has a max of ~20mA, and an absolute max of 40mA.
3.3volt I/O pins are usually about half of that.
The 5volt power pin is another story.
On USB supply it's 500mA minus the current the Arduino itself uses (~70mA for a Mega, ~50mA for an Uno).
Less (input voltage dependent) if you power the Arduino externally, on the DC socket or V-in.
The (single) 3.3volt power pin on the Uno/Mega comes from a tiny regulator that takes it's power from the 5volt supply.
It's rated for 150mA. But in small board Arduinos it could come from the USB<>Serial chip (<=50mA).
Yes, you do need to read the datasheets of the sensors (or ask here, with a link provided).
LCD and GPS modules are not that power-hungry, but an MQ3 has a heating element that draws 150mA.
Leo..
Mega - 800mA. 4 VCC & Gnd pins, each capable of 200mA.
Assuming the regulator does not overheat supplying that. And of cours the USB only supplies 500mA.
"But in small board Arduinos it could come from the USB<>Serial chip (<=50mA)."
Only those with an FTDI chip (Nano, if it's real Arduino).
Other variants may have 3.3V regulators which can supply more.