# Voltmeter only goes up to 5 volts when measuring voltage

Hello, I have began to work on making a voltmeter using my Arduino redboard using the code from this page as a guideline:

https://learn.sparkfun.com/tutorials/measuring-internal-resistance-of-batteries/build-a-voltmeter

I have modified the circuit by replacing the 330 resistor with a 120k and 10k resistor to be able to handle a higher voltage but my readings still get only up to 5 volts when trying to measure something with greater voltage. What can I do?

What can I do?

(deleted)

Tried it and no success. Now, if I measure a battery over 5V, it measures it as 12V no matter what.

Here is the code I modified from the SparkFun website

``````#include <LiquidCrystal.h>

int VOLTAGE_PIN = A0;

LiquidCrystal lcd(12, 11, 5, 4, 3, 2);

void setup() {

// Initialize the LCD and clear it
lcd.begin(16, 2);
lcd.clear();
}

void loop() {

int sensorValue;
float voltage;

voltage = ((float)sensorValue * 5.0) / 1023;

lcd.setCursor(0, 0);
lcd.print(voltage);
lcd.print(" V");

delay(200);
}
``````

Here is the code

But not the schematic...

I have modified the circuit by replacing the 330 resistor with a 120k and 10k resistor to be able to handle a higher voltage

I assume that's a [u]voltage divider[/u]? With 10K as the "bottom" resistor, that's 10/130 = 0.08 so 5V would now read 0.4V (without correction).

And your calculation statement (with correction) becomes voltage = ((float)sensorValue * 5.0) / 82;

That schematic, regardless of the values of the resistors, is wrong. The center is where you connect to the Arduino pin. If you connect the 12V device to the wires running off into space, you are putting 12V into the Arduino, and have likely damaged it.

That’s a Fritzing wiring diagram, not a schematic:

ancienturtle: What are those red and black wires floating in space for?
Why is the centre of the pot connected to something on the LCD, and what is it connected to?
Several red and black wires end seemingly inside the Arduino PCB - what’s their actual connection?

Do learn to draw real circuit diagrams - get software such as KiCAD for that. It really helps for anything that gets more complex than this (and even for this simple project it’d be helpful).