I started testing my controller/motor with a 12V supply and had to reduce the align voltage to 1.5V because it would overshoot with a higher voltage.
Then I changed the PSU to 40V. Changed the driver voltages accordingly. The motor voltage is automatically set to 50% of driver voltage.
The motor didn’t move at all with the align voltage of 1.5V. I had to increase it to 4V.
I wonder why?
Is it common practice to set the align voltage the same way I did with motor voltage (fixed percentage)?
I am not a mosfet expert but I am wondering if a 12v psu is enough to drive those mosfets in a proper way.
It depends on the MOSFet. Some are happy with gate voltages of 3.3v or 5V.
Maybe the RDSon is higher when using 12V, but it’s almost a noLoad scenario, when I test the hub motor.
I don‘t recall the name of the parameter, but one of the (driver?) settings is the battery voltage. if you did not adjust that, it might explain your case.
For sure you need to update the driver. voltage_power_supply
Now I am back home I can try to give a more detailed answer.
It’s an interesting topic and here are the thoughts I had recently, please correct me if I am wrong:
- your driver needs a minimum duty cycle for the motor to even see any current because of the deadtime, this will be proportional to your power supply
- your motor needs a minimum duty cycle to even move, that should be proportional also ?
- your motor needs a minimum voltage to move fast enough for the sensor_alignement, because it’s using fixed delay. This could be a fixed voltage so not proportional ?
So far I always used 2v for a 26v power supply, and I assumed I would make this proportional to the power supply voltage, like Power supply voltage/10.
Good points.
I have set the driver PSU voltage to 36V and driver voltage limit the same.
I wish, I could read the batt voltage and adapt these values while the battery discharges.
A voltage drop while driving means, the FOC sin-curve would be chopped off, so I took conservative values there.
Unfortunately, we can’t change these values, once we called driver.init().
What would happen, if I call driver.init again after I changed driver-related values?
Let’s say I update battery voltage in a sceanario, where target_velocity and shaft_velocity are zero. ( no load voltage)
No you should be able to change the power_supply_voltage anytime.
It’s used here to derive the duty cycle.
As I worked recently on the bus voltage sensing, I thought I could use it to feed the power_supply_voltage but I haven’t tried yet.
This means the speed in voltage mode should be constant if I change the ouput voltage on my power supply.
Ah, yes, I read the cheat sheet doc again and it says: “you normally never change these values”
I guess, it is important for SVPWM, too.
Imagine your motor voltage limit is fixed, while the batt-voltage drops. It would chop off the dent that is needed for currentSense, right?
We won’t know if we don’t try
STM calls this bus voltage compensation.
It seems this can compensate for the voltage ripples.
Does it say, when we should sample bus voltage? It’s confusing enough to place current sensing.
Low side current sensing is tricky because you need to sample at the middle of the ON time of the low side mosfet.
There shouldn’t be any restrictions with bus voltage.
Hey,
You can change the driver.voltage_limit and driver.voltage_power_supply anytime (but not concurrently to loopFOC/move, only in between).
If you change the motor.viltage_limit after calling motor.init() you also have to adjust the motor.PID_velocity.limit if using velocity or angle modes.
You can easily sense the VBUS voltage at startup just by calling analogRead(), I often do this and then set all the parameters based on that value.
Call analogRead 500 times, take the average and you’ll get a good value
Regarding the sensor alignment voltage, this is a kind of kludge because the alignment runs in open-loop mode.
You have to find a value that is low enough to keep currents within acceptable limits, but high enough to actually get the motor moving.
As Candas has pointed out, a too low value means the motor won’t receive enough current (or none at all) and won’t move. For example 1.5V/40V is only 3.75%, if your dead time is set to 4%, then it won’t switch on for very long…
I think, I’d need a pin number and a voltage divider, too? The splitboard has pins to detect when the charger is plugged in or the power button is pressed. But IDK, if these are analog pins, nor what the divider ratio would be.
Yeah, of course you need to pass a pin nr to analogRead, and the result is an integer which you then have to scale accordingly to recover the voltage value.
On the hardware side I use a simple voltage divider as well as a R-C low pass filter and, in an abundance of caution, a TVS diode.
For your hoverboard you can just determine the scaling factor empirically. Run the voltage sense at a few different chosen voltages from your PSU, and measure the value returned by analogRead. With the input voltage and ADC value as known, obtaining the scaling factor is just basic arithmetic