The Divider Is “Safe” Only Until Tolerances Stack

The Divider Is “Safe” Only Until Tolerances Stack

Ada re-derives this chapter’s own numbers step by step, at full precision

foundations
math-foundations
calculation-audit
sensors
Ada ADA · CALCULATION AUDIT

The Divider Is "Safe" Only Until Tolerances Stack

The chapter’s fix for a 5V HC-SR04 ECHO pin driving a 3.3V ESP32 GPIO is a voltage divider built from 2k and 3.3k resistors, which it reports settles at 3.11V and calls safe. That number sits just under the 3.3V limit, with no stated allowance for resistor tolerance. This audit asks the question that thin margin invites: how much headroom does the 2k/3.3k divider actually leave once real-world resistor tolerance is factored in?

Companion to the chapter Common Sensor Mistakes — every number here comes from that chapter.

See the relationship before changing it

The figure reads from left to right. The blue card is lower divider resistor. The middle card applies this page's rule. The green card is gpio voltage. Walk the arrows once: set the input, apply the rule, then read the result with its unit.

The retained audit below checks several chapter fixtures. This model keeps those stated values fixed and changes only lower divider resistor, so the numeric fixture does not switch without explanation.

Lower divider resistor changes gpio voltage An input card leads through the rule voltage = 5 V x lower resistor / (2 kOhm + lower resistor) to the gpio voltage result. INPUT PAGE INPUT APPLY THE RULE predict calculate check units OUTPUT RESULT
Walk the arrows. A larger lower resistor raises the GPIO voltage and spends the divider safety margin.

Derive the baseline in four named moves

  1. 1

    Name the input. The chapter baseline is 3.3 kOhm.

  2. 2

    Name the relationship. voltage = 5 V x lower resistor / (2 kOhm + lower resistor)

  3. 3

    Substitute with units. 5 x 3.3 / (2 + 3.3) = 3.1132 V

  4. 4

    Read the result. Keep the unit beside the value. Use it only inside the technical boundary on this page.

Predict, then change lower divider resistor

Try Predict the direction of voltage = 5 V x lower resistor / (2 kOhm + lower resistor). Test another lower divider resistor, then compare gpio voltage.

3.3 kOhm
Chapter baseline
GPIO voltage

Observe A larger lower resistor raises the GPIO voltage and spends the divider safety margin. Reset lower divider resistor to 3.3 and compare gpio voltage.

Explain A larger lower resistor raises the GPIO voltage and spends the divider safety margin.

Check yourself

What should you do before trusting a moved-control result?
Answer: Predict its direction, apply the shown relationship, keep the units, and reset to the worked baseline.
What does this small model leave out?
Answer: Only lower divider resistor moves here. Field effects named in the technical boundary stay fixed.
Try

Calculate Vout for the 5 V ECHO signal with 2.0 kΩ over 3.3 kΩ, then repeat with the top resistor at -5% and the lower resistor at +5%.

Observe

Nominal output is 3.1132 V with 186.8 mV headroom; the tolerance stack raises it to 3.229 V and leaves only about 71 mV.

Explain

The divider voltage is set by a resistor ratio, so a smaller series resistor and larger shunt resistor both push the GPIO voltage upward and consume the same safety margin.

Ada: The fix for the 5 V ECHO pin is a 2k / 3.3k divider, and the chapter reports 3.11 V as safe for a 3.3 V pin. The arithmetic is right, but “safe” deserves a second look, because the margin is thinner than it appears.

Nominal output:

  • V_out = 5 x 3.3 / (2.0 + 3.3) = 5 x 0.62264 = 3.1132 V
  • Headroom below the 3.3 V limit: 3.3 - 3.1132 = 0.1868 V, only 0.1868 / 3.3 = 5.7%

Now let the resistors carry a standard +/-5% tolerance (an illustrative worst case, not a chapter value). The output climbs when the top resistor R2 runs high and the series R1 runs low:

  • V_out = 5 x (3.3 x 1.05) / (2.0 x 0.95 + 3.3 x 1.05) = 5 x 3.465 / 5.365 = 3.229 V
  • Headroom now: 3.3 - 3.229 = 0.071 V

The tolerance stack has eaten more than half of an already slim margin, leaving about 71 mV. Add any lift on the 5 V rail and the “safe” divider crosses the limit. The design-meaning is not that the divider is wrong; it is that a divider sized to nominal values is a margin bet, not a guarantee, which is exactly why the chapter’s other fix, a 3.3 V-native HC-SR04P or a proper level shifter, is the more honest answer for a pin you cannot afford to cook.

Every number above is taken from the chapter’s own material and re-derived step by step.

Technical boundaries: This DC divider check omits 5 V rail tolerance, resistor temperature coefficients, GPIO leakage and clamp current, ECHO edge speed, cable transients, ground offset, and absolute-maximum derating.

Ready: work the ledger before checking it.