can i measure output currant on an output pin

as above can i measure output current so that if amps>y i can set a diagnostic error of short circuit or vice versa if amps <y =open circuit?

Yes. You need to use a 0.1 ohm resistor (or so) and use another pin to measure the voltage drop across it. However, NEVER draw more than 40ma from a output pin. 20ma is the maximum recommended.

thanks :)

You usually don't measure if an output pin sources or sinks more than 40mA. Just make sure it never gets to 40mA. Use a current limiting resistor.

Is this for the four LEDs from this post. http://forum.arduino.cc/index.php?topic=420157.0 LEDs need current limiting resistors. Leo..

if it is a circuit requiring more than 40ma can i measure current through a mosfet or transistor?

Is there much point measuring it, if the damage is already done?

all the devices on the circuit will require mosfets and relays its a 24vDC system. i only what to know if its possible for diagnostic fault logging purposes.

With an RTC, you can get the 'date', but not a 'currant'...!

lol typo. how do yu get the grape?

rossc: all the devices on the circuit will require mosfets and relays its a 24vDC system. i only what to know if its possible for diagnostic fault logging purposes.

"can i measure output currant on an output pin" doesn't make much sense if you switch loads with mosfets. A mosfet gate does not use any current from a pin (except during switching).

I understand you want to measure some load current that is switched with a mosfet. Then measuring the voltage across a current sense resistor with an analogue pin could work. Post a diagram. Leo..

If you have a multimeter it can measure current. But, your meter has to measure-down to a few mA and it will only measure AC or DC... It won't accurately measure the current of a pulse. For that you need a resistor and an oscilloscope.

As Wawa says, we rarely measure current. It's a pain because you have to break the circuit to insert the meter (or resistor). Most of the time there's a resistor so we can measure the voltage & calculate. Or, the voltage & resistance are known so there's no reason to measure anything unless there's a defect.

I work in electronics and I measure voltage every day. I might measure resistance a few times a week. ....Less than once a year I switch the meter to "current". (My bench power supply does display current (as well as voltage) so I can monitor the current of the entire board/unit, and I do keep an eye on that.)

Wawa originally post was in relation to the few 5v devices on circuit, then started to think would the same principal work for the 24v elements? everything else is 0.5-4.5v sensors which is easy to fault log… <0.5v or >4.5v. just done a search on current sense resistor and belive you have just solved both my queries. thanks man. :slight_smile:

DVDdoug i work in automotive repairs which in these days is getting closer and closer to electronics. ive high end multimeters , texa, picoscope etc. sometimes amps is a must to find a drain on circuit. but how do the ecu's flag up a diagnostic short/open circuit if its either 0v/off or 5v/on? it has to be amps/ohms? i thought it must have been amps. if its not amps can i measure ohms on an output pin?

If you want to measure current through a mosfet that switches a 24volt load, then this diagram might help.
There is a low value current sense resistor in the source of the mosfet.
An analogue pin can measure the voltage across the sense resistor (= current).
Picture in post#27.

Leo..

brilliant thanks man :)

Berry good advice given here. You should first be reading datasheets and anticipating the range of your current draw, though.

INTP: You should first be reading datasheets and anticipating the range of your current draw, though.

Indeed, and it's always a good idea to add a fuse with the right rating, depending on this current range. Also, hall-effect current sensors are really easy to use with an Arduino, and they can be used for very high currents, since they have virtually no internal resistance, so no heat dissipation.

Example of hall-effect current sensor

rossc: DVDdoug i work in automotive repairs which in these days is getting closer and closer to electronics. ive high end multimeters , texa, picoscope etc. sometimes amps is a must to find a drain on circuit. but how do the ecu's flag up a diagnostic short/open circuit if its either 0v/off or 5v/on? it has to be amps/ohms? i thought it must have been amps. if its not amps can i measure ohms on an output pin?

Usually ecu use specific component for switching, called "smart high side switch", eg. BTS432E2 . This kind of component includes overcurrent protection, high temp. shut down and open circuit detection. A fault is reported by a status pin, an open collector output. Some of them can even output a (not so much accurate) current measurament .

Ciao, Ale.

Depends is there is a raisin temperature. Hohohoho.

I like the BTS716G. It is an automotive-spec high-side switch. It has open-load detection too. It does this by sending a small current to the load even when it's off. For a relay or lamp, this isn't enough to turn it on but enough to see that there's something connected.

You can get even more complex SPI-controlled devices which will return the actual current going to each output.