SimpleFOC-PowerShield

I found the release version of PowerShield:

Could I know more details about the board? I mean, more example codes will be helpful.

Wow,
It’s exactly what I’m looking for.
@Antun_Skuric: Will this shield be able to handle the low resistance motors, as well? I’m currently struggling with the simple foc shield V2 to drive a 0.7 ohm motor. I can’t get him run smooth. But with more current this might work.

Hey Guys,
Yes I am excited about this baord! It has been completely inspired by the infineons board.

It is designed to support the middle range BLDC motors up to 500W. I am still a bit in the testing phase, namely to determine which kind of current sensing we will be able to use with it and what is the actual current it will be able to withstand. :smiley:

Features for now

  • Plug & play: In combination with Arduino SimpleFOClibrary - github
  • Low-cost: Current price of fabrication is less then 20€
  • High-side current sensing: - not yet supported by SimpleFOClibrary
  • Max power >500W: max current 30A, power-supply 24V
  • Arduino headers: Arduino UNO, Arduino MEGA, STM32 Nucleo boards, Aruidno DUE…
  • Small size: 55mm x 55mm
  • Open Source: Fully available fabrication files

Future features

  • Stackable: running 2 motors in the same time
  • Encoder/Hall sensors interface: Integrated 3.3kΩ pullups (configurable)
  • I2C interface: Integrated 4.7kΩ pullups (configurable)
  • Configurable pinout: Hardware configuration - soldering connections

How to use it

This board has enable pins for each of the phases for now and it has completely static pinout.

name description pin
IN1 pwm 1 9
IN2 pwm 2 6
IN3 pwm 3 5
INH1 enable 1 8
INH2 enable 2 7
INH3 enable 3 4

The simplefoc library v2.0.x does not support the BLDC drivers with 3 enable pins.

simplefoc library v2.1

But if you download the dev version which will be released very soon it does so you can just do:

// Open loop motor control example
#include <SimpleFOC.h>

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(11);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8, 7, 4);

//target variable
float target_velocity = 0;

// instantiate the commander
Commander command = Commander(Serial);
void doTarget(char* cmd) { command.variable(&target_velocity, cmd); }
void doLimit(char* cmd) { command.variable(&driver.voltage_limit, cmd); motor.voltage_limit=driver.voltage_limit/2;}

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  driver.voltage_limit = 1;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // limiting motor movements
  motor.voltage_limit = 0.5;   // [V]
  motor.velocity_limit = 5; // [rad/s] cca 50rpm
 
  // open loop control config
  motor.controller = MotionControlType::velocity_openloop;

  // init motor hardware
  motor.init();

  // add target command T
  command.add('T', doTarget, "target velocity");
  command.add('L', doLimit, "voltage limit");

  Serial.begin(115200);
  Serial.println("Motor ready!");
  Serial.println("Set target velocity [rad/s]");
  _delay(1000);
}

void loop() {

  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit
  motor.move(target_velocity);

  // user communication
  command.run();
}

Thie example uses some of the new features of the simplefoc v2.1, for example Commander interface.
In this example you can set/get target velocity with commad T. For example to get target velocity just send T and to set for example 2.5 rad/s send T2.5.
The same can be done for the voltage limit, with command L.

simplefoc library v2.0.x

For the version of the library v2.0.x you can enable additional pins by hand, here is an example:

// Open loop motor control example
#include <SimpleFOC.h>

// BLDC motor & driver instance
// BLDCMotor motor = BLDCMotor(pole pair number);
BLDCMotor motor = BLDCMotor(11);
// BLDCDriver3PWM driver = BLDCDriver3PWM(pwmA, pwmB, pwmC, Enable(optional));
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6);

void setup() {

  // driver config
  // power supply voltage [V]
  driver.voltage_power_supply = 12;
  driver.init();
  // link the motor and the driver
  motor.linkDriver(&driver);

  // enbale pins set to high
  pinMode(8,OUTPUT); // inh1
  pinMode(7,OUTPUT); // inh2
  pinMode(4,OUTPUT); // inh3
  digitalWrite(7,HIGH);
  digitalWrite(4,HIGH);
  digitalWrite(8,HIGH);

  // limiting motor movements
  motor.voltage_limit = 1;   // [V]
  motor.velocity_limit = 5; // [rad/s]

  // open loop control config
  motor.controller = ControlType::velocity_openloop;

  // init motor hardware
  motor.init();

  Serial.begin(115200);
  Serial.println("Motor ready!");
  _delay(1000);
}

float target_velocity = 0; // [rad/s]

void loop() {
  // open loop velocity movement
  // using motor.voltage_limit and motor.velocity_limit
  motor.move(target_velocity);

  // receive the used commands from serial
  serialReceiveUserCommand();
}

// utility function enabling serial communication with the user to set the target values
// this function can be implemented in serialEvent function as well
void serialReceiveUserCommand() {

  // a string to hold incoming data
  static String received_chars;

  while (Serial.available()) {
    // get the new byte:
    char inChar = (char)Serial.read();
    // add it to the string buffer:
    received_chars += inChar;
    // end of user input
    if (inChar == '\n') {

      // change the motor target
      target_velocity = received_chars.toFloat();
      Serial.print("Target velocity ");
      Serial.println(target_velocity);

      // reset the command buffer
      received_chars = "";
    }
  }
}
1 Like

Hi, I’m starting with a board using IFX007T’s.
I tried the v2.1 example code, and it works.

Can I ask why you didn’t use the output capacitors? Is it to reduce power consumption?

(close your eyes when looking at my hand soldering)

4 Likes

Very nice, you have a great looking board!

I’ve not used them mostly to avoid unnecessary components at this early stage, since the power lines are pretty short I decided to avoid them at this point. For the kind of use cases this shield is intended for I am not sure that they make too much difference. If you expect to be running higher currents I would definitely suggest you to follow the datasheet and put them.
I am really not an expert though :smiley:

Did you manage to test the board in closed loop mode, does it work as well as it looks? :slight_smile:

Thanks!

No I haven’t tested closed loop yet - I’ve tested that the encoder (MA702) works, and CAN works (both tested with ESP-IDF), but I don’t have a physical assembly to hold everything together yet…

@Jason_Kirsons Nice design.

Thank you for sharing.

@Antun_Skuric can I just connect PIN INH1/INH2/INH3 to high voltage point(3.3v)to save my GPIO pin, on this board(Arduino-SimpleFOC-PowerShield)?
Thank you for answering

Yes sure. I’d suggest you to connect them all to one pin to be able to disable the driver.

@Antun_Skuric thank you very much!

Hi @Antun_Skuric,
What is the corresponding between the phase current and the IS output of this component IFX007 or BTN for current reading ?

Hey @Marc_O,

A priori these drivers have implemented high-side sensing. And that would mean that you can sample their IS current as the low-side sensing but on the opposite side of the PWM cycle (when all the PWM signals are high - or when the high-side mosfets are up).

This is the good news. But the bad news is that from the tests that I was able to do it seems that the IS is an absolute value of the current. Or better said, it might be that it doesn’t have the current sign information which would make it unusable for FOC.
I’ve done another version of the shield with In-line sensing, it has arrived today so I’ll let you guys know if this makes sense as an option. But I am pretty optimistic :smiley:

3 Likes

that’s good news! I still could not find an affordable solution for bipolar stepper driver plus in-line current sensing.
By the way: How would SimpleFOC limit the amount of current through a low-resistance stepper ? I have seen in an Trinamic eval board schematic TMC-UPS-10A70V-EVAL,
that they do extra current sensing for the sum of all currents. That goes to an extra P-control loop for the overall current in their TMC4671 FOC chip.
Does SimpleFOC limit somehow the current based on the sum of phase currents ? I have some problems in understanding what’s the equivalent of voltage/current control you see in stepper controllers to FOC principles.

one more thing… You rate the board for max.24V. BTN8982TA is good for 40V. What would be needed to make the board work at 40V ? Is it just the CAP (25V)?

Hey guys,

The board works pretty well really. I am very happy!
Even though it has the shunt resistor of 1mOhm it still can do the true FOC for gimbal motors well.
I’ll try to make it stackable soon and release first real version.
new

Simplefoc library implements the current limiting in the motion control loops you can find the schemes in the docs.
We are not summing the phase currents but calculating the current vector using park and clarke transformations. We do not limit the cumulative phase current (or a sum) but the real current vector. It is the standard approach for FOC control. There is no real difference in between FOC for stepper and BLDC motor. The only difference is how you calculate the current vector (using 3 or 2 phases).
At this moment we only implemented the true FOC support for bldc motors but that will change with the next release.

Yep, the smd caps are a bit hard to find, especially for these huge values. The advised value is 1000uF . But you can easily get around this by using a through hole cap.

2 Likes