Simple standalone driver test failed


I thought it will be a simple test, but nothing works.

I want to test the simplefoc mini driver with an uno and a bldc motor. All of the components worked before in a simplefoc setup, but now I need to test another motor. Before connecting the new motor I want to be sure, everything is workin in the setup.

So I made a test with just a simplefoc mini, a standalone driver test, but not working.

Here is the code from the simplefoc website:

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

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

  // driver init

  // enable driver


void loop() {
    // setting pwm (A: 3V, B: 1V, C: 5V)

The board is powered by 12V.
All the pins are correct.

What could be the problem?

What does it do? nothing? I’ve never tried setting the PWM directly like that before. That doesn’t seem like the best test. Usually you just try open loop mode. That tests a lot of stuff all at once.

Does nothing, not even preload the motor. I try open loop test as well, but with similar results. I have a working closed loop system with a SAMD21 board, but the open loop and all the tests are worked wery well there. I wonder, the code is not functioning from the website?

Can you set PWM frequency for an UNO to 20kHz?
AFAIK, there are only two frequencies supported. ( IIRC 4k and 32k, but I’ll check again)


Please add a delay(1); or similar to the main loop… the MCU may not like receiving PWM updates in a tight loop.

Other than this the code actually looks ok.

@Anthony_Douglas this kind of test just sets a PWM to the pins so you can check the driver is working as expected, for example using a logic analyser or oscilloscope to look at the output of the PWM pins.