"A Guide to Using BLDC Motors (Gimbals) with Open Source SaraKIT PCB: A Comparison of Stepper Motors, Servos, and BLDC Motors"BLDC motors have become increasingly popular due to their smooth operation, high torque, and precise control. In this guide, we will explore the use of BLDC motors using SaraKIT, and compare them to other commonly used motors such as stepper motors and servos. In this project, I demonstrate how easy it is to control BLDC gimbal motors, and also discuss the advantages and disadvantages of solutions based on servos or stepper motors. I also show the difference in controlling gimbal motors that have a decoder and those that do not. Gimbal motors with a decoder are controlled using the Field Oriented Control (FOC) algorithm.
DETAILSThis example shows how to control motor speed, torque, and angle of BLDC gimbal motors using the Field Oriented Control (FOC) algorithm (or not) in C++/Python.
"A Guide to Using BLDC Motors (Gimbals) with OpenSource PCB SaraKIT: A Comparison of Stepper Motors, Servos, and BLDC Motors"
BLDC motors have become increasingly popular due to their smooth operation, high torque, and precise control. In this guide, we will explore the use of BLDC motors using SaraKIT, and compare them to other commonly used motors such as stepper motors and servos.
In this video, I demonstrate how easy it is to control BLDC gimbal motors, and also discuss the advantages and disadvantages of solutions based on servos or stepper motors. I also show the difference in controlling gimbal motors that have a decoder and those that do not.
Gimbal motors with a decoder are controlled using the Field Oriented Control (FOC) algorithm. The condensed knowledge presented here is based on many materials from the internet, such as the "Simple Field Oriented Control BLDC driver" for Arduino systems. In future videos, we will show how to use gimbal control to create a self-balancing robot, RC car, precise Pan/Tilt camera control, or creating a voice assistant based on Amazon Alexa, Google Home, or ChatGPT that does not require continuous calling of the keyword "Alexa...", but just looking at it.
Code examples in Pascal and C++ is created for Raspberry Pi 4 in CM4 version. SaraKIT requires 12-24VDC min. 20W when you use motors in your project, you should use a correspondingly larger power supply. For mobile devices, we recommend a simple connection to the PowerBank (PD2.0 PD3.0 Fast Charging and QC4 with USB-C output) with a special PD 12v cable. Or by connecting a USB cable via USB-C Pd Trigger Module Pd 12v.
Some functions of bldc motors from lib/SaraKIT/devices.hpp:
Rotate the motor motorID by angle with speed and torque. the angle can be entered in degrees where 360 is a full turn, or radians where a full turn is 2xPi (2x3.14=6.28):
BLDCMotor_MoveToAngle(uchar motorId, float angle, float speed, uchar torque, bool degrees);
Rotate the motor motorID by angle with speed and torque:
BLDCMotor_MoveToAngle(uchar motorId, float angle, float speed, uchar torque, bool degrees);
Knowing the diameter of the wheel, we can move the vehicle by a certain number of centimeters or meters:
BLDCMotor_DriveMeters(uchar motorId, float centimeters, float speed, uchar torque, float WhellDiameter);
We can also rotate the motor like a DC motor by adding only power (rotation depend on the added torque, the more torque the motor rotates faster):
BLDCMotor_MoveContinuousTorque(uchar motorId, int8_t direction, uchar torque);
We can also rotate the motor at a certain velocity:
BLDCMotor_MoveContinuousVelocity(uchar motorId, int8_t direction, uchar torque, float speed, bool degrees);
If you use motors without an encoder, it is worth making them go into sleep mode after a certain time when you do not move them. Otherwise, they will get very hot unnecessarily. Determine after what time and to what torque they will reach with the function:
BLDCMotor_IdleTorque(uchar motorId, uchar torque, unsigned short torqueMs);
Retrieving the current engine position:
Encoder_Get(EncoderId).angle;
Current velocity:
Encoder_Get(EncoderId).velocity;
or without encoder:
printf("%.2f",BLDCMotor_GetInfo(motorId, 2, false).fdata1);
more lib/SaraKIT/devices.hpp
Sample code for motor control:
SaraKIT is Open Source Project a Raspberry Pi CM4 expansion board that enables advanced voice control and precise motor control. It features three sensitive microphones with sound localization for voice recognition up to 5 m away, two independent BLDC motor controllers providing quiet, fast, and precise control for gimbal motors, a CSI interface with two cameras on a flexible cable, two accelerometers, a gyroscope, and a temperature sensor.
Now available on Crowd Supply
https://www.crowdsupply.com/saraai/sarakit
SaraKIT Home Page:
https://sarakit.saraai.com/
Comments