1

as a project I have to build a sensor hub based on Arduino. I need a couple of sensors like gyroscope, barometer, etc. This is no problem so far. The problem arises when it comes to power measurement. We have to measure the power consumption of the Arduino AND all the sensors. Sure, I could use a sensor like the Adafruit INA219 sensor. But this only gives the total consumed power of the Arduino and the sensors.

Is it possible to measure the energy, say, for every pin on the Arduino?

  • "We have to measure the power consumption of the Arduino AND all the sensors." and "But this only gives the total consumed power of the Arduino and the sensors." So what's the problem? – JRobert Aug 29 '16 at 13:32
  • For these sensor most/all pins are just for communication, so they hardly use any power. The only pin of interest is Vcc. You can deduce the power usage by temporarily removing the sensors, and seeing how much the current is reduced (though this can be inaccurate, as the arduino may behave differently when a sensor isn't present). Or connect the current sensor between Vcc on the Arduino, and Vcc on the sensor. You can also, just get the approximate values from the datasheets. – Gerben Aug 29 '16 at 14:39
  • You can put a 1Ω resistor in series with each of the 5V supplies to all the sensors, then link the sensor side of each one to analog inputs on the Arduino. Measure the voltage drop, and there's your current. – Majenko Aug 29 '16 at 15:45
  • @JRobert: Sorry, my description was not clear enough. We want to measure everything in total AND every sensor separately. So, we do not really have to measure every sensor, it would be enough to have some reliable numbers to work with. – user19698 Aug 29 '16 at 16:39
  • adur, are the measurements to be made by the program using analog input pins, or by a person with a DVM? – James Waldby - jwpat7 Aug 29 '16 at 18:04
0

"Sorry, my description was not clear enough. We want to measure everything in total AND every sensor separately. So, we do not really have to measure every sensor, it would be enough to have some reliable numbers to work with."

"it possible to measure the energy, say, for every pin on the Arduino?"

You ask if it possible to measure the energy- yes it is-or at least an approximation. The basic solution is as follows. Suppose you want to find the energy consumed by some component at one pin. Energy is measure in joules. For an electrical circuit we the amount of energy (consumed in 1 second) is given by the formula

joules=current X voltage. Lets consider the case with one sensor first , lets refer to this as sensor A. The amount of energy that electrical component consumes in some time duration is by sensor A is:

joules (use by sensor A)=current X voltage X time duration sensor A is on

Now to make this formula applicable to your answer- we can replace voltage by the average voltage, and current by average current, since this is mathemtically equivalent, that the component is on for, and the time duration would be the time the component is on for. So the equivalent formula that can be used is

joules= average current X average voltage of sensor A during time duration X time duration sensor A is on

So for example if the sensor is only ever used for 50 minutes for all time throughout your project- and the sensor is turned on at the arduino pin for 1 second for every minute of that 50 minutes then the energy used by that sensor on that specific pin is equivalent to leaving the pin on for 50 seconds at the average voltage and average current of that sensor. Say the average voltage is 3v then the energy and average current is 20ma. Then the energy used by that sensor is thus 3v*0.02amps*55 seconds=3.3 joules.

Thus to get the total energy (if there were two sensors A and B) you would just need to sum

(joules (use by sensor A)= current of A X voltage of A Xtime duration sensor A is on)+(joules (use by sensor B)=current of B Xvoltage of B Xtime duration sensor B is on.)

Similar formula for more sensors.

To sum up- basically you would need your arduino program to keep track of how long each sensor pin is on (assuming high voltage turn on the sensor and makes it use power, low voltage turns off the sensor or make it use no power) for each of the time duration in the formula for the duration of the project, you would need an estimate of the average voltage and current (e.g. from data sheet) or another way. Then you would need to use the formula in your code to compute the energy used by each sensor and the total energy. If you have a way to measure the voltage and current fast enough then you could use them measurement instead of using average value as explained above-but I guess using averages is the easiest way to do it.

.

  • Okay, thank you. That is what I was afraid of. But I think I will stick to this solution. Tank you :) – user19698 Aug 30 '16 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy