Close
0%
0%

Field-Oriented-Control Stepper driver

Using the SimpleFOC Arduino librery we wish to drive a NEMA23 stepper using Field Oriented Control and possibly interface to Klipper HOST

Public Chat
Similar projects worth following
Many are familiar with the classic stepper drivers we use in most 3D printers. For CNC purposes though, where you want highest possible precision and torque using NEMA23 steppers @48 voltage, a closed loop system can achieve best performance. The high voltage is needed if we want to move a CNC machine with relatively high speeds 1400mm/min, if the drivetrain is geared towards 2mm per revolution. 2mm per revolution equates to a precision of 16microsteps * 200 / 2 = 1600, 1 / 1600 = 0.000625 mm, under normal circumstances. Driving a stepper using FOC is dependent on the angle sensor precision and since it is closed loop control, we know for sure if there is misalignment.

For more info on FOC algorithm
https://docs.simplefoc.com/

The MCU intended for testing is the SAME51 120Mhz MCU with FPU (Floating Point Unit). If powered and cooled optimally it can be overclocked to 200MHz. (Mind you that the MCU is modular, and could potentially have a higher clock). The SAME51 has a CAN FD interface.

The ADC does 1 million samples per secund, which is great for the currents sensors (MAX40056), since they have a 300 kHz bandwidth. 

Let's extrapolate those numbers;

If our NEMA23 drivetrain moves the machine 2mm per rotation, in order to move 1400mm/min we would need to rotate the shaft 700 rpm.

700 rpm is 11.667 rotations per sec. 

With a 300 kHz bandwidth, the MCU then has 25.71 kHz samples available per rotation, that is 71 samples per degree (when moving @1400mm/sek) or per 0.0055mm movement. 

If we use the 200 steps or cogging-steps of the motor, we then get 128.5 current_samples per step. 

Regarding MCU clock;

With a 120Mhz frequency we can calculate the Clock-cycle´s available.

120.000.000 / 11.667 rps / 200steps = 51.427 clock cycles per electrical revolution  @1400mm/min

PWM Frequency VS PWM resolution

When setting the PWM frequency, the clock used is the main MCU clock, in this case 120MHz. Each PWM cycle counts the clock ticks up to set PWM resolution. If dual slope counting is used, the counter count from 0 to max and back to 0. 

To set a 50 kHz PWM frequency with a 120MHz clock (120.000.000 per secund) one will have a resolution of 2400 clock ticks per PWM cycle. 

Having a 50kHz PWM frequency will make the MOSFET fire 6 times slower than available ADC samples. So 50kHz / 11.667 rps / 200steps = 21,43 PWM cycles per electrical revolution @1400mm/sek. 

This means we can oversample to 14bit analog resolution current samples.  

View all 10 project logs

Enjoy this project?

Share

Discussions

Kieth wrote 12/28/2022 at 12:07 point

Awesome work! Looking forward to seeing how this progresses. I have been torn between closed loop stepper drivers at 24v and 48v standalone drivers for my nema 23 steppers. A combination of the two would be great.

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates