1
\$\begingroup\$

I need to measure the power consumption of a circuit I have built. The components are as follow:

  • Lipo battery 500mAh
  • Accelerometer
  • RTC
  • RedBear Nano 2

Usually I measure the consumption using an Arduino and its analogical pin. The level of accuracy is enough. In this case my idea is to attach to every component a relatively small resistor and see which is the voltage of this resistors. Comparing this values to the battery voltage I should get an idea of how much power consumption I have. Is that correct, am I missing something?

enter image description here

The picture shows the configuration I wanna make, the green annotation represents the measures I will take with an Arduino.

The Arduino code I am using for a single analog pin is the following:

int Re = 1000;    

void setup() {
Serial.begin(9600);
}
void loop() {
int sensorValue = analogRead(A0);
float voltage = sensorValue * (5.0 / 1023.0);
float current = voltage / Re;
Serial.print(millis());
Serial.print(",");
Serial.print(voltage, 10);
Serial.print(",");
Serial.println(current, 10);
delay(500);
}

EDIT: What I am trying to measure is basically how much time my circuit can be on. Thus, let say that 2 or 3 days of variance in the result can be manageable.

\$\endgroup\$
3
  • \$\begingroup\$ Why don't you just measure the voltages with a cheap multimeter set to 199.9mV range? \$\endgroup\$ Commented Apr 27, 2018 at 17:21
  • \$\begingroup\$ I do not have a multimeter, I only have an Arduino hat act as a multimeter. If I understand correctly you mean connecting a multimeter on the battery and the actual discharging? \$\endgroup\$ Commented Apr 27, 2018 at 17:29
  • \$\begingroup\$ Put the resistor in and measure the voltage across the resistor. You can get maybe 50x better resolution. \$\endgroup\$ Commented Apr 27, 2018 at 18:57

3 Answers 3

1
\$\begingroup\$

You'll get very poor results using this methodology.

  1. Since you are sensing current in the low side the signal you create will subtract from the sensor/MCU Vdd.
  2. The signal you develop across the sense resistor is in series with any signals between the sensors and the MCU ...for example the I2C interface.
  3. The Vdd for the sensors and MCU will vary because of the signal developed across your sense resistor so measuring the battery voltage is inaccurate.

I'd suggest if you're using a separate MCU for the power measurements that you use an INA219 or its three channel variant the INA3221 to measure the currents using a high side sense resistor.

There are breakout boards readily available on Ebay/Adafruit, and you can easily modify the sense resistor(s) to measure much lower currents.

enter image description here

If all you want is an estimation of the battery lifetime, then you don't need to measure each individual portion of your project.
You could use a single high side sense resistor and an op-amp or better still an INA169 to feed you ADC.
You could even use a sensitive multimeter and a large filter cap on the Vdd to measure the current (and use a power supply instead of the battery so you can increase the voltage). This would allow you to make an estimation.

If all you have is an Arduino Nano and some resistors (from your comment), then the only way to get any worthwhile result is to program the ADC to use the Internal 1.1V reference. This at least will give you a better range on the ADC.
Refer to the Nano schematic and the ATMega328p datasheet, section 28.

\$\endgroup\$
9
  • \$\begingroup\$ Yes I know that my approach is not the most accurate. The things is that I do not have time to buy additional components, thus I would go for what I have written before. Is there something more accurate that I can do with resistors and Arduinos? What I am thinking is that I do not need to measure the exact Ampere or Voltage, I need an estimation of the battery time. Thank you. \$\endgroup\$ Commented Apr 27, 2018 at 15:40
  • \$\begingroup\$ OK but 500ms delay implies you need a LPF of <=2/3Hz otherwise you can get false readings \$\endgroup\$
    – D.A.S.
    Commented Apr 27, 2018 at 16:05
  • \$\begingroup\$ should i sample at an highest rate? \$\endgroup\$ Commented Apr 27, 2018 at 16:05
  • \$\begingroup\$ No you should filter to reject all signals above 1/2 the sampling rate \$\endgroup\$
    – D.A.S.
    Commented Apr 27, 2018 at 16:06
  • \$\begingroup\$ Maybe I am not understanding, but as the resistors will be connected to the ground of the sensors and the actual ground, there will be no signal. The current drain should be constant in the time. \$\endgroup\$ Commented Apr 27, 2018 at 16:08
0
\$\begingroup\$

It should work, provided you are adding another Arduino to do the measurement and not attempting to use the block marked "Nano" in your diagram. The ADC inputs, even in differential mode, should be between GND and Vcc, so they are negative with respect to the Nano ground.

Of course if the current draw is not steady you may get inaccurate readings depending on how you sample the data, since you have no anti-aliasing filter preceding the ADC.

\$\endgroup\$
0
\$\begingroup\$

The typical Current sensor is only 50mV drop at peak current, so amplification is needed to improve the accuracy of the measurement to use the dynamic range of the ADC. Then a mux can share this amplifier and input pin but require a serial or parallel 2 bit address. However until you define your SNR and accuracy specs, this is just another hypothetical solution. Keep in mind pulse noise and sampling rate with Nyquist demands and filter to <=1/3 of the sampling rate. This results in a common gain filter mux. for multiport current sensing.

\$\endgroup\$
1
  • \$\begingroup\$ I added some details about accuracy in the question. thank you. \$\endgroup\$ Commented Apr 27, 2018 at 16:04

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.