jbalat wrote: ↑
Oct 25 2018 5:53pm
casainho wrote: ↑
Oct 25 2018 4:26am
Help to debug lag issue
See about this issue here: https://github.com/OpenSource-EBike-fir ... e/issues/9
For the ones that are interested in helping solve this issue, please help by looking at the following values on LCD3:
9: Advanced technical data
submenu number configuration name description
3 Pedal torque sensor
4 Pedal cadence
5 Pedal human power
6 PWM duty cycle
The idea is to see how that values changes when the issue happen, like stop pedaling and then pedal again and look at that values. How do they change when the issue happen?
Ok so i stopped and started many times on my way in to work today. Due to display historesis I am unable to give you EXACT data but this was my perception.
Even after you stop pedalling the cadence drop slowly to zero, not immediately, if you peddle before it gets too low then there is no lag, if you wait too long or let it get to zero then lag exists.
Taking off from zero has less lag than when you start pedalling again while rolling
All the stats like torque sensor, cadence, human power, pwm and even ERPS motor speed all appear to work as they should however it appears you dont get any boost until ERPS is about 200.
When taking off from rest the ERPS 200 is achieved quicker ?
Perhaps when energising the motor we just add 200 offset ?
This brings me to my next idea.
Can we use a minimum ERPS to prevent backlash in the gears and reduce noise. The issue is to try and calculate the minimum ERPS based on your cadence so as to make sure gears are always tight but not too much to overheat the motor ore make the bike move. Of course when the wheel speed is zero then this should be turned off
I got the same feeling as you on my tests.
First, looking at firmware I don´t see a reason for a delay (except the one I will mention). On hardware, there is a delay for the torque sensor signal, that seems to be low pass filtered quite a bit (compared to other torque sensor I worked with) - this delays happen when increasing or decreasing (when start pedaling AND when stop pedaling).
1. I also feel that when I start from 0 motor speed/wheel speed/ebike stopped, I feel the torque without delay BUT when the ebike is moving already, specially at higher speeds, and I did previous stop to pedal (electric motor stopped --> PWM duty-cycle = 0) and start pedaling again, I feel a delay to have motor torque!
What I think is happening is that motor takes time (delay) to increase from 0 speed to final speed that will equal to the rider actual cadence/wheel speed. The higher the ebike speed on 1., the longer the time (delay) the electric motor will take to achieve the final speed.
Can we increase the motor speed acceleration to try reduce that delay?
I think so, but I would go with care having the risk to burn the motor controller if not worst. On motor controller firmware, file config.h, we have this defines:
Code: Select all
// *************************************************************************** //
// MOTOR CONTROLLER
// Choose PWM ramp up/down step (higher value will make the motor acceleration slower)
// For a 24V battery, 25 for ramp up seems ok. For an higher voltage battery, this values should be higher
#define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 75
#define PWM_DUTY_CYCLE_RAMP_DOWN_INVERSE_STEP 25
What they mean? mean that wen we set motor_set_pwm_duty_cycle_target ()
our target duty-cycle, the real value duty-cycle
will increase with a ramp at steps of that defines, where each steps takes the time of 64 micro seconds. A step value of 75 means 75*64us = 4.8 mili seconds. Let´s say the ebike speed/pedal cadence is a at a speed that duty-cycle should ram up to 200 for the motor to make torque. The ramp time is: 200 * 4.8ms = 0.96 seconds.
The brave ones can try to reduce the value of #define PWM_DUTY_CYCLE_RAMP_UP_INVERSE_STEP 75
but be warned that faster motor acceleration/faster motor energy increase/faster motor torque increase may be harder for the system (motor controller, gears, battery, etc) and we don´t know what can go wrong!!