Hello, community.
As a hobby, I am developing a simple BLDC controller for an electric bicycle (motor wheel, direct drive, with Hall sensors) for 650 watts, I have already developed the hardware, ordered, assembled. Now it’s time to write the firmware.
I’m new to this topic, so please tell me how to adapt SimpleFOC to my circuitry?
Thank you.
Looks like it should be effortless, just passing the appropriate pins to BLDCDriver3PWM, HallSensor, and InlineCurrentSense. However I think you made a mistake in the driver wiring. The IN_x pins are connected to the driver PWM inputs, and PWM_x pins are connected to driver enable/disable. Unfortunately D7 and D8 can’t do PWM, so you’ll have to fix it.
Yep. The two active phase’s input pins would be set according to which is driven positive and negative. You would set the “not driven” phase’s PWM duty to 0, so the value of its input pin is irrelevant. The other two could either have equal PWM duty to control the power level, or one set to 100% and the other variable. The result would be the same either way since no current can flow unless at least two phases are on.
That’s a different driver with separate input for each mosfet. It would use the BLDCDriver6PWM class. Yours have a single PWM input, so would use BLDCDriver3PWM if it were wired properly. The end result is more or less the same, just different ways of going about it.
This is what I’m concerned about. You’re PWM’ing the shutdown pin, which disables both mosfets. I think you could implement trapezoidal modulation that way, but you’ll have to write your own code for it because SimpleFOC’s is written for the normal wiring where PWM goes to the input pin which controls which mosfet to activate.
To begin with, I wrote a very primitive code (available in the repository) that simply switches the transistors in the half-bridge one by one.
This code reduces the CPU’s operating frequency from 16 to 8 MHz and thus the PWM frequency of 16.25 kHz, which was my goal.
With PWM, I limit the phase current to 0.7 A.
As a concept, it works, but the motor makes some strange noises(add English subtitles):
I need help from the community to adapt SimpleFOC for my project.
Are there any video tutorials or articles on how to get started, any basic tests or settings?