# How to read Voltage from DC jack

Hello everybody!
Thank you for reading my call for help

First of all, I'm using an Arduino Uno.

As the title suggests, I wish to create a program that reads the Voltage of a 9V battery that is connected to the DC jack. I know how to read the voltage if the battery is connected directly to the pins, but unfortunately in my case, I need the voltage to be read from the DC jack.

Best regards,
Atlas

The barrel jack on the board? Or the Vin pin perhaps?

You need 2 10K resistors:
9V -resistor - resistor - Gnd.
Junction of the resistors goes to an analog input to read 4.5V and lower as the battery drains.
Two 10K resistors will draw 9V/20000 = 0.45mA when battery is fresh.
Can use higher values for lower current draw.

The barrel jack on the board? Or the Vin pin perhaps?

You need 2 10K resistors:
9V -resistor - resistor - Gnd.
Junction of the resistors goes to an analog input to read 4.5V and lower as the battery drains.
Two 10K resistors will draw 9V/20000 = 0.45mA when battery is fresh.
Can use higher values for lower current draw.

Thank you for answering my call for help!
The barrel jack yes.
The circuit you have described seems to be the one for reading the voltage on the pins. That doesn't suit me.
Do you know of any way of reading it from the jack?

Do you know of any way of reading it from the jack?

Solder the suggested circuit between barrel and gnd.

You could also tap into the wire between the battery connector and the barrel plug.

Is the Vin pin not connected to the raw voltage supplied to the power jack ?

On the UNO, there is already a 10k/10k voltage divider RN1A/RN1B on Vin that feeds U5A, a comparator. If your soldering skills are up to it, you can perform this mod with only one wire jumper.

Check if the following setup meets your requirement:

2.4mA from the battery just to supply a voltage divider? I don't think so...

Another thought... any circuit that is not on the Arduino side of the barrel jack, will allow the voltage divider load to continue draining the battery, even when it's unplugged.

aarg:
2.4mA from the battery just to supply a voltage divider? I don't think so...

Another thought... any circuit that is not on the Arduino side of the barrel jack, will allow the voltage divider load to continue draining the battery, even when it's unplugged.

This is just an example. The OP might increase the values of the resistors of the voltage divider. He can go for 20k and 15k with a tap voltage of 3.85V.

Anyway, the OP is to place a voltage divider at the battery side as he wants to measure the jack voltage.

Depends what this is for, too. If you want the actual battery voltage you have to look on PWRIN on pin 2 of the jack, but the voltage that the regulator sees is VIN which is on the cathode side of D1. There is a small voltage drop on D1.

I know how to read the voltage if the battery is connected directly to the pins

What pins?

Thanks for the help everyone!
I'm really glad so many of you took the time to assist me, but I'll have to do some testing to see if I can somehow connect the DC jack to the Vin pin and read from there, or maybe resort to soldering, as some of you suggested.

This was only theoretical, building the circuit is still to come as I'm in a project which is not managed by myself.

Have a very good day and thank you again for helping

You don't have to connect the barrel jack to Vin. They are already connected, through a diode (Uno, Mega) so the voltage on Vin will be a little lower than on the barrel: measure it with a volt meter).

Note:
that diode on an Uno/Mega has a function; try to figure it out and then decide if you want to bypass it.