Motor control · Embedded systems
Budget BLDC motor control
An adapted BLDC motor running encoder-commutated, voltage-based FOC with SimpleFOC, built from a CAD $20 motor and controller.

Motor modification, phase and encoder wiring, and SimpleFOC integration.
Overview: an inexpensive route to field-oriented control
Before developing an integrated actuator controller, I needed a small setup for understanding the relationship between rotor feedback and motor commands. The aim was to reuse an inexpensive motor with as little mechanical modification as possible, so the control work would not depend on building a new motor first.
The prototype combines a Nidec CMC-24H motor, its integrated optical encoder, a repurposed BGC 3.2 gimbal controller, and SimpleFOC. Reusing the motor and encoder kept the first task focused on phase wiring, rotor alignment, and commutation.
The original bill of materials lists CAD $20 for the motor and controller: $5 for the motor and $15 for the board. These are historical component costs. The motor has 24 pole pairs and quadrature optical feedback, which set the firmware configuration and wiring requirements.
Connecting rotor position to the phase commands
Turning the motor is only part of the problem. For controlled torque, the phase commands need to stay aligned with the rotor. A reversed feedback direction or incorrect phase relationship changes what the controller thinks the motor is doing. Correct phase connections and feedback polarity were therefore the main integration task. SimpleFOC provided the control stack while I brought up the motor and encoder interfaces.
The 24 pole pairs also matter in firmware: electrical angle cycles 24 times during one mechanical revolution. The controller must use the correct pole-pair count when translating measured shaft position into phase timing. That made this a useful practical exercise in separating the mechanical position from the electrical quantities used by the drive.
The result was a working voltage-based FOC prototype. The published sketch selects SimpleFOC’s voltage torque mode and uses the encoder to align phase commands with the rotor. It does not read phase-current sensors: the supplied phase resistance supports current estimation rather than regulation from measured phase current. SimpleFOC torque-control modes.
A working control reference
This setup established motor/encoder integration on inexpensive hardware and gave me a reference for later controller designs. The next measurement is the relationship between command and shaft torque. A dynamometer test, with current and temperature logging, will characterize that relationship and the drive’s usable operating range.
TODOs
- Publish a complete wiring diagram alongside the original bill of materials and firmware configuration.
- Verify encoder counts per revolution and align the constructor setting with the installed SimpleFOC version.
- Measure torque versus command and check the response through slow reversals.
- Log speed, current, and temperature under sustained load to establish a usable operating range.
- Compare low-speed behavior with a higher-resolution encoder while retaining the same motor and control settings.


