I want to know is it possible that arduino can show how much power my prototype is drawing from arduino and if it can what would be the code for that.

2 Answers 2


You cannot directly measure the power, no. But it's simple enough to arrange using a very small amount of extra hardware.

Depending on what the device is you want to monitor there are two ways of creating the circuit that you need. Both require just a single small resistor, and either one or two analog pins.

The simplest arrangement is the "low-side current shunt" and is simply a small resistor between the ground of your device and the ground of the Arduino. This causes a small voltage drop which raises the ground potential of your device slightly, so could have an effect on communication if you're not careful (see the alternative below). Then a connection from the "top" of that resistor to an analog input will allow you to monitor the voltage drop across that resistor. From that, using Ohm's Law, you can calculate the current. That then can give you the power.

Here's a schematic:


simulate this circuit – Schematic created using CircuitLab

This arrangement does have the benefit that it will work for any power supply voltage, not just the 5V supply pin (for example powering from the VIN pin or 3.3V pin).

If you are powering your device from no more than 5V you can place the resistor in the 5V feed and avoid the offset to the ground voltage. The idea is just the same: use an analog input to monitor the voltage drop across the resistor to calculate the current and hence the power:


simulate this circuit

If you want to measure the current being drawn out of a GPIO pin, though, there is an extra step you need to consider. The GPIO has a MOSFET within it which imposes a small resistance of its own on the output. This resistance will of course cause a variation in the output voltage depending on the current drawn from the output pin. So it is important to know what the actual output voltage is rather than assuming that it would be 5V. For that a second analog input is needed:


simulate this circuit

Now the voltage drop is calculated as the difference between the voltages measured by A0 and A1. Then all the other calculations are the same.


No, it cannot do power measurement. With an Arduino (and most other microcontrollers) you only have voltage measurement (on the analog input pins).

Though this is half of the power measurement, since power is voltage multiplied by current. Measure the voltage on that pin with an analog pin. Then you need a way to measure the current. For that you need extra hardware. There are current sensors made for Arduino, which measure the current flowing through its pins and giving out a corresponding analog voltage, which you can then measure on an analog pin. Make sure that the current sensor is rated for the correct current range to not overload it or loose resolution (by having a way bigger range in the sensor than with the actual current). For a digital output pin of an Arduino Uno/Nano the max. current should be 20mA.

You can also google for something like "Arduino current sensor". A short search gave me some promising results.

Then when you have measured the voltage and current you can multiply them to get the power.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.