Skip to content

Firmware: digital PI current controller with soft-start and OC latch#3

Open
electricalhog wants to merge 1 commit into
rust-mainfrom
software-pi-controller
Open

Firmware: digital PI current controller with soft-start and OC latch#3
electricalhog wants to merge 1 commit into
rust-mainfrom
software-pi-controller

Conversation

@electricalhog

Copy link
Copy Markdown
Owner

Summary

  • 2 kHz control loop (500 µs tick) with encoder-adjustable setpoint (100 mA/click, 20 A ceiling)
  • Scaled-integer PI controller with anti-windup clamped to the PWM range; tuning procedure documented in-source
  • Soft-start ramp (20 A/s) and overcurrent latch at setpoint + 2 A
  • ADC feedback via embedded-hal 0.2 OneShot compat (kept alongside e-h 1.0); drops embedded-time
  • Untracks electronic_load/target/ build artifacts (already gitignored)

Notes

ADC calibration constant assumes gain-50 sense at 1 mΩ; the hardware PR moves to INA185A1 (gain 20) + 2 mΩ TGHGADC_COUNTS_AT_MAX_MA will need updating to ≈ (20×0.002×20)/3.3×4095 ≈ 993 when the frontends merge.

Test plan

  • cargo build --target thumbv6m-none-eabi
  • Bench check: encoder steps setpoint, soft-start ramp visible, OC latch trips

🤖 Generated with Claude Code

- 2 kHz control loop (500 us tick): encoder-adjustable setpoint
  (100 mA/click, 20 A ceiling), soft-start ramp 20 A/s
- Scaled-integer PI with anti-windup clamp to the PWM range
- Overcurrent fault latches the load off at setpoint + 2 A
- ADC feedback via embedded-hal 0.2 OneShot (INA output, 12-bit)
- Drop embedded-time; add embedded-hal 0.2 compat alongside 1.0
- Untrack electronic_load/target build artifacts (already gitignored)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant