Nuc-hatch: a shield for my Nucleo

Wiring the motor driver, encoder and CAN module straight to the Nucleo for the pan tracker got messy fast, and finding the right pin on the Zio headers every time was a pain. There’s only one 3V3 socket on the Zio headers too (CN8-7). I got frustrated and wired out a proto board as a hub. A common thread between posts here: spatial organization is important to me! I can’t stand wire clutter and fragile hardware setups. I digress. ...

November 19, 2026

My Nucleo's clock was 0.43% fast

Finally got some time to chase the loose thread on timing issues, and the motor bringup resurfaced the issue. Quick recap from the jitter post: the 1 kHz control tick on my pan tracker met its p99 target, but the Saleae and the DWT cycle counter didn’t agree, and the tick rate moved between captures (+2,398 ppm in one, +2,895 ppm in the next). My guess was the board clock, and it went on the todo list. ...

November 18, 2026

Motor bring-up: coast vs. brake

With the control tick and CAN working, the next piece of the pan tracker was the motor: a goBILDA 5203 gearmotor (26.9:1, with an encoder) driven by a Pololu VNH5019 carrier. The STM32H723 sends PWM, reads the encoder and current sense, and monitors the driver’s fault line. I hadn’t touched motors since university, so it’s been a fun time in the lab! Background H-bridge Four switches around the motor. Turning on different pairs drives it forward or backward. The VNH5019 is a single-chip H-bridge with current sense and a fault output. PWM duty The fraction of each PWM period the bridge drives the motor, which sets the average voltage. Here the period is 50 µs (20 kHz). Quadrature encoder Two square waves, A and B, a quarter cycle apart. Which one leads gives the direction. Counting every edge on both (x4) gives the position. Coast vs. brake Coast leaves the motor leads floating, so it spins down on friction alone. Brake ties both leads to the same rail, so the motor’s own back-EMF drives a current that slows it down. Deadband The smallest duty that gets the motor moving from rest. Open drain A pin that can only pull low. Something else pulls it high, so either side can pull the line down. Setup PWM: TIM1 CH1 at 20 kHz (PSC 0, ARR 12999 on the 260 MHz timer clock), so 13,000 duty steps. The VNH5019 does its own bridge timing, so no complementary output. Encoder: TIM4 in encoder mode on PD12/PD13, x4, with the input filter on both channels. Direction: INA/INB on two GPIOs. EN/DIAG: open drain on PE13. The driver pulls it low on a fault, so if the firmware has it released but the pin reads low, that’s a fault. Current sense: ADC3 on PF4, through 1 kΩ and 100 nF (about a 1.6 kHz corner) to smooth the 20 kHz ripple. motor.c drives it open loop: a motor CLI command with percent duty and a run deadline (1 s default, 5 s max), and a fault interrupt on EN/DIAG that latches until motor clear and puts the supervisor in FAULT. ...

November 17, 2026

CAN over a USB-C cable

The CAN transceiver boards on the pan tracker were hanging off loose jumpers, and the bus between the Nucleo and the Jetson was hand-twisted wire. Due to my deep-seated fear of bumping my boards to the point of destruction: I decided to print an enclosure for the motor driver on my new Bambu A1. It went well, so the CAN boards were next. A USB-C cable already has a twisted pair (D+ and D−) and a ground, so I put a USB-C port on the end of the enclosure, and now any USB-C cable is a CAN cable! ...

November 15, 2026

Control loop jitter on the STM32H723

I plan to run the motor loop on my pan tracker at 1 kHz on a NUCLEO-H723ZG under FreeRTOS. The Jetson will do the vision and send setpoints over CAN, and the STM32 will close the loop. The PID will use a fixed sample period, so I set a target for the tick itself: period jitter p99 under 2 µs. An interrupt on this chip should fire within a microsecond every time, making 2 µs a reasonable target. Anything slower means something is getting in its way, like: interrupts being masked, code running from slow flash, or a bad clock. The motor loop itself wouldn’t notice until tens of microseconds, so this target is conservative and could serve as a health check of sorts. ...

November 5, 2026

fretListener: a step toward my auto-transcription dreams

Last December I wanted to try and get two birds stoned at the same time: take a stab at an ML-based project using Claude Code, and experiment toward my longtime dream of creating an automatic transcription method for guitarists. The goal was to see if an ML model could tell me not just which note I played, but where on the neck I played it. That turned into fretListener: a tool to record and label my own dataset, tooling to build training mixes and train models, and a live fretboard that lights up with whatever I just played. I had a ton of fun with this one! ...

June 15, 2026