
Scan controller kicad
fwachsmuth/Filmkorn-Raw-Scanner
The Filmkorn Raw Scanner, turning 8mm and 16mm films into lossless 12-bit CinemaDNG

Closed-loop DC motor speed controller using PID and encoder feedback, tuned via empirical calibration and step-response analysis
Motor controller is an open-source printed circuit board by vinaysundar1, from the vinaysundar1/closed-loop-motor-speed-control repository on GitHub. It is a 2-layer board of 47 × 57 mm with 9 parts on 14 nets, routed with 87 tracks and 11 vias.
It is built around the DRV8871DDA. Its parts include 2 capacitors, 1 resistor, 1 IC and 1 connector. It belongs with the robots and motor control boards of this library.
Closed-loop DC motor speed control using a quadrature encoder for feedback and a PID algorithm to hold a target RPM, running on an Arduino Uno. Custom PCB designed in KiCad, hand-soldered and assembled into a complete PCBA. github.com/vinaysundar1/closed-loop-motor-speed-control
Finished PCBA — Arduino, DRV8871 driver, barrel jack, and encoder/OLED/potentiometer headers, hand-soldered and assembled.
Kp=0.5, Ki=0.5, Kd=0.08 — settles within one overshoot/undershoot cycle (~157 RPM peak, ~90 RPM trough) and holds steady at setpoint.
With a live, continuously-varying setpoint (driven by a potentiometer rather than a fixed step), the controller tracks a ramping target with one damped overshoot/undershoot cycle before settling, and holds within roughly ±2 RPM of setpoint at steady state.
| Component | Details |
|---|---|
| Arduino Uno | Microcontroller |
| L298N H-Bridge | Motor driver |
| DC motor with rotary encoder | GA25-370, 12V, 500 RPM nominal |
| 0.96" OLED display (SSD1306) | I2C status display |
| 10K potentiometer | Setpoint dial |
| 12V power supply or battery pack | Motor power |
| Breadboard + jumper wires | — |
flowchart LR
P[Potentiometer<br/>Setpoint Dial] -->|analog read,<br/>mapped 0-400 RPM| A[Setpoint]
A --> B((Sum))
F[Encoder Feedback] --> B
B -->|error| C[PID Controller]
C -->|PWM 0-255| D[Motor Driver / H-Bridge]
D --> E[DC Gear Motor]
E -->|shaft rotation| F
E --> G[OLED Display]
A --> GRPM = (ticks / PPR) * (60000 / interval_ms)analogWrite only accepts an 8-bit PWM duty cycle, so
the raw sum has to be forced into the range the hardware can actually accept) and
written via analogWrite to the motor driver's PWM input.Initial attempt — naive PID with unfiltered RPM feedback:
Kp=0.6, Ki=0.1, Kd=0.05 — oscillation amplitude grows over time rather than settling
Diagnosis: the derivative term was amplifying tick-count measurement noise (division
by a small dt multiplies noise), and the integral anti-windup only clamped the
final value rather than preventing over-accumulation during saturation, both
contributing to a sustained/growing limit cycle.
Fix: added EMA filtering on the RPM measurement and on the derivative term, and switched to conditional-integration anti-windup.
Kp=1.0, Ki=0.08, Kd=0.02 — clean damped response, but settles ~30 RPM below setpoint
Diagnosis: proportional control alone cannot fully close steady-state error against real motor friction/load, that gap can only be closed by the integral term, and Ki was too small to close it in a reasonable time.
Increased Ki to close the steady-state gap:
Kp=1.0, Ki=0.75, Kd=0.02 — closes the steady-state gap, but rings through roughly two decaying overshoot/undershoot cycles before settling
Isolating the double-oscillation: to find the cause, Kp was held fixed at 1.0 while Ki and Kd were varied independently across several tests (Ki: 0.75 → 0.35 → 0.5; Kd: 0.02 → 0.2 → 0.08). The first overshoot peak stayed essentially unchanged (~205–233 RPM) across every one of these combinations — strong evidence that Kp, not Ki or Kd, was driving the size of that first overshoot, since neither term had moved it despite multiple independent tests.
Note on Ki tuning: I also tested higher Ki values (up to 1.0) to see if faster settling was worth the tradeoff. Higher Ki consistently reduced settling time but increased overshoot (up to ~172 RPM vs. the original ~157 RPM), and increasing Kd alongside it didn't meaningfully reduce that overshoot. I kept Kp=0.5, Ki=0.5, Kd=0.08 as the final configuration since it produced the smallest overshoot/undershoot swings, which I prioritized over faster settling for this system.
Final tune: lowered Kp itself (1.0 → 0.6 → 0.5), keeping Ki=0.5 and Kd=0.08 fixed. The first overshoot dropped sharply with each reduction (≈205 → 170 → 157 RPM), while the undershoot depth stayed roughly constant (~90–100 RPM) regardless of Kp.
Kp=0.5, Ki=0.5, Kd=0.08 — settles after one overshoot/undershoot cycle (~157 RPM peak, ~90 RPM trough), then a smooth, non-oscillatory approach to setpoint
The initial tuning above used a fixed, hardcoded setpoint (150 RPM) for a clean, repeatable step-response test. Once the gains were validated, the setpoint was switched to a potentiometer read on an analog pin, mapped to a 0–400 RPM range, so the target speed can be changed live by turning a knob.
A moving setpoint introduces failure modes a fixed step test doesn't expose:
Kp=0.5, Ki=0.5, Kd=0.08 — RPM (orange) tracks a setpoint (green) jump, with one overshoot to one undershoot before settling and holding steady-state tracking at the new target
| Gain | Value | Purpose |
|---|---|---|
| Kp | 0.5 | Primary response to instantaneous error; lowered from an initial 1.0 after isolating it as the driver of first-overshoot magnitude |
| Ki | 0.5 | Eliminates steady-state error from motor friction/load |
| Kd | 0.08 | Damps overshoot; raised from an initial 0.02 now that the derivative acts on a filtered signal |
The breadboard prototype below was translated into a custom PCB in KiCad, consolidating the Arduino, motor driver, and peripheral connections into a single soldered board with defined connector headers.
v1 — breadboard prototype: Arduino Uno, L298N motor driver, GA25-370 encoder motor, potentiometer, and OLED display.
Full schematic — Arduino header, DRV8871 motor driver with support circuitry, barrel jack power input, and connector headers for the encoder, OLED, and potentiometer.
The DRV8871 sets its current limit via a resistor from ILIM to GND, per the datasheet relationship ITRIP ≈ 64,000 / R_ILIM(Ω). The GA25-370's rated block/stall current is 1.1A; a 32kΩ resistor was chosen to set a ~2A limit, giving roughly 2x margin above the motor's normal stall current so the limit protects against faults without nuisance-tripping during normal operation.
A 0.1µF ceramic capacitor (high-frequency switching noise) and a 47µF electrolytic capacitor (bulk current supply during motor transients) are placed across VM/GND, matching TI's reference application circuit for this driver.
Trace widths were calculated using KiCad's built-in IPC-2221 calculator:
| Net class | Current basis | Calculated minimum | Used |
|---|---|---|---|
| Power (VMOTOR, GND, motor outputs) | 2A (ILIM-protected worst case), 10°C rise | ~30.8 mil | 32 mil |
| Signal (I2C, control inputs, ILIM) | 1A reference, 10°C rise | ~12 mil | 12 mil |
Routed PCB layout — 0.8mm power traces (VMOTOR/GND/motor outputs), 0.3mm signal traces, ground pour on the bottom layer with thermal vias under the driver IC.
Bench bring-up — the assembled PCBA connected to the motor, encoder, and OLED during initial power-on testing, confirming the board functions as designed before final wiring cleanup.
| Qty | Value | Footprint | References |
|---|---|---|---|
| 1 | 0.1uF | Capacitor_THT:C_Disc_D5.0mm_W2.5mm_P5.00mm | C1 |
| 1 | 32k | Resistor_THT:R_Axial_DIN0207_L6.3mm_D2.5mm_P10.16mm_Horizontal | R1 |
| 1 | 47uF | Capacitor_THT:CP_Radial_D6.3mm_P2.50mm | C2 |
| 1 | Barrel_Jack | Connector_BarrelJack:BarrelJack_Wuerth_694108106102_2.5x5.5mm | J1 |
| 1 | Conn_01x04 | Connector_PinHeader_2.54mm:PinHeader_1x04_P2.54mm_Vertical | OLED1 |
| 1 | Conn_01x06 | Connector_PinHeader_2.54mm:PinHeader_1x06_P2.54mm_Vertical | Encoder1 |
| 1 | Conn_01x09 | Connector_PinHeader_2.54mm:PinHeader_1x09_P2.54mm_Vertical | Arduino1 |
| 1 | DRV8871DDA | Package_SO:Texas_HTSOP-8-1EP_3.9x4.9mm_P1.27mm_EP2.95x4.9mm_Mask2.4x3.1mm_ThermalVias | U1 |
| 1 | R_Potentiometer | Potentiometer_THT:Potentiometer_Bourns_3386P_Vertical | RV1 |

fwachsmuth/Filmkorn-Raw-Scanner
The Filmkorn Raw Scanner, turning 8mm and 16mm films into lossless 12-bit CinemaDNG



AlessioMorale/unav2_hardware
Initial test hardware for the future uNav board version




It measures 47 × 57 mm and has 2 copper layers, 1.6 mm thick.
9 parts, built around the DRV8871DDA. The full list of its parts is on this page, with links to each part's symbol and footprint where PCBKit's library has them.
From the vinaysundar1/closed-loop-motor-speed-control repository on GitHub, at the commit this page was made from: the board is KiCad_Files/motor_controller.kicad_pcb and its schematic KiCad_Files/motor_controller.kicad_sch. PCBKit opens the board in the browser, with nothing to install.
Its repository states no licence, so its author keeps all rights: ask vinaysundar1 before reusing the design.