Close
0%
0%

The Field Stack - NEMA23/34 FOC

If we win the Hackaday price, we will make BETA give aways. FOC field-oriented control for NEMA23/34

Similar projects worth following
***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

Running SimpleFOC with trapezoidal-planner. Max velocity set to 50rad/s, acceleration and de-acceleration set to 25rad/s/s



  • First test on machine

    Juan-Antonio Søren E.P.05/08/2023 at 13:07 0 comments

    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 

  • Velocity Timer

    Juan-Antonio Søren E.P.04/20/2023 at 07:57 0 comments

    float speed = (4 * pi / 65536) * 168000000 / ((float)timer2 - 1.0f);
     

    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.

    TIMER2 CCR1 - >  1585
    Rad/s - >  20.34
    TIMER2 CCR1 - >  1560
    Rad/s - >  20.66
    TIMER2 CCR1 - >  1621
    Rad/s - >  19.88
    TIMER2 CCR1 - >  1728
    Rad/s - >  18.65
    TIMER2 CCR1 - >  1611
    Rad/s - >  20.01
    TIMER2 CCR1 - >  1575
    Rad/s - >  20.47
    TIMER2 CCR1 - >  1550
    Rad/s - >  20.80
    TIMER2 CCR1 - >  1662

    This is the output with a 20 rad/s target using the conversion above:

  • Klipper integration

    Juan-Antonio Søren E.P.04/19/2023 at 18:59 0 comments

    Hi,

    We are looking for BETA testers who would like to help out with SimpleFOC -> Klipper integration.

    See further here: Feature request: add klipper MCU input mode - developement - SimpleFOC Community

    And here : Klipper Discord

    Best regards


    JASEP


  • TMC2660 sound-test on AZTEEG G5

    Juan-Antonio Søren E.P.04/18/2023 at 13:26 0 comments

  • Using STM CORDIC w. SFOC.

    Juan-Antonio Søren E.P.04/18/2023 at 13:15 1 comment

    Im starting to think it would be cool to see a direct drive confiq.

    This is using the CORDIC for sine and cosine calculations.

  • STEP vs. FOC

    Juan-Antonio Søren E.P.04/18/2023 at 02:33 0 comments

    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. 

  • 100 rad/s - > 954 rpm NEMA23 FOC

    Juan-Antonio Søren E.P.04/15/2023 at 22:08 0 comments

  • Closed Loop NEMA23

    Juan-Antonio Søren E.P.04/15/2023 at 16:56 0 comments

    Still tuning, but this is the speed I'm getting right now. Or the highest I dare at the moment. I put a 50rad/s limit .

  • PANEL 1*

    Juan-Antonio Søren E.P.04/15/2023 at 02:15 0 comments

  • ITS ON!

    Juan-Antonio Søren E.P.04/15/2023 at 02:14 0 comments

View all 13 project logs

View all instructions

Enjoy this project?

Share

Discussions

Brett Smith wrote 10/22/2023 at 21:03 point

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?

  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