The Divider Is “Safe” Only Until Tolerances Stack
Ada re-derives this chapter’s own numbers step by step, at full precision
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.
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, only0.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.