📢 SimpleFOClibrary release v2.1

Hey guys,

We have been working hard for the last couple of months to finally we have the new library release, SimpleFOClibrary v2.1.

The biggest news in this release are:

  1. Initial current control and torque control support :tada: - see in docs
    • For now implemented only in-line current sensing
    • Three types of torque control: voltage, DC current and FOC current - see in docs
  2. Simplified Sensor class
    • to implement the new sensor you only need to implement one function getAngle - see in docs
  3. Rewritten motor commands interface see in docs
    • New Commander class
    • Much more flexible
    • Much easier to adapt, configure and extend
  4. Rewritten motor.initFOC() function see in docs
    • align sensor: direction + zero offset + pole pair check
    • align current sense
    • can be skipped entirely or parts of it
    • outputs much more info
    • disables the motor if it fails
  5. Added support for mucs: see in docs
    • Aruidno DUE
    • Atmega328pb
    • SAMD21 boards by @runger

For the full list of the new features check out the release page



:partying_face: SimpleFOClibrary v2.1 :partying_face:

Awesome update! I can’t wait to test it out! Thanks for all the hard work! :confetti_ball:

I’ve been reading the docs - really good stuff!

So is it possible to doing sensorless foc with 2 shunt now?

Really awesome! can’t wait to test my motors with real FOC!

Hey guys, I’m happy you like it!
@hbozyq, no sensorless yet.
You have all you need to implment it though, but it is not supported off-the-shelf in the SimpleFOClibrary :smiley:

Hello, may I ask when the next update will be? Can low-end current detection be supported in the next update?

What driver are you using? I know there are a few people working on low-side at the moment.

Thanks for your reply, I am using DRV8302 now

I’m using vesc boards which are drv8302 based. I suspect we’ll see someone trying low side on a similar driver in the next few months. @David_Gonzalez, are your dagor boards low side? Is there any low side code say on a forked repo?

You will find here what you are looking for : VESC Support - 1kW of Power!

@Marc_O, oops yes! I still haven’t looked at this properly! How hard do you thing it would be to integrate it using same extension points of inline current sensing that @Antun_Skuric added in simplefoc 2.1 ?

Yup, low-side with the DRV8305. I do have a very rough implementation of low-side sensing with the ESP32 here: Dagor-Brushless-Controller/Firmware at dev (github.com).

If you use this version of SimpleFOC beware that the angle control loop is different than what’s implemented in the library.

Hi @Owen_Williams,
In fact, I think we have no choice to synchronize the current reading for the low side shunt.
As you know, it is therefore specific to each microcontroller that you use. So, I think @Antun_Skuric will have to create a folder “current drivers” like he did for the specific PWM drivers, and specific at each microcontroller (So, a lot of work to do :slight_smile: )
Here for the STM32, the idea that I used finally is to use TIM2 to synchronize instead of the TIM8 that can be using for another motor control way in the same time, and that perfectly works as I have shown in your link : “VESC Support - 1kW of Power!”, because I got 9000rpm with a 600W motor with my electronic board.

@Marc_O - the hardware specific current directory has been added in 2.1 and is ready for new current implementations!
You are right, this area could end up being very implementation specific!

Hey guys,

Yep the hardware specific folder will take in consideration all the mcu specific code. At this point the implementation is very simple. But it is going to become more complicated.
The general architecture is in place, we have the CurrentSense class that needs to be extended to implement the current sensing class. I’ve implemented the inline for now in the InlineCurrentSense class. But the idea here is to have LowsideCurrentSense.and maybe HighsideCurrentSense implelentation as well here. At this point we are not actively working on it, as for the last few weeks we did not have too much simplefoc free time :smiley:
But the low-side current sensing is the no.1 next feature of the SimpleFOClibrary right above making the SimpleFOCStudio work with v2.1. :smiley:

low-side current sensing is MUCH cheaper.
A 4ch general opamp within half a buck is enough for 3 phases.
And ina240 is 3 buck per chip.
I will make a ALL-IN-ONE driver board once it is releasted.