logo elektroda
logo elektroda
X
logo elektroda

No Voltage Reading on A0 Pin With Voltage Divider on Rectifier to Microcontroller

153 12
ADVERTISEMENT
  • #1 21671578
    David Jensen
    Anonymous  
  • ADVERTISEMENT
  • #2 21671579
    Mark Nelson
    Anonymous  
  • #3 21671580
    David Jensen
    Anonymous  
  • #4 21671581
    Mark Nelson
    Anonymous  
  • ADVERTISEMENT
  • #5 21671582
    Steve Lawson
    Anonymous  
  • #6 21671583
    Steve Lawson
    Anonymous  
  • #7 21671584
    Steve Lawson
    Anonymous  
  • ADVERTISEMENT
  • #8 21671585
    Steve Lawson
    Anonymous  
  • ADVERTISEMENT
  • #9 21671586
    Steve Lawson
    Anonymous  
  • #10 21671587
    Steve Lawson
    Anonymous  
  • #11 21671588
    Mark Nelson
    Anonymous  
  • #12 21671589
    Steve Lawson
    Anonymous  
  • #13 21671590
    Steve Lawson
    Anonymous  

Topic summary

✨ The discussion addresses an issue where a microcontroller's analog input pin A0, connected via a voltage divider to a rectifier output, shows no voltage reading, while pin A1, measuring the voltage drop across a shunt resistor, registers a signal. The voltage divider formed by resistors R1 and R2 is expected to scale the rectifier voltage to about 95%, but A0 reads a negative voltage (-0.3V), which is inconsistent with expected behavior and likely indicates wiring errors or grounding issues. The shunt resistor R3 is used to measure current indirectly by voltage drop, with R4 acting as a buffer to protect the microcontroller input. The negative voltage reading on A0 suggests a bad ground or incorrect connections, as microcontrollers typically cannot read negative voltages. Suggestions include verifying wiring, measuring voltages with a voltmeter or oscilloscope independently of the microcontroller, and testing inputs with known voltages such as a battery. The discussion also highlights that the current measurement approach may be flawed if the shunt resistor is connected directly across the supply without a proper load, and that the voltage divider may be redundant if the supply voltage is already measurable at A1. Protection diodes (D1, D2) are recommended to safeguard MCU inputs from voltage spikes. Additionally, the use of an operational amplifier with a separate power supply is proposed to invert negative voltages and scale signals to match the ADC input range, improving resolution. Considerations about ADC reference voltage and resolution are discussed, emphasizing the need for appropriate voltage scaling to maximize measurement accuracy. Overall, the problem likely stems from incorrect wiring, grounding, and measurement setup rather than component failure.

FAQ

TL;DR: 2.77 A from 1.3 V across 0.47 Ω proves the shunt path works; “Disconnect your micro from A0 and A1 and read the voltages again.” A0’s -0.3 V suggests grounding/wiring or divider issues, not the ADC itself. [Elektroda, Mark Nelson, post #21671581]

Why it matters: This FAQ helps hobbyists debug “no reading on A0” when sensing supply voltage/current into a microcontroller safely and accurately.

Quick Facts

Why do I get no voltage on A0 but a signal on A1?

Your shunt path (A1) works, but A0 reading −0.3 V points to wiring or ground reference errors. The R1–R2 divider should present about 95% of the supply at A0; a negative value indicates misconnection or bad ground. Disconnect the MCU, measure A0/A1 with a meter, and verify grounds. The MCU will not read a negative input. [Elektroda, Mark Nelson, post #21671581]

How should I debug an A0 pin that reads negative or zero?

Isolate first: disconnect A0/A1 from the microcontroller and measure with a DMM. Confirm the divider ratio and ground continuity. Next, inject a known source (e.g., a 1.5 V battery) into A0 to validate the ADC pin. Reconnect once readings match expectations. “Disconnect your micro from A0 and A1 and read the voltages again.” [Elektroda, Mark Nelson, post #21671581]

Do I need the series resistor R4 between shunt and MCU?

If the MCU ADC input impedance is high, R4 introduces negligible drop and mainly acts as protection. However, excessive series resistance plus low ADC input impedance can distort readings. Ensure protection via proper clamping, and size R4 to limit fault current without creating measurement error. [Elektroda, Mark Nelson, post #21671581]

Can I compute both supply voltage and current from A0 only?

Yes. Measure the divider output Vm at A0, compute Vs = (R1+R2)×Vm/R2, then current I = Vs/Rshunt (e.g., 0.47 Ω). This makes A1 redundant if the divider and shunt are placed correctly and the ADC input impedance does not load the divider excessively. [Elektroda, Steve Lawson, post #21671582]

Where should the shunt resistor go in a simple supply-measurement setup?

Place the shunt in series with the load, not directly shorting across the source. A shunt across the supply behaves as a load and can upset measurements. Ensure your measurement points reference the same ground and that the divider senses Vs, not the shunt drop. [Elektroda, Steve Lawson, post #21671582]

What’s the quickest 3-step test to localize the fault?

  1. Disconnect MCU; measure A0 and A1 with a DMM against ground.
  2. Inject a known 1.5 V source into A0 to verify ADC accuracy.
  3. Reconnect; confirm A0 ≈ 0.95×Vs and A1 equals Vshunt. [Elektroda, Mark Nelson, post #21671581]

How do I protect MCU analog inputs from over-voltage?

Add clamp diodes from the analog node to Vdd and ground, plus a small series resistor. These limit excursions beyond the MCU’s input limits during transients or miswiring. One diode may suffice, but symmetrical clamps improve robustness. Keep wiring short to reduce inductive spikes. [Elektroda, Steve Lawson, post #21671585]

Why might my ADC reading be coarse or jumpy?

Insufficient ADC reference scaling reduces resolution. With a 1.2 V reference, an 8‑bit ADC resolves ~4.71 mV/step; with a much higher reference, steps get larger and readings appear jumpy. Noise and divider impedance can worsen this. Lower the reference or add a gain stage. [Elektroda, Steve Lawson, post #21671586]

When do I need an op-amp between the shunt and the ADC?

Use an op-amp when the shunt voltage is small, the ADC reference is high, or you need isolation. Choose a single-supply device whose input includes ground. If you want full-scale ADC swing to Vdd, use rail‑to‑rail output or power the op‑amp with extra headroom. [Elektroda, Steve Lawson, post #21671587]

Could the divider be unnecessary in my setup?

Yes, if A1 already gives you the source voltage information needed, the R1–R2 divider may be redundant. Alternatively, if the divider is for scaling Vs to a safe ADC level, you can derive both Vs and current from A0 and remove A1. Clarify your measurement intent first. [Elektroda, Steve Lawson, post #21671582]

What is a shunt resistor and how is current computed?

A shunt is a low-value resistor placed in series with the load. Measure Vshunt and compute current with I = V/R. Example: 1.3 V across 0.47 Ω yields about 2.77 A. Keep trace resistance low and reference grounds correctly to avoid measurement error. [Elektroda, Mark Nelson, post #21671581]

What happens if the ADC sees a negative voltage?

Most MCUs cannot measure below ground on single-ended ADC inputs. A negative A0 will read as zero or out-of-range and may indicate wiring or ground faults. Fix the reference first; then protect inputs to prevent damage. “Your micro most likely won’t read a negative voltage.” [Elektroda, Mark Nelson, post #21671581]

Does ADC input impedance matter for dividers and shunts?

Yes. Low ADC input impedance can load a divider, skewing Vm. Ensure divider current significantly exceeds ADC input current, or buffer with an op-amp. Some MCU analog inputs can be around the 10 kΩ range, so plan divider values accordingly. [Elektroda, Steve Lawson, post #21671582]

What is a rail‑to‑rail op‑amp and why might I need one here?

A rail‑to‑rail op‑amp can drive outputs near both supply rails. If your ADC reference equals Vdd, you need the op‑amp to swing close to Vdd for full resolution. Otherwise, power the op‑amp above Vdd to reach the required output span. [Elektroda, Steve Lawson, post #21671587]

How do I choose an ADC reference for current shunt measurements?

Match the reference to the maximum amplified shunt voltage to maximize resolution. If maximum Vshunt is small, use a low reference or add gain. Example: with a 1.2 V reference, 8‑bit resolution is ~4.71 mV/LSB, improving small-signal accuracy. [Elektroda, Steve Lawson, post #21671586]

What’s the failure mode if I put the shunt across the supply?

It becomes a load that can short the source, distort readings, and waste power. Place the shunt in series with the actual load, then sense its drop. Rethink nodes so A0 senses Vs and A1 senses only Vshunt if you keep both. [Elektroda, Steve Lawson, post #21671582]
ADVERTISEMENT