Start-up and first wheel turns, help please

Hello everybody !

I have been working on the SimpleFOC library for several months without any results :sleepy: So I ask for your help :sweat_smile:

I use an electric scooter (24V) motor with integrated hall sensors. Before using the SimpleFoc library and the PowerShield, I was using an Amazon board like this one :

image

I also have an IFX007T board (if you have a code for this one :wink: )

But I needed something more reliable. So I looked for what might be the best for me and thought this librairie would be the best. I tried a lot of things but nothing worked so I’m going back to basics. And I am going back to the beginning with you.

I tested this code on my board and it did not give me the voltages indicated in the code.

#include <SimpleFOC.h>
// BLDC driver instance
BLDCDriver3PWM driver = BLDCDriver3PWM(9, 5, 6, 8);

void setup() {
  // pwm frequency to be used [Hz]
  driver.pwm_frequency = 50000;
  // power supply voltage [V]
  driver.voltage_power_supply = 24;
  // Max DC voltage allowed - default voltage_power_supply
  //driver.voltage_limit = 12;

  // driver init
  driver.init();

  // enable driver
  driver.enable();

  _delay(1000);
}

void loop() {
    // setting pwm (A: 3V, B: 1V, C: 5V)
    driver.setPwm(3,1,5);
}

I removed the voltage limit because I wasn’t sure if it was useful. But even with it does not work. Are the output pins not good ? I am using a 24V battery. The output of the BTN is wrong. For all (3,1,5) the output is 1.78V (mesured with my multimeter). So I have several questions:

  • Is frequency the problem ?
  • Do I have to put a voltage limit ?
  • Do I have to change BLDCDriver3PWM ?

I will also take this opportunity to ask you questions for the next goal. I’m just trying to run my engine via the code (for the moment). A line like this for example: motor.target (10). But I didn’t succed. Do you have a basic code for a BLDC motor and 3 hall sensors in software interupt ?

Any help would be welcome, thank you in advance :slight_smile: