Voltage from DC Generator reads 0V at high RPM, but shows correctly when stationary (Voltage Divider + ADC issue?)

Hello everyone,

I’m trying to measure the output voltage of a DC generator using a voltage divider connected to an analog pin (A1) on my Arduino. The voltage divider uses 30kΩ (R1) and 7.5kΩ (R2) resistors, designed to scale down the voltage to stay under 5V.

Here’s the setup:

DC Generator(with positive and negative terminals)
Voltage Divider: connected in parallel with the generator output
The divider output is connected to A1 on the Arduino
An ACS712 current sensor is in series between the generator's positive terminal and a lamp (load)

The issue:

When the generator spins fast (high RPM), the measured voltage drops to 0V or near 0.
But when the generator is not spinning or spinning slowly, the voltage reads correctly (typically 1–4V).

What I’ve tried:

Measuring the voltage divider output with a multimeter during high RPM: shows correct voltage (not 0V)

Here’s the code I use for reading the voltage:

int readADC(int pin, int samples) {
  long total = 0;
  for (int i = 0; i < samples; i++) {
    total += analogRead(pin);
    delayMicroseconds(200);
  }
  return total / samples;
}

adc_value = readADC(A1, 50);
voltage_adc = (adc_value * 4.95) / 1024.0;
input_voltage = voltage_adc * (r1 + r2) / r2;

What are the solutions of this problem?

Any advice or recommendations would be greatly appreciated :folded_hands:
Thanks in advance!

If the generator is not spinning the output has to be zero, 1-4 is wrong.
You must have a wiring error somewhere.
Do you have the generator negative connected to Arduino GND? It should be.

Can you print out the values for adc_value, voltage_adc, and input_voltage?
Are those variable defined as integers or floats?

I didn't connect it directly to arduino ground

the variable was defined as floats

The ground (GND) must be connected.

When you connected your meter to read the voltage did you just connect ONE lead to measure the voltage or did you connect TWO leads.

Same goes for the Arduino

1 Like

That is the problem.

See post #6

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