Lishui "Open Source Firmware" project / KingMeter 5S

Thank you.
There is nothing on the LIN input of the driver for this phase.
Let's look at the outputs pins of the STM32.
 
There is PWM on all 6 contacts of STM32.
The problem is in the 33 ohm resistor at the LIN input of the FD2103S driver.

Now I realize that I could have discovered this myself.

Thanks for your patience and clarification. I'm starting to get an idea of how to work with this.
 
Last edited:
There was a crack in the resistor. The most annoying thing is that I inspected the board for damage, but the resistor was almost intact on the outside. Most likely, I damaged it when I was picking out the silicone. It’s also a shame that I immediately became suspicious:
Does this look like a hardware problem?


For example, that one phase of the motor does not work?
But when the motor is connected, the only thing that showed a faulty phase was sometimes a not clear trailing edge of the PWM pulses output. In short, if it seems so, then look at the driver inputs and outputs with an oscilloscope.

Is the motor running now?
Yes, it spins and tunes itself. But I won't disappear anywhere, don't hope.:)
I'll assemble the bike and try to set it up. At first glance, the motor spins very smoothly and softly.
Thanks again. What can I do for you or the project?
 
Can I ask a stupid question? How should the engine temperature sensor be connected? One pin to ground and the other is the signal? I saw that a 10 kilo ohm pull-up resistor is needed. I measured 5 kilo ohms to ground. I need to find and replace this resistor. Is the 10 kilo ohm B3950 sensor suitable?
 
I measured 5 kilo ohms to ground. I need to find and replace this resistor. Is the 10 kilo ohm B3950 sensor suitable
You have to measure to +3.3 V, as it is a pullup, not a pulldown.
You don't need to resolder the pullup, just set the right value in the main.h
 
Last edited:
Thank you. These are distortions of automatic translation. Only now I understood what the meaning is.
 
Last edited:
Available in Switzerland.

I need to write to Phoebe Liu. I ordered my controller and torque sensor kit from his link via Alibaba.
 
I rode a bit and tried to tune the 12FET.

It seems to me that the algorithm for converting torque and pedal revolutions into engine power does not correspond to the characteristics of the human-bike system. This is especially evident at near-zero pedal revolutions.

1. In order for the assistant to engage after starting off, you need to make about one revolution of the pedals. The formula should include a sum member proportional to the torque and inversely proportional to the pedal revolutions plus a shift in revolutions. W=K*N*P + K1*(P-a)/(N-b)

W - engine power

K K1 - coefficients

N - pedal rotation frequency

P - torque on pedals

a - moment displacement

b - rotational displacement

Perhaps the dependencies should not be linear, but, for example, logarithmic.

Human sensors and sensations have a logarithmic scale.

And how is the motor control algorithm structured depending on the torque and cadence in your firmware?
 
This is especially evident at near-zero pedal revolutions
Torque and cadence are filtered heavily, so there is a delay in the response, especially at low cadence.
The torque is read and pushed into the filter at each PAS pulse. The cadence is represented by the time (timertics) between two PAS pulses and is filtered in the same logic but with a lower shift factor.

You can reduce the shift factors to make the system more responsive, but you have to change the shiftfactors in the accumulation and in the calculation of the filtered value. The shift operations are little spread in the code, I was not consequent in shifting the accumulated values to the filtered values (PAS in line 652, torque directly in the calculation of the iq setpoint in line 761)

In line 761 the magic happens :) The iq setpoint is calculated. With the known bug, that the division by the wheel speed is missing.
See this thread:


Of course you can use any formula to calculate the iq setpoint from the sensor data, feel free ;)
 
Last edited:
Is this the wheel speed from the external speed sensor or the motor speed?
You can choose INTERNAL (motor halls are used to calculate the wheel speed) or EXTERNAL (pulses from an external sensor on the white wire) in the config.h
If you are using a geared motor with a freewheel, you should use external to get the speed showed in the display, if you are coasting or above the speed limit, where the motor doesn't turn.

For the motor power calculation, there is no difference.
 
Last edited:
For the motor power calculation, there is no difference.
There is a difference. To get speed data with an external speed sensor, you need to make at least one wheel revolution. When starting from a standstill and uphill, for example, this is a lot. It seems to me that the formula should have a member that converts the torque on the pedals into the motor current with a stationary wheel, and the weight of this member should fall with revolutions. I will try to understand your code. If you are not too lazy, describe in more detail where and how all this is filtered and calculated.
 
. It seems to me that the formula should have a member that converts the torque on the pedals into the motor current with a stationary wheel, and the weight of this member should fall with revolutions
For this, you can misuse the function "throttle override". The torque signal is mapped to the iq setpoint directly, just like the throttle signal.

You just have to read from the ADC array element with the torque value and set the torque offset and torque max constants in the map function.
But this has the risk of burning your motor and/or controller, if the motor is blocked and the torquesensor gives a signal permanently, because the pedal is blocked under load in a parking situation. There is a safety timeout, that switches off the PWM, if the motor is powered and no rotation is detected, but the motor will try to start permanatly in that situation.

Of course for the motor power calculation, you can use the speed from the hall sensors always, as you don't need the speed information at standstill.... This would be much faster than the external speed sensor, as you get much more pulses per wheel Revolution.
 
Last edited:
Back
Top