Marian Vittek Frees Up a Raspberry Pi 5's CPU, By Turning the RP1 Chip Into a DShot Motor Controller
Making use of the recently-released piolib, this clever program makes use of spare resources on the RP1 to implement DShot control.
Developer Marian Vittek has released a tool, built around piolib
, which provides precision motor control on a Raspberry Pi 5 without tying up its CPU — using the RP1's Programmable Input/Output (PIO) capabilities to handle the DShot protocol instead.
"I've released an implementation of the DShot protocol to control brushless motors from a Raspberry Pi 5," Vittek explains of the project. "This implementation uses the recently released 'piolib
' library, which allows to program the RP1 microcontroller. DShot values are generated by RP1 and do not overload the main CPU."
DShot is one of a variety of protocols designed for use with modern electronic speed controllers (ESCs) as an alternative to pulse-width modulation (PWM). "[The] DShot protocol is more advanced than PWM," Vittek explains. "It is digitally accurate and does not require calibration. It allows a much higher update frequency. It allows to set the direction of rotation and to execute special commands such as beep (beacon)."
Typically, implementing DSHot on the Raspberry Pi 5 single-board computer would mean doing so in software — tying up the CPU when it might be needed for other tasks, with the potential for stuttering and responsiveness issues if the CPU is overloaded. Vittek's implementation, though, takes advantage of the recently-released piolib
library to offload the work to the RP1 — an in-house chip, the creation of which inspired the Raspberry Pi RP2040 and RP2350 microcontrollers, which normally handles the Raspberry Pi 5's on-board low-speed interfaces.
Running on the RP1's unused resources, specifically its spare Programmable Input/Output (PIO) blocks, Vittek's DShot tool can handle up to 26 motors connected to the Raspberry Pi's general-purpose input/output (GPIO) pins, without requiring any CPU time. IT supports DShot 150, 300, 600, and 1200, Vittek says, and should work on both the Raspberry Pi 5 and Raspberry Pi 500 — though not older models of Raspberry Pi, which lack the RP1 chip.
More information is available in Vittek's Reddit post, while the project source code is available on GitHub under the permissive MIT license. Anyone interested in making use of the Raspberry Pi 5's RP1 chip in the same way will find piolib
in Raspberry Pi's utils GitHub repository under the permissive BSD three-clause license.