Measuring microcontroller current

Hi guys

I'm a bit baffled as I can't find a datasheet for the Arduino Nano EVery, so I tried to measure the current on the digital output pin and had about 70mA.

This basically means I put my meter in series with it and just grounded it. Is this damaging? If so, how am I supposed to measure it?

...

I had a think about it now and realised, I could have added a 1k resister, measure the current and with V=IR see the total R and deduct the 1k from it.

I'm trying to use a transistor to use as a switch. But I don't understand the datasheet.

it says max current on the base is 20mA, but that the gain is between 110 and 800 and that max current on emitter and collector are both 100mA. Does that mean that between 1mA and 20mA you always can get the full 100mA flowing from C to E?

  1. Is there anywhere online to search for different transistors by attribute? e.g. gain, current, voltage?

Hello Ceauke,
Welcome to the forum.

I'm a bit baffled as I can't find a datasheet for the Arduino Nano Every, so I tried to measure the current on the digital output pin and had about 70mA.

This basically means I put my meter in series with it and just grounded it. Is this damaging? If so, how am I supposed to measure it?

What do you mean by measure the current on the output pin? What do you think you are measuring? I am fairly sure you have misunderstood something, but I am going to have to guess at what. An output pin has a maximum amount of current it can supply, this is not something you can measure, this is something the manufacturer has designed into the chip. The manufacturer will specify, for example, that the pin can safely supply say 20mA. That does not mean you cannot take more than 20mA from it, it means that if you do then you might damage the output transistor driving the pin. By connecting a meter set to measure the current between the pin and 0V as you describe you have shorted the pin to 0V and most definitely exceeded the designed maximum output current. You might have damaged the output, or if you are lucky, you might not. Worse than obvious damage (it no longer works) is partial damage where the out put works but is no longer reliable, which will cause annoying and unpredictable behaviour.

I had a think about it now and realised, I could have added a 1k resister, measure the current and with V=IR see the total R and deduct the 1k from it.

I don't know what you think that would tell you, but it certainly won't tell you the maximum safe output current from the pin, only the manufacturer can tell you that.

...It says max current on the base is 20mA, but that the gain is between 110 and 800 and that max current on emitter and collector are both 100mA. Does that mean that between 1mA and 20mA you always can get the full 100mA flowing from C to E?

These are maximum currents, currents that you must not exceed otherwise you will damage the transistor.

Does that mean that between 1mA and 20mA you always can get the full 100mA flowing from C to E?

The current from C to E will also depend on the load on the emitter or collector. If the load is such that more than 100mA can flow then more than 100mA will flow, until the transistor overheats and then the current will stop flowing. Permanently. If the load is such that 100mA cannot ever flow then less than 100mA will flow in accordance with Ohms law.

I don't know the answer to Q3, however, I often buy from RS Components and their filters for choosing components by relvant parameters has to be the best I have ever seen on any web site.

40mA, datasheet page 9.

ceauke:
Hi guys

I'm a bit baffled as I can't find a datasheet for the Arduino Nano EVery, so I tried to measure the current on the digital output pin and had about 70mA.

This basically means I put my meter in series with it and just grounded it. Is this damaging? If so, how am I supposed to measure it?

Yes, its damaging - never short an output unless you know its designed for this.

You cannot measure the absolute maximum ratings, you read them from the datasheet - they represent reliability knowledge the manufacturer has gleaned in many ways from actual measurements of multiple samples of chip, standard limits for the process used, calculations of on-die temperature, etc etc.

Just exceeding the absolute maximum means some fraction of chips will reduce in reliability or fail. You can't infer from the behaviour of a single device what the limit is because of device variation.

Hi PerryBebbington and others, thanks a lot for your replyreplies! I'm quite embarrased by my weak attempt to figure things out.

I realise now what I should have done is adhere to the max, and design my circuit for it. E.g. 5V out at 20mA means I need to put at least a 250 resistor in. If I measure the current then (<20mA) I'll see that there's some internal resistance and can reduce the 250 resistor to about 190.

Luckily my chip isn't fried and the output is still working (I probably deserve smoke for my stupid mistake so I'll consider myself lucky).

Btw, this link is exactly what I was looking for to find the ideal transistor:

I also see in lieu of a proper datasheet for the arduino nano every, that the best bet is to check the the chip (ATmega4809) datasheet:

ceauke:
2.

I'm trying to use a transistor to use as a switch. But I don't understand the datasheet.

it says max current on the base is 20mA, but that the gain is between 110 and 800 and that max current on emitter and collector are both 100mA. Does that mean that between 1mA and 20mA you always can get the full 100mA flowing from C to E?

The only things on the datasheet relevant to using the transistor as a switch are the saturation voltages.

The gain is irrelevant, as a switch the base current needs to be between 5 and 20% of the collector current,
commonly 10% is used. There is no transistor action in saturation region so the current gain value doesn't apply.

The 2N2222A is the de-facto NPN small signal switching transistor, it can handle upto 600mA, although
its better behaved below that. For ultimate performance in BJT switchers the ZTX851 and family will serve nicely, but not cheap.

  1. Is there anywhere online to search for different transistors by attribute? e.g. gain, current, voltage?

Every major electronics component stockists website has parametric search like this.