Ada Audits the Lab’s Electrical Numbers
Ada re-derives this chapter’s own numbers step by step, at full precision
ADA · CALCULATION AUDIT
Ada Audits the Lab's Electrical Numbers
Lab 4 targets 300 RPM but the encoder reads 250 RPM, so at a proportional gain of 0.5 the correction adds 25 to the current PWM of 128, giving 153 — a 60.0% duty. That duty spins the motor on the 9 V rail at 0.35 A for 3.15 W, while a 1.5 A return through 0.2 Ω of shared ground bounces the reference by 0.3 V. This audit re-derives the whole chain and asks whether the tidy control math survives the bench, or whether startup current and ground bounce — not the duty — decide when the board resets.
Companion to the chapter Lab: Actuators — every number here comes from that chapter.
The whole lab is one chain of arithmetic: the control gain sets the duty, the duty sets a PWM byte and the average power, and the startup current through wiring resistance sets the voltage the board actually sees. Every figure below is one the labs already gave.
1. The proportional term sets the new duty.
Lab 4 targets 300 RPM but the encoder reads 250 RPM. With Kp = 0.5 the correction is added to the current PWM of 128:
2. Duty maps to a byte and to power.
On an 8-bit channel a duty fraction becomes duty × 255 (rounded to the nearest count), and the freely spinning motor on the 9 V rail draws 0.35 A:
3. Current through resistance moves voltage (Ohm's law).
The shared ground return, the held solenoid coil, and the measured startup sag all follow V = I × R:
| Lab quantity | Arithmetic shown | Result |
| PID proportional correction | 0.5 × (300 − 250) | 25 |
| New PWM value | 128 + 25 | 153 (60.0% duty) |
| PWM byte for 25% / 75% / 20% | 0.25×255 / 0.75×255 / 0.20×255 | 64 / 191 / 51 (rounded) |
| Running motor power (9 V rail) | 9 × 0.35 | 3.15 W |
| Ground bounce (1.5 A through 0.2 Ω) | 1.5 × 0.2 | 0.3 V |
| Solenoid coil dissipation | 12 × 0.45 | 5.4 W |
| Effective series R from 9.0→7.8 V sag | (9.0 − 7.8) / 1.4 | 0.857 Ω |
What this means for your design: the control math is exact — the gain decides the 60% duty and the 3.15 W average — but the driver and supply must survive the startup current, never the tidy running power. The 0.857 Ω hidden in the source and wiring is what turns a 1.4 A inrush into a 1.2 V sag, and the 0.3 V ground bounce is why a "clean" 3.3 V logic high goes ambiguous when a fat motor return shares thin breadboard ground. Star grounding, short thick returns, and bulk decoupling shrink those resistances so the arithmetic stays on paper instead of resetting the board.
Every number above is taken from the chapter’s own examples and re-derived step by step.