Posts

Showing posts with the label PMSM Controller

AS5048A Magnetic Encoder and STM32

Image
This past week I began to write the controller firmware - mainly playing with the AS5048A angular position sensor from AMS. Here is the datasheet .  This sensor will be used to get the rotor position and then compute the resulting electrical angle for the Clarke/Park transforms and also it will be used to find rotor speed for the out loop.  I will be using an STM32F446 board to run the loop as it has a high clock speed. The AS5048A sends its measurements over SPI. Below is the read package sent from the sensor: We get 14 bits of position data - aka 16384 ticks per revolution, or a resolution of 0.0219 degrees. I wrote this read() function that sends the SPI command package and reads the resulting response: uint16_t read(uint16_t registerAddress) { uint16_t command = 0x4000; // PAR=0 R/W=R uint8_t RxBuff[2]; uint8_t TxBuff[2]; command = command | registerAddress; command |= (uint16_t) (spiCalcEvenParity(command) << 0xF); TxBuff[0] = command >> 8; TxBuf...

First Post on a AC Servo Drive Project + Current Loop Simulation

Image
Introduction Over the past year I have been working on a motor driver for an AC hobby motor (total time about a month due to school and work) - I decided to document my past developments and continue the project as I am less busy. I looked back and refined what I wanted out of this motor drive. Requirements Have precise control of position, speed, and torque of an AC motor No torque ripple in output Controller should be suitable for a wide range of PMSM motors Goals Small PCB footprint (~50 mm squared) Develop software to tune controller profiles and gains Constraints Design drive for permanent magnet synchronous machines (PMSM) with surface mounted magnets (non-salient motor) Use field oriented control (FOC) to modulate phase currents End board should be <$100 CAD To clarify, these PMSMs are hobby grade motors used for drones/UAVs, however the goal is to make it work with any sinusoidally wound brushless motor.