***CONTEST***
Everyone who likes/skull’s will get a free FieldStack, made from hackaday price money. The order of participants will be pulled from hackaday database.
Modular motor control design using STSPIN32G4 integrated MCU/BUCK/FET driver.
The STspin32G4 includes various protection features such as overcurrent protection, undervoltage lockout, and thermal shutdown.
The Field Stack works on NEMA23/34 steppers using 8pwm on the four bridges, but can just as well be used for 3phase BLDCs with SimpleFOC lib.
When combined with SimpleFOC, an open-source library for FOC control on Arduino-compatible boards, the FieldStack offers several advantages. SimpleFOC provides an easy-to-use interface for configuring the driver and implementing true FOC control
Features:
MCU main_clock: 168 Mhz.
CORDIC co-processor for sine and cosine calculation.
All power is derived from VM
Details
Running SimpleFOC with trapezoidal-planner. Max velocity set to 50rad/s, acceleration and de-acceleration set to 25rad/s/s
First test on machine X-axis. Sound level is considerably improved compared to stepper drivers. There is still room for improvement. Feed-forward is not yet implemented and I haven’t tweaked tuning with machine load.
Using 8mm lead-screw with 1:4 gearing, so 4x8mm per rotation (32mm).
You may think it’s total overkill with two PnP nozzles on such large head. That is true. My goal is to make it easy to switch between PnP and CNC. Luckily OpenPNP does not require Klipper to work. It already has some pretty advanced motion features, like 3th order control etc. When up and running with OpenPNP it will be a good playground for Klipper/SimpleFOC integration or possibly make OpenPNP more capable with regard to CNC -> Gcode visuals
I was able setup a secondary (slave) timer on the encoder input. This means we time/track every rising edge on one of the encoder inputs. This can also be every encoder pulse, but we need the larger range to count.
Chat.GPT was so kind to help with the conversion to rad/s.
So what are the real advantages when using FOC (Field Oriented Control)
When using a 16bit timer as a hardware encoder interface, That´s 65536 ticks per revolution. Or if using a 8mm screw -> 8mm / 65536 = 0,000122mm.
Less then a thou mm precision when direct driving it.
To reach e.g. 1400mm/min with a direct drive 8mm, we then need 1400mm/min / 8mm = 175 rpm or 18.32 rad/s.
We could also consider a 2:1 gearing, which will double the speed to 175 x 2 = 350 rpm.
I have started using the CORDIC for the sine/cosine calculations, and it seems fine. Perhaps a bit less vibration. The way S_FOC is using floats does not use the full potential of the CORDIC, unfortunately. It is very precise though.
Love the form factor for this! Ive been wanting a stepper motor driver with an esp32 so the servo system can recieve commands via a "normal" web interface, does this wifi / bluetooth?
Love the form factor for this! Ive been wanting a stepper motor driver with an esp32 so the servo system can recieve commands via a "normal" web interface, does this wifi / bluetooth?