 # Arduino measures its own current consumption

Hi folks,

You might want to measure the current consumed by your Arduino.

Usually one uses a shunt resistor (e.g. placed in the negative voltage feed) and measures the voltage at this shunt.

The problem is that -seen from the Arduino- the voltage at the shunt is negative and the ADC can’t cope with negative potentials.

So we will use a dirty trick: plain silicon diodes begin to conduct @ 0,5 - 0,6 V.

Using that circuit:

you will roughly add 0,5 - 0,6V to the potentials around the shunt and shift them into positive values that can be read by the ADC.
The current will then be roughly proportional to A0-A1.
You must chose the shunt resistor value to generate a maximum tension of ~0,2V to get a reasonable precision and use matched diodes, or at least of the same type.

Enjoy!

Laszlo

A small schottky double-diode could mimimise temp drift. 1.1volt Aref might be needed to get some resolution. Leo..

Wawa: A small schottky double-diode could mimimise temp drift.

Temp drift is absolutely not a problem: you are measuring a differential potential. The drift applies on both sides and that eliminates its influence.

Wawa: 1.1volt Aref might be needed to get some resolution.

Yes, I forgot to mention.

RIN67630: Temp drift is absolutely not a problem: you are measuring a differential potential. The drift applies on both sides and that eliminates its influence.

I mean temp difference between the two diodes. With 1.1volt Aref the error could be two A/D values per degree C.

I also think the Arduino pins (at least A1) will be safer with a (10k) resistor between diodes and pin. You don't want a short between Arduino V-in and Arduino ground (like charging the V-in cap) to travel through A1 and the diode. I also would add a 100n cap fom each pin to ground. Leo..

Wawa: I mean temp difference between the two diodes. With 1.1volt Aref the error could be two A/D values per degree C.

Why would you have such a temp difference between the two diodes? You have got a much greater error due to the different flowing current through the diodes as the ΔU between A0 and A1 increases. But, hey, it is just a circuit to [u]evaluate[/u] the own current consumption of the Arduino.

Wawa: I also think the Arduino pins (at least A1) will be safer with a (10k) resistor between diodes and pin. You don't want a short between Arduino V-in and Arduino ground (like charging the V-in cap) to travel through A1 and the diode. I also would add a 100n cap fom each pin to ground.

You [u]may[/u] do it, but it works well already so. I am averaging the current reading anyhow per software, so lets keep it simple and stupid. Laszlo