Transform a DC Motor Into a Stepper with Driver and Servo Functionality
The DIY hybrid motor uses a pair of PCBs stacked behind the motor assembly with an STM32 and Hall effect sensors to control rotation.
DC and stepper motors are staples in the DIY and engineering communities and are used for everything from robotics to CNC machines. While they are great pieces of hardware by themselves, what if they could be combined? XPIX developer Frank Herrmann asked himself that question and successfully created a hybrid motor that acts as both a DC and servo motor.
“I had always wanted to build a stepper motor from a simple DC motor, and these small geared motors have caught my eye for a long time,” Herrmann noted in his project log. “My solution is very compact, and I am sure you will like it. This DC motor can be controlled by the signal’s direction as well as step like a normal stepper motor with driver, only that my solution already brings the driver.”
Herrmann made the motor by stacking a pair of small PCBs behind the motor assembly. The first PCB, positioned directly behind the assembly, is the XMoto driver, which is outfitted with a series of magnets, a pair of Hall effect sensors and a tiny DRV8837 DC motor driver. It also packs a magnetic encoder nestled right behind the PCB. The first board is wired to the second PCB featuring an STM32L432-based microcontroller and an LDO and debug LED, which is housed in a 3D-printed enclosure.
The DC motor is controlled by the signal’s direction and can step like a typical stepper motor with driver. The microcontroller handles two pin inputs – at one, it “listens” to the step impulses. On the other, it “listens” for the direction signals (STEP and DIR) and moves the motor (via motor driver) accordingly. According to Herrmann, the hybrid provides nearly the same weight and torque as a NEMA 17 stepper motor, but those who would like to recreate his build will have to determine if that is correct.