Problem measuring current with Nano

Hi guys, I’m working on a project with an Arduino Nano to monitor 2 power supplies and a model railroad command station. The measurement of the voltages works well, but the measurement of current (using ACS712M5 current sensors) won’t. I am using a separate power supply for the Arduino, feeding it through Vin.
During my testing it is also connected to my computer through USB. As long as it’s connected to the computer (and calibrated for that situation) it measures the current reasonably well. But as soon as I remove the USB cable it shows different readings for the current. The voltage of the USB cable differs from that of the separate power supply I use to feed the Arduino.
And the Arduino feed voltage is used to recalculate the analogRead() values into current. Probably that’s the reason.
Any ideas on how to solve this properly?
Also see: GitHub - GerardWassink/GAW_Measure: Monitor 2 power supplies and a dcc command station

What is the voltage of the power supply that feeds Vin? Is that your 12V supply or your 5V supply?

If it's the 5V supply you should feed it into the 5V pin and not into Vin.

  1. The power source for the Arduino is separate from the power supply under measure. It delivers 4.92 volts into Vin. The power supply under measure delivers 5.25 Volts.
  2. I've read that Vin should be used because the 5V pin is supposed to be an output pin? (see the remark on Vin at this page: https://docs.arduino.cc/learn/electronics/power-pins/ )

Vin needs to be around 7V or higher; it might work with 6V but is not guaranteed.

See https://docs.arduino.cc/hardware/nano/#tech-specs

You could use internal 1.1V reference voltage instead. And use voltage divider for analog input.

Yeah okay, that's probably why that didn't work.
Now I connected the 4.91 Volts to the 5V pin, and the difference in readouts for the current is gone. It now reads the same whether the USB is connected or not.
Thanks dude!

From the website you cited

"The Arduino is the heart of this measuring setup. It has it's own power supply of around 5 Volts. Do not use the 5 Volt supply that is connected to the layout. The current sensors and the LCD displays are also connected to this separate power supply."

I know Jim. Your point being?

Sorry I thought you were using the same supply for the arduino and layout.

Ah, I see. That's exactly the reason for that remark on GitHub.
Thanks for your reply though...

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.