The graphical user interface (GUI) for the BLDC motor state visualization is a part of a bigger project related to BLDC motors control. I have introduced a device that is an integral, hardware part of the project in a previous post – A Device for the Monitoring of the BLDC Motor Controller. The software was written in C++ with Qt and Qwt libraries.
The main window of the application was divided into a group of components based on their functionalities. It contains buttons for connection establishing, the proportional-integral-derivative (PID) controller settings, control, and visualization part.
Functionalities
Data visualization
- Motor temperature measured by a DS18B20 sensor (numerical value and graphical indicator).
- Motor’s rotational speed calculated based on the output from a magnetic encoder AS5040 (numerical value and plot).
- Motor’s rotational speed calculated based on the time between consequent motor commutations (averaged).
- Current consumed by the motor.
- Motor power supply voltage.
Motor control
- Set value for the PID controller as a desired rotational speed in revolutions per minute (RPM).
- Modification of the PID controller settings. The new settings are sent to the device by clicking on the dedicated button.
Monitoring device configuration
- Configure display backlight value.
- Activation and deactivation of the I2C-based communication with the motor controller.
Implementation
As mentioned in the beginning, I have written the GUI in C++ with Qt and Qwt libraries. It uses two threads. The first thread is responsible for receiving and sending data from/to the device by USB interface. Of course, with additional USB-UART converter, because the device supports only the UART interface. The second thread handles the graphical user interface updates.
Conclusion
The GUI is really helpful during the motor controller development phase. It can be used to the tuning of the controller but also to validate if the control method is correct. From my perspective, one significant and missing feature is data saving to file. Such data could be used in further analysis of the controller performance. For sure I’ll add such a feature in the next version of the application.