- UPCX530 - 
Sensored BLDC- and DC-Servomotor Positioning Controller


BLDCPCB320x240 DCMotorEncoder320x240


This project is based on work done by Lawrence Glaister VE7IT, Maximilien Mousset and others mentioned in the source code and the "Space Vector Modulation" application note AN957 from Microchip.

Controller firmware description:

The goal of the project was to develop a small and cheap PID-regulated positioning controller for both sensored BLDC- and DC-Servomotors that is controlled by step-, direction- and enable- input signals.

It uses a Microchip dsPIC30F4012-30 DSP in 28 pin package to regulate the motor position and, for BLDC motors, the phase-angle of the motor windings by evaluating their hall sensor state. The PID settings are stored in the EEProm of the controller via a serial interface by using either a serial terminal program or a software that is included in the package.

The controller automatically detects the motor type connected to it by evaluating the state of the tree hall-sensor pins when booting. If at least one is found low it switches to BLDC motor mode. If all are high it switches to DC motor mode.

The controller drives 3 MOSFET half bridges using an internal deadtime generator via standard MOSFET bridge drivers. An external error signal is evaluated to shutdown the bridge in case of an overcurrent event.

The standard TTL-level A/B incremental encoder signals are passed through an internal digital low pass filter to improve noise immunity. The index signal of the encoder is not evaluated by the controller itself but can be evaluated by the host.

The controller now includes an internal adjustable signal generator to generate the step-signals for simple tuning.

The firmware is written for the Microchip C30 compiler entirely in C. The code itself is not very well structured because it has grown between different developers ;-). To compile it yourself, you will need the full version of the compiler that allows all optimization levels. The HEX-file to program the controller without compiling is included in the project files.

Project PCB

I developed a small (56mm by 56mm) positioning controller board that is intended to be positioned close to the motor. It is designed to drive DC- or BLDC- servomotors up to 240W at 24V or 480W at 48V. Beside the motor supply, it requires a separate 10V to 15V supply for the MOSFET-drivers and logic. All parts to build the controller board should be easily available.

Included in the project is also a small PCB that contains the levelshifter to program the PID parameters into the controller. This programming adaptor also provides a standard header for programming the firmware into the microcontroller.

All PCB files are included in the project package (Altium-Designer files and extended gerber files).

PC Software

Based on the idea behind the tuning tool written by Maximilien Mousset i developed a new basic tuning tool written in Embarcadero Delphi. This tool allows easy tuning of the PID loop parameters and the BLDC vector modulation parameters. It also displays the positioning error over time like Maximilien Mousset's tool. It also allows adjusting the internal step-signal generator. 

The software is available precompiled in the project files. The source files are also available.

Further reading:

Some of the videos in this area are saved on my server. They require Apple QuickTime and some time to load. 

Here is a video showing a small BLDC motor in operation

Here is a video showing a test with a linear magnetic strip encoder 

A video of my pick and place machine project. It uses the UPCX530 to drive its X and Y axis

Controller description

Controller firmware

Controller board

Building the controller board

The software



Cookies make it easier for us to provide you with our services. With the usage of our services you permit us to use cookies.