How to measure voltage correctly

Hi, I'm new to arduino and to electronics basically. I want to give power to a piranha led (which needs 3.3v and 50mA) and for that reason I want to measure the volgate and current that are provided by the IO pins.

I've read that if I connect some pin to GND I'll shortcut the arduino. So is it possible for me to test the current with my tester connecting the 5v pin to a resistor and then back to GND?

I don't know how much amps does my resistor have that is the reason why I want to do that.

Again, I'm new to electronics. This might be simple but for me it is a new world.

Which Arduino are you using? The data sheet for the processor on your Arduino will tell you the current and voltage that a pin will supply. For a Uno with mega328, each pin can supply an absolute maximum of 40 mA. 20.mA is the practical limit. Then there are the port and chip maximums. The pin will supply a minimum of 4.2 volts at 20 mA current with a 5.0volt supply There is no need to measutpre those parameters as the are defined in the data sheets.

You will need a transistor to drive the LED at 50mA.

First off don't test your arduino you'll end up breaking it if you don't know what your doing.
Second go over here and learn about electronics http://www.allaboutcircuits.com/textbook/
Lot's of good stuff over there to read and get you up to speed.
And have a look over here the arduino is like 5 V TTL System which pin you pick is your buffer.
http://www.petervis.com/Raspberry_PI/Driving_LEDs_with_CMOS_and_TTL_Outputs/Driving_an_LED_Using_Transistors.html
And the 2n2222 can handle you led.

I assume 50mA is the maximum allowed current for the LED? Do you have a link to the LED's datasheet? The Arduino I/O pins can't provide that much current. It will light-up at less current, but it won't be quite as bright.

I've read that if I connect some pin to GND I'll shortcut the arduino. So is it possible for me to test the current with my tester connecting the 5v pin to a resistor and then back to GND?

The phrase is "short circuit" or "short out".

No! You can measure the voltage (with a multimeter) but the Arduino is can provide enough current to (potentially) burn itself out! If you try to measure the maximum current with a multimeter you can fry your Arduino! You CAN measure current in an existing circuit (the current through an LED, etc.), but in order to measure current you have to "break" the circuit and insert the meter in series. In practice, we measure voltage & resistance a lot but we rarely measure current.

Each I/O pin is rated at 40mA "absolute maximum". The "standard" Arduino boards run from 5V and the I/O pins put-out (approximately) 5V when high, and (approximately) zero volts (or "ground potential) when low.

I don't know how much amps does my resistor have that is the reason why I want to do that.

Current depends on voltage and resistance as defined by [u]Ohm's Law[/u] (Current in Amps = Voltage / Resistance in Ohms).

If you take an electronics class, Ohm's Law is the first thing you learn.

LEDs are a bit tricky... LEDs (like all diodes) are non-linear. The resistance changes when you change voltage.

  • When the voltage is low, resistance is high and almost no current flows.

  • As you approach the diode's breakdown voltage (operating voltage for an LED) the resistance suddenly goes to almost zero and lots of current flows (if it's not somehow limited).

  • This means we can't use Ohms Law on the LED because we don't know it's resistance.

But, the good news is we CAN use Ohm's Law on the resistor that's in series with the LED.

You need to know two more things, which are related to [u]Kirchhoff's Laws[/u].

1. The same current flows through all series components. (If we can calculate the current through the resistor, we know the same current is flowing through the LED.)

2. The voltage is divided among the series components. (You can actually figure that out from Ohm's Law once you know the same current is flowing through all series components.)

OK... Now we get to the answer...

  • We can't get 50mA without damaging the Arduino, so let's say 40mA.

  • With 5V divided between the LED and resistor, and with 3.5V across the LED, we'll have 1.5V across the resistor.

  • We re-arrange Ohm's Law as 1.5V / .040 Amps = 37.5 Ohms. That's the minimum resistance. With lower resistance, you'll get too much current. So, choose a standard resistor value greater than 37.5 Ohms.

Thanks so much for all your responses. I've figured out how to make it work. I've used a 220ohms resistor and the 5v rail, to get the desired 0.02A. All I can see is that it works, but I would like to know why, and the exact valued of current, voltage and power. The arduino that I'm working with is an arduino uno r3. Could you please tell me a good book, or tutorial for learning basic electronics for arduino. Thanks

I'd recommend mine, Arduino for Teens, available from Amazon and other book retailers.

A led runs on current, not voltage. The voltage across a led is almost constant and does not depend on the current. So to calculate it you can say, the 3,3V across the led is constant. That leaves 5V - 3,3V = 1,7V for the resistor. And now apply ohms law (U/I = R => U/R = I) gives 1,7V / 220ohm = 0.0077A = 8mA for the LED.

This can be a little bit higher because the voltage across the led is almost constant. With a low current like this the voltage across the led can be a little bit less resulting in a little bit more current.

If you want to measure the current now, simply measure the voltage across the resistor and apply ohms law again. [Voltage across resistor] / 220ohm = [current trough LED].