A 0-25V voltage sensor module lets an Arduino read a higher positive DC voltage through an analogue input. The board is a simple resistor divider, not an isolated or powered sensor. Correct grounding, ADC limits and calibration matter more than the amount of code.
In this guide
How the 0-25V module works
The two resistors on the module form a nominal 5:1 voltage divider. The signal pin therefore carries about one fifth of the voltage applied to the screw terminals. A 12V input produces about 2.4V at S, which a 5V Arduino analogue input can read.
The actual reading depends on resistor tolerance, the Arduino's real reference voltage and ADC behaviour. Treat 5.0 as the starting scale factor, then calibrate it against a trusted multimeter.
| Measured input | Nominal signal at S | Comment |
|---|---|---|
| 1V DC | 0.2V | Low readings are more affected by ADC resolution and noise. |
| 5V DC | 1.0V | A safe starting test for a 5V Arduino board. |
| 12V DC | 2.4V | Within a nominal 5V ADC range. |
| 24V DC | 4.8V | Close to the absolute nominal limit. Leave headroom and confirm the actual supply and ADC reference first. |
Positive DC only. Do not connect this module to mains, AC, a negative voltage or an unknown source. It has no galvanic isolation, fuse, over-voltage clamp or reverse-polarity protection.
Pinout and Arduino Uno wiring
The NZN stock board is marked VCC<25V and has 30.1k and 7.5k resistor markings. Its three-pin header is labelled S, + and -. On this common divider layout, the centre + pin is not connected.
| Module connection | Connect to | Purpose |
|---|---|---|
| VCC screw terminal | Positive of the DC voltage being measured | Divider input |
| GND screw terminal | Negative of the DC voltage being measured | Measurement ground |
| S header pin | Arduino A0 | Scaled analogue signal |
| - header pin | Arduino GND | Common ground |
| + header pin | Leave unconnected | Not connected on this module |
- Disconnect all power. Make every connection before energising the source.
- Join the grounds. Connect the module - pin to Arduino GND. The screw-terminal GND and Arduino ground become the same electrical point.
- Connect the signal. Run S to Arduino A0.
- Leave + unused. Do not connect the centre + header pin to 5V or 3.3V on this divider module.
- Connect the measured source. Positive goes to the VCC screw terminal and negative goes to the GND screw terminal.
- Start at a low known voltage. Use a current-limited supply or a small battery and compare the result with a multimeter before measuring anything higher.
No module power wire is required. The divider takes its signal from the voltage being measured. Only S and - need to connect to the Arduino.
Arduino example code
This example targets a classic Arduino Uno with its default 10-bit reading range. Set vRef to the voltage you actually measure between the Arduino 5V and GND pins.
const int sensorPin = A0;
const float vRef = 5.00;
const float dividerRatio = 5.00;
void setup() {
Serial.begin(9600);
}
void loop() {
int raw = analogRead(sensorPin);
float signalVoltage = raw * (vRef / 1023.0);
float inputVoltage = signalVoltage * dividerRatio;
Serial.print("Raw: ");
Serial.print(raw);
Serial.print(" Input: ");
Serial.print(inputVoltage, 2);
Serial.println(" V");
delay(500);
}
Upload the sketch, open Serial Monitor at 9600 baud and compare the displayed input voltage with your multimeter. If the reading is consistently high or low, calibrate the multiplier rather than hiding the error with rounding.
A simple averaged reading
For a steadier display, average several samples. This reduces random noise, but it does not correct the reference voltage or divider tolerance.
long total = 0;
const int samples = 20;
for (int i = 0; i < samples; i++) {
total += analogRead(sensorPin);
delay(2);
}
float rawAverage = total / (float)samples;
float inputVoltage = rawAverage * (vRef / 1023.0) * dividerRatio;
How to calibrate the voltage reading
-
Measure the Arduino reference. With the Arduino powered normally, measure its 5V pin relative to GND and enter that value as
vRef. - Apply a stable test voltage. Use a source comfortably inside the range, such as 5V or 12V DC.
- Record both readings. Note the trusted multimeter value and the Arduino result.
- Calculate a correction factor. Divide the multimeter reading by the Arduino reading.
- Apply the correction. Multiply the calculated input voltage by that factor, then repeat the check at a second voltage.
Example: if the multimeter shows 12.10V and the Arduino reports 11.82V, the correction factor is 12.10 / 11.82 = 1.0237. Multiply the result by 1.0237 in your sketch.
Understand the important limits
- The input must stay positive. A negative signal can damage an Arduino analogue input.
- The grounds are connected. This module is not suitable where the measured circuit must remain isolated from the Arduino or USB-connected computer.
- 25V is a nominal maximum for a 5V ADC. Component tolerance and supply variation reduce the safe margin. Do not design routine operation at the absolute edge.
- 3.3V boards need a separate calculation. A nominal 5:1 divider suggests 16.5V at a 3.3V ADC limit, but many boards have lower or configurable ADC ranges. Check the exact board documentation.
- This is not a precision instrument. ADC reference error, source impedance, resistor tolerance and electrical noise all affect the result.
- The module measures voltage in parallel. Connect it across the source. Do not place it in series like a current sensor.
Troubleshooting
| Symptom | Check |
|---|---|
| Always reads 0V | Confirm S reaches A0, both grounds are joined, the screw terminals have correct polarity and the source is actually on. |
| Reading is about one fifth of expected | You are displaying the signal voltage but have not multiplied by the divider ratio. |
| Reading is consistently high or low | Measure the Arduino reference voltage, then calibrate the scale factor against a trusted meter. |
| Reading jumps around | Shorten the signal and ground wiring, average samples and check that the source and USB ground arrangement is safe. |
| Reading stops increasing near the top of the range | The ADC is clipping. Disconnect power and reduce the measured voltage immediately. |
| Board resets when connected | Stop and check for a ground conflict, reversed input or an attempt to power the Arduino through the unused + pin. |
Frequently asked questions
Does the + header pin power the sensor?
No. On this module the centre + pin is not connected. Leave it unused. Connect S to the analogue input and - to Arduino ground.
Can I measure a 12V battery while the Arduino uses USB power?
Only if joining the battery negative to Arduino and computer ground is safe for the complete system. The module is not isolated. If you are unsure about the grounding path, do not connect it.
Can it measure AC voltage?
No. It is a positive DC divider and has no rectifier or isolation. Use a correctly rated, isolated measurement method for AC.
Why does the reading change when USB power changes?
The default Arduino conversion depends on its analogue reference. A different USB port or supply can shift the 5V rail, which shifts the calculated result unless you measure or stabilise the reference.
Can I use the same formula on an ESP32?
Not safely by assumption. ESP32 ADC range, attenuation, resolution and calibration depend on the exact board and configuration. Check the current documentation for your board and keep the S voltage inside its specified ADC range.
Reference material checked: Arduino documents analogRead(), the Uno analogue pins and its built-in Read Analog Voltage and Smoothing examples. The module ratio and pin functions were checked against NZN stock markings and the physical board layout.
Arduino analogRead reference | Arduino Read Analog Voltage example | Arduino Smoothing example | Arduino Uno R3 datasheet
Start low, confirm the wiring, then calibrate
A known low-voltage source and a multimeter will catch a reversed terminal, missing ground or incorrect scale factor before it becomes an expensive mistake.
View the 0-25V voltage sensor module
