Ada Audits the Worked-Example Numbers
Ada re-derives this chapter’s own numbers step by step, at full precision
ADA · CALCULATION AUDIT
Ada Audits the Worked-Example Numbers
A 12-bit ADC on a 3.3 V reference measures 2.0 V, and the firmware stores the floor of 2481.818 as code 2481; elsewhere the same chapter sizes a 159 Hz RC filter, a 5.09 mA duty-cycled battery draw, and a 0.25 W resistor. Each figure is a single line of arithmetic that quietly fixes a physical limit. This audit re-derives every scale factor and rounding step and asks whether those numbers are physically plausible or just values the firmware happens to carry.
Companion to the chapter ADC/DAC Worked Examples — every number here comes from that chapter.
A worked example is an audit trail: every scale factor, rounding choice, and physical limit should be visible before firmware turns the value into a decision.
1. ADC codes are ratios, not magic numbers. The chapter's 12-bit, 3.3 V example measures 2.0 V by scaling the input against the endpoint code 4095:
2. The examples also expose the physical limit behind the formula. Quantization, filter bandwidth, and resistor power become design constraints only after the units are carried through.
| Audit check | Arithmetic shown | Design consequence |
| 10-bit ADC at 5 V | 5 V / 1024 = 0.0048828 V = 4.88 mV | A single count cannot prove a change smaller than about one step. |
| 12-bit ADC reading 2.0 V | (2.0 / 3.3) × 4095 = 2481.818, then floor = 2481 | The rounded-down code is expected, not an off-by-one bug. |
| 10 kohm and 100 nF RC filter | 1 / (2 × pi × 10000 × 100e-9) = 159.15 Hz | Signals well below 159 Hz pass; faster noise is attenuated. |
| Duty-cycled battery current | 50 mA × 0.10 + 0.1 mA × 0.90 = 5.09 mA | 1000 mAh / 5.09 mA = 196.46 h, so "10% active" is still current-hungry. |
| Power in a 100 ohm resistor at 50 mA | (0.050 A)2 × 100 ohm = 0.25 W | A 0.25 W part is at its limit; selecting at least 0.5 W adds margin. |
| Red LED current limit from 3.3 V | (3.3 V − 2.0 V) / 0.010 A = 130 ohm | Rounding up to 150 ohm reduces current and protects the GPIO path. |
What the audit buys you: the same arithmetic that produces a firmware value also explains whether the sensor range, analog bandwidth, energy budget, and heat limit are physically plausible.
Every number above is taken from the chapter’s own material and re-derived step by step.