simplefoc / Arduino-FOC

Arduino FOC for BLDC and Stepper motors - Arduino Based Field Oriented Control Algorithm Library
https://docs.simplefoc.com
MIT License
2.05k stars 530 forks source link

Add option to prevent 100% duty cycle in driver #155

Open runger1101001 opened 2 years ago

runger1101001 commented 2 years ago

Add an option the driver code (3PWMDriver, 6PWMDriver, Stepper?) to prevent 100% duty cycle - some of the more simple driver ICs rely on the high side off-time to charge their HS charge pumps. Depending on the PWM resolution and other factors the current code could set 100% duty cycle. We should add an option "max_duty_cycle" (out of 1.0) or "min_hs_off" (in µs) to account for this?

runger1101001 commented 2 years ago

Recently, someone on the forum was asking about minimum duty cycle - the probable reason being that their slow driver boards were not switching fast enough to support <7% duty cycle. So it might make sense to introduce a min duty cycle as well.