geofft said:
'New' fw is very smooth, quiet and gentle with the motor. Maybe too much so for some tastes, as the stock fw has higher top speed (about 7.5%) and higher torque (I'd guess about 10%). New firmware draws much less max power however, max watts 630 against 850 for stock, so range should be noticeably increased. I'm left with the feeling, however, that the full capability of the motor is not available with the new fw, and some settings within the code could safely be made a little more aggressive.
Thank you for the feedback, it is really important, since you are not a developer so I think you are not biased.
So original firmware uses more 33% battery energy but gives more ~7.5% speed and ~10% torque.
Can you please tell if you are not hitting the MOTOR_OVER_SPEED_ERPS of 520 ERPs?
I went to look at main, to see if max PWM duty_cycle is defined as max possible, and it is - because could be a bit lower like 245:
#define PWM_DUTY_CYCLE_MAX 254
I have one idea of that more used power, more speed and more torque on original firmware. Do you remember the calcs I did before?
Code:
So, 150 (150 - 127) is 23 is 32 degrees angle, a lot!! I wounder if now your controller have lower temperature while running.
I remember to read that motor max speed (over nominal speed) that we can get with advance angle for field weakening is about 30º. And seems that your motor have the hall sensors placed at that +32 degrees as you did measured on that 2 different processes. See here:

In: http://iopscience.iop.org/article/10.1088/1757-899X/100/1/012004/pdf
So, my suggestion is for you to change the FOC_READ_ID_CURRENT_ANGLE_ADJUST (by increasing or even decreasing his value) and see if you get the same higher speed, torque and current. Well, just if you prefer to have higher speed in exchange of less efficiency. You can search on google for "FOC field weakening" to better understand this.
geofft said:
Idle current draw (stock) is 80-90mA, new fw 130-140mA, no big deal.
New firmware applies resistance to being pushed backwards, stock firmware does not.
I think this is related, because that resistance means that motor coils are always energized while motor is stopped... still, the current on them should be 0 because they have the same voltage applied to them (Voltage battery / 2), slight imperfections on the circuit and/or coils, may result on the very small increase of current.
Anyway, I think would be better to have motor without resistance when pushing backwards.... happens that there is a tecnhical issue to make that, that I could not understand yet on how to do that with this motor controllers hardware: start the motor while it is already running freewheeling.
Added this to issue list, so we don't forget: https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/issues/27
geofft said:
'New' fw PAS feels really nice, maybe a little slow to build from a standing start but once rolling feels very natural and progressive, and doesn't get ahead of your pedalling like the 'stock' fw tends to do.
'New' fw throttle works generally very well, just a small lag when coming back onto throttle after a brake interruption, but not too bad. I'm now wondering if both this and PAS build up might be improved by decreasing the pwm duty cycle ramp up, I'm currently back to using the default 25.
The slow can also be because of current and speed controllers -- I advice you to play with them first. You should increase:
- MOTOR_CURRENT_CONTROLLER_KP
- MOTOR_SPEED_CONTROLLER_KP
Code:
i16_error = ((int16_t) ui16_target_current_10b) - i16_motor_current;
i16_output = i16_error * MOTOR_CURRENT_CONTROLLER_KP;
i16_output = ui8_duty_cycle + i16_output;
You see, the controller output variable (i16_output) is the
ui8_duty_cycle + (i16_error * MOTOR_CURRENT_CONTROLLER_KP). If you increase that constant, the response should be faster but if to fast, you may also feel an oscillation on motor torque.
Also, unlike PAS, throttle have a low pass filter that adds lag/delay (YOU SHOULD PLAY HERE FIRST!) -- see void read_throotle (void). You should know by now how to reduce or increase that lag/delay, by changing that ui16_throttle_value_accumulated >> 2.
geofft said:
Quite a bit of heat is also generated by the LM317 voltage regulators. Probably not a problem at 24v or 36v, but inputting 48v it has to lose a lot of power to get down to 15v and gets very hot in the process, reaching around 90degC. I guess they're designed to run this way but I wonder about their long term reliability at these temperatures. I've fitted them with heatsinks, though I'm not sure how effective they will be inside an enclosed case. Been looking around for possible switch mode replacements for these but space is limited for this, no luck so far.
Well, for me, the most heat comes from that power resistor, where I think the most voltage/power drop happens:
https://opensourceebikefirmware.bitbucket.io/development/Motor_controllers--BMSBattery_S_series--Hardware_mods.html#h1-2