Deadtime 6pwm - hacking 10$ 36v/500w bldc controller to run simplefoc

I think the problem is, that there is no braking chopper. The motor controller is pushing back energy to the DC bus while braking. If you use a battery it is charged with this energy. If you use a PSU without braking chopper the voltage will rise very high and damage it.
You could check if it only happens while braking and if there is a voltage rise just before the PSU shuts down.

@Uli thanks for pointing this out. I’ll definitely have to think of something for breaking.

@Antun_Skuric I was wondering about BluePill and driving two motors with one. I never looked at it until now, so I’m quite clueless. From what I could understand, it has only one advanced timer that can output 3 complementary pwms. That would drive one motor ih hardware pwm mode, and the other one would have to work in software pwm mode.

Did I understand that part correctly, and do you know if there are any performance difference between the modes?

Yes, there is only one timer that supports inverted channels. But this is not just the case for Bluepill but for most of the stm boards.
That’s why there is the software configured one.

The benefit is that you can drive more motors.
The problems are:

  • you need at least two timers for one motors
  • the timers are not perfectly synchronized (not too far, but not 100%, the timers are started at the same time)
    • this will not cause any problems in terms of foc because the low/high pairs are in perfect sync
    • the problem can come in current sensing when you need very high degree of sync with the adc

So in your case, there isn’t too many drawbacks in terms of performance.

stm32f405/7 have two timers that support inverted. TIM1 and TIM8. I don’t think they have any nano sized boards but they do a discovery stm32f407. I expect most of the mid/top end stm32 chips have 2 timers that support CHxN

There’s a feather board with the STM32F405…

Hi,

I had some hobby time to continue playing around, and I’m sharing some pics and a video of the velocity mode working (good enough for my application) - still on low voltage until I assemble the battery (will probably go for 6s).
I had to set dead zone to 0.1 to eliminate mosfet heating, which is probably due to cheap crappy mosfets

I will be taking 5v from the controller to power the bluepill (it’s currently powered from USB) - two pins that anchor the connector to the controller are 5v and gnd. Hall sensors are powered from BP 3.3v pin.

2 BluePills will be connected to I2C bus to be managed and instructed by an Arduino Mega probably on 5v (I dod a quick test and it seems to work fine on 5v - I’d appreciate if anyone has suggestions, pros/cons in using I2C on bluepill at 5V).

I have a question:

  • is the hall sensor pinout/sequence important?
    I swapped the pins, and the init part when the motor turn a bit seems to be different, and the zero electrical angle varied from 1 to 4, but the motor seemed to behave as expected no matter the pin arrangement of hall sensors - it looks to me as if simplefoc is smart enough to rearrange them in the correct order after the init

Thanks
Aleksandar

1 Like

@Aleksandar_Markovic Any more progress on your project?

1 Like

Could you help me with what I’m doing wrong? I did the same thing as you, but when using the 6pwm code, I see that the high and low are working simultaneously and the motor does not work.