Lishui "Open Source Firmware" project / KingMeter 5S

Does anyone know the Xiaomi torque sensor on rear dropout? I bought one and cannot make it work. Powered with 5V does give constant output voltage despite different load.. Should the wires colours be mixed perhaps?
View attachment 333644 View attachment 333645
Looks similar to TMM4 :unsure: there is adjustment screw on the sensor shell but it does not give any difference in read outs.
if you pry gently on the left side of the sensor where the screw is touching the plate, you should see the signal from the sensor change. from whatever the zero is towards 5v. I wouldn’t adjust that screw too much since it’s factory set for zero torque. My problem is that I can’t find a replacement plate and sensor for my Stromer
 

Attachments

  • IMG_0158.jpeg
    IMG_0158.jpeg
    1.2 MB · Views: 6
I got the controller and got the PCB out. Hammering on the metal chunk in the middle worked well to get it out without risking cracking any parts by digging through the potting compound.

Am I correct that the only thing I need to do to support throttle and torque PAS (ERider(?) T17) is wire up the throttle to SP and flash a build with "Throttle Override"?

Is the SP solder point 5V compatible or do I need to scale it down to 3.3V?
Which display comes with the controller from Aliexpress? KM5S?

The wiki doesn't cover flashing the controller through the display connector. Is the process for that simply generating an image with the "Lishui Parameter Configurator" then flashing that image with the Lishui firmware updater?
 
Last edited:
I finally got another chance to sit down and work on this controller. I'm trying to program it with the OEM "Lishui Controller Programmer" because I don't have an ST Link and would prefer to leave the bootloader on the controller if possible. Your post here mentions that it's possible to generate the .lsh from your GUI by modifying a config file, but I don't see any parameters in that file related to file outputs or a lsh file. What's the correct way to generate a lsh? Or do I need to get an ST Link?

Doing my best to read through to the Google translate of the german forum, I also see some mentions of generating files directly on github. Is this the new correct way to do this? Is there documentation for this somewhere?
 
Last edited:
I also see some mentions of generating files directly on github. Is this the new correct way to do this? Is there documentation for this somewhere?
Yes, this is the recent way to use the original Lishui firmware update tool. There is a german tutorial in the german Wiki:

I hope you can translate it.
There is a youtube video for the M365 scooter fork, that follows the same principle, of cource the generated file formats are different.


Please report, with my new generation 12FET the update process aborted randomly :-(

regards
stancecoke
 
Bonjour de France je suis sur le même projet de contrôleur que j'ai en stock aves vous avez réussi à avancer j'ai essayé un firmware du forum mes toujour pas accélérateur sur le scooter le contrôleur salue es la led clignote bien


Si besoing mon mail
Kdeux@hotmail.fr .
 

Attachments

  • qwl08evhjdi71.jpg
    qwl08evhjdi71.jpg
    198.4 KB · Views: 6
  • F7bLYHy.jpg
    F7bLYHy.jpg
    865.4 KB · Views: 5
  • WZVXXM2.jpg
    WZVXXM2.jpg
    713.4 KB · Views: 5
  • o9a9kcN.jpg
    o9a9kcN.jpg
    925.8 KB · Views: 5
  • QB5a2OC.jpg
    QB5a2OC.jpg
    899.2 KB · Views: 6
Yes, this is the recent way to use the original Lishui firmware update tool. There is a german tutorial in the german Wiki:

I hope you can translate it.
There is a youtube video for the M365 scooter fork, that follows the same principle, of cource the generated file formats are different.


Please report, with my new generation 12FET the update process aborted randomly :-(

regards
stancecoke
I was able to follow the instructions on that page and generated a .lsh file, but programming with the Lishui update tool always fails. It connects and starts downloading, then quickly fails while downloading. The furthest it has gotten is about half way through the loading bar.
It looks like some other app is being used in the video. Do I need to be using something else?
In its current state, it only transmits once on bootup. The message is "4D 50 43 16 0B 1D 0D 2D 2D 24 0B " at baud 38400. Interpreted as ASCII, that's "MPC" followed by non-characters. The LED also only blinks once on startup when it used to blink continuously. Interestingly, it will keep blinking after a failed program until the power is cycled. I wonder if the Lishui bootloader has been wiped somehow and it's reverted back to the stock bootloader. It looks like I may need to take the ST-Link path to flash this controller.


While peeling away more of the potting material, I damaged R53. Is anyone able to read the marking of this resistor on their board? Based on the repetitions of this circuit, I'm pretty sure the value is 03C (i.e. 10.5kOhm), but the routing is difficult to follow and I'm not quite sure I got it right.
1697436554137.png
 
but programming with the Lishui update tool always fails.
Ah, as written above, I had the same problem with the new generation 12FET from Phoebe Liu some time ago. I have to check it again. For now, you have to use the ST-Link.

Edit: I've tried both, the original Lishui Flash-Tool and the lishuiFlash.exe in the "make" folder of the repo. It can be used in a cmd window by the command lishuiFlash COM9 sample.lsh
With your com port and your lsh file name of course.

It worked both for me with a FTDI FT232 converter.

regards
stancecoke
 
Last edited:
I finally got it to flash over UART, but it's being very finicky. I eventually got it to flash once after a couple failed attempts alternating between the official flashing tool and lishuiFlash.exe. lishuiFlash.exe still reported an error even though it seems to work (it booted after a power cycle instead of boot looping) but the official flashing tool reported a success. With an updated build it seemed even more finicky. The weirdest part is sometimes it'll start running the app after a failed flash (LED starts blinking and it's spitting out the debug message over UART), but it doesn't boot properly after a power cycle. It's almost like there's something that's intermittently keeping it from booting.
>lishuiFlash.exe COM3 EBiCS_build_2\EBiCS_Firmware.lsh
Provide power to the controler now ! (Ctrl-c to exit)
MPC
▬♂
got wrong input : 16

Error :(
Press any key to continue . . .


Now that I have it flashed, I'm having trouble with the throttle and torque inputs.
With this config file (link), I get this debug message. The first value (throttle value) flickers between 0 and 1 but all the others are steady no matter what signals I inject on the throttle or toque signal wires.
0, 0, 274, 32000, 0, 0, 0, 0, 0
After enabling THROTTLE_OVERRIDE and TQONAD1 (link), the torque signal is now stable at 4094, but everything else is the same.
0, 4094, 274, 32000, 0, 0, 0, 0, 0
I currently just have it set up on my bench with only the throttle and torque signals connected (both connected to physical throttles). Is there something else I need to hook up to test it?


The resistor I damaged (R53) was 10.5kOhm. I confirmed this by probing out the other instances of the current sense circuit and everything seems to be back to normal after replacing it.
 
Is there something else I need to hook up to test it?
it is not possible to use throttle and torquesensor in parallel in the master branch. It's easy to make both work, it's just a little change in the code.

For first testing, enable throttle override, disable TS_MODE and TQONAD1 and disable the legalflag in the main.h.
You have to run the autodetect routine first once, otherwise the motor can't turn.

regards
stancecoke
 
Last edited:
Shouldn't I at least see the ADC readings printed out in the debug message? Or does the autodetect routine need to run first?
For the brake to trigger autodetect, are the contacts supposed to be closed when the brake is pressed or vice-versa?
 
Shouldn't I at least see the ADC readings printed out in the debug message?
The only ADC reading in the recent master print out is the throttle input on the "SP" pin, first column.

Have you changed the break pin definition in the main.h for the new generation 12FET controller from Phoebe Liu?

regards
stancecoke
 
Ahh, I assumed the print messaged matched this page. Shouldn't I still have seen a changing value for SP?
I had not updated the brake pin config, I'll do that as well.
 
Shouldn't I still have seen a changing value for SP
Yes, if you have soldered a wire to SP and attached the throttle signal there.
The variables that are printed may change from commit to commit, depending on the issues I'm working on recently. ;)

regards.
 
the OSF version uses Torque and cadence to calculate the human power (plus sometimes torque override) but i am very curious what the principle in those original controllers we can get from Phoebe Liu ?
 
The lower EN06 Display uses the 5S protocol normally. But it depends on the firmware, it can use something totally different also. Just try ;)
I don't know the upper display.🤷‍♂️

regards
stancecoke
 
i have this tiny controller with broken display, i cannot make it work with any of displays i have so decided to load it with OSF. I have carefully examined the torque sensor wiring and signals so it works on pins:
PAS - yellow wire on - TA pin
FWD/RWD crank rotation - green wire on - SL pin (FWD -> 0V; RWD -> 4V)
Torque - blue wire - AD1 pin (0,21V - 1,5V+)
speedometer - S5 pin

Would it work with OSF of the shelf or do i need to change the pins allocation in the code?? :unsure:

below i am attaching the pictures of the board
IMG20240228190325.jpgIMG20240228184801.jpgIMG_20240228_094734.jpgIMG20240228184211.jpgIMG20240228184650.jpgIMG20240227193958.jpgIMG20240228190118.jpg
 
Would it work with OSF of the shelf or do i need to change the pins allocation in the code??
Pinout%20Old%20Generation.PNG

I think, you can answer this question yourself ;)
You don't need to change the code itself, just choose the option "torque on AD1"

Is this controller supported by EBiCS firmware?
I don't know yet. A user in the german forum has ordered this controller, but he has not posted any detailed information about it.

regards
stancecoke
 
......
I think, you can answer this question yourself ;)
You don't need to change the code itself, just choose the option "torque on AD1"

......

regards
stancecoke
cool thanks, sometimes i am to lazy to check it myself at first place, and besides i like to talk to all smart poeple on ES ;)
 
Back
Top