usb + external power clarification

Hi all,

So I have read several post about having the USB port connected to the computer while having an external power source through the jack connector and it seems it should be no problem. However I am a bit confused and dont know if the automatic selection of the power source is operating correctly. I am working on measuring voltage and current (up to 36V and 15 amps) so I want to have the arduino powered from external source to avoid having any problem with the common ground and the computer. But i need the serial monitor to debug. While I was checking if the voltage and current readings were ok I noticed they were not accurate and found out that the reference voltage is different if I power the arduino board via USB, 9V battery or both at the same time.

This are the voltages at 5V output:

  • with 9V battery in the barrel jack : 4.971V -with USB connection : 5.079V -with USB + 9V battery: 5.064 V

I would expect that anytime the external source is connected the 5V output is the same, since it is the output of the 5V regulator, but according to the measurements that is not the case so that makes me wonder if power is coming from the external source when both (usb + battery) are connected.

Im using a UNO R3 board from elegoo, not sure if that changes anything though.

Additional question, is it possible for the arduino to know what is the 5V output voltage while running so measurements could be adjusted on the go?

thanks in advance

I don't have their schematic. Post one if you have it. If memory serves, the official UNO will only use external power if it is present (and greater than a certain voltage) even if you are plugged into USB at the same time. The computer USB is only a nominal 5V. I wouldn't be surprised with a 5% difference on the 5V from computer to computer and 1-2% of voltage variation when you have different loads on the same computer. If you need better accuracy, use an ADC IC with internal voltage references, such as AD1115, which is 16-bit accurate, cheap, and has adafruit's library to support.

I wouldn't use a 9V battery to power an arduino. I would use 6*1.5V AA batteries in series in a battery compartment if I want to power it by battery. Rather I'd use a USB power bank but you need the serial port.