Lishui "Open Source Firmware" project / KingMeter 5S

and in the basic settings.ini file seems to be something wrong, as the default path definitions are not correct.
1740926247962.png
That explains why the experimental settings in the JavaConfigurator dir were so broken.

Also: do not run make clean on linux. It does rm -rf * in pwd instead of build/

Can you add the button and #define for the No2 protocol also, please? :)
Done, I hope this fixes it. At least by doing make clean I now had a clean working dir and found the same error.
 
Last edited:
I've merged with master, it's also missing from there.
Yes, of course, I've not updated the Java Tool for years ;)
But if we are updating it now, we could include the new feature No2 display support also for the Java Tool users...

regards
stancecoke
 
Last edited:
Yes, of course, I've not updated the Java Tools for years
commit 2d068e0ba9417854b6c38dfbbdcdd5e11bc736d5
Author: stancecoke <hochsitzcola@web.de>
Date: Mon Aug 29 19:19:28 2022 +0200

Bugfix in Java Tool for new Master
It's not that bad. Only ~2.5 years.
But if we are updating it now, we could include the new feature No2 display support also for the Java Tool users...
My thinking exactly. Added it since I still had all the edits for more radio buttons lined up in my vim history.
 
Can you update your pull request to your latest commit?
91e6827095777af702d5ee2013f869d8131f55c9 is the latest (which is a bonus commit to prevent linux users wiping the entire directory by accident)

Added support for more opcodes and brake signal for bafang displays by consp · Pull Request #58 · EBiCS/EBiCS_Firmware -> 495f9df4859d16ca01af85ab66fa69c53bc45e3c contains the latest javaconfigurator changes (No2 added + JavaConfigurator jar)

Afaik github updates pull requests automatically when you add commits to the branch. The force push is an oopsie due to rebasing on the wrong commit. You can probably squash them on merge (Only know how gitlab does it, no clue about github).
 
?! you did a pull request for the old commits that I already merged, but not for the new ones?!
https://github.com/EBiCS/EBiCS_Firmware/pulls
Apperantly github/git is doing git things again:

$ git clone GitHub - EBiCS/EBiCS_Firmware: Free FOC firmware for Lishui E-Bike-Controllers ebics
$ git clone git@github.com:consp/EBiCS_Firmware.git consp
$ cd consp & git checkout bafang_update & cd ..
$ diff ebics consp
Common subdirectories: ebics/Documentation and consp/Documentation
Common subdirectories: ebics/Drivers and consp/Drivers
Common subdirectories: ebics/experimental settings and consp/experimental settings
Common subdirectories: ebics/.git and consp/.git
Common subdirectories: ebics/.github and consp/.github
Common subdirectories: ebics/Inc and consp/Inc
Common subdirectories: ebics/JavaConfigurator and consp/JavaConfigurator
Common subdirectories: ebics/KiCAD and consp/KiCAD
Common subdirectories: ebics/make and consp/make
Common subdirectories: ebics/proven settings and consp/proven settings
Common subdirectories: ebics/.settings and consp/.settings
Common subdirectories: ebics/Src and consp/Src
Common subdirectories: ebics/Startup and consp/Startup

So ignore the mismatched heads, you have everything. I assumed it didn't so I made another one but it contains the same commits, github sees it as different commits and the does a rebase which applies the same commits which are ... the same, but different (even the timestamps match ...)? I'm done trying to mend my head around git. In the end the result is the same == the same end result. I'm done with trying to understand git rebase idiocracy.
Sorry for the headache.
 
Last edited:
OK, I've merged your new request. The Master branch should be up to date now. I don't understand, why the the pullrequest had the title of the old commit....
 
Last edited:
When I started my project last year in April, I never thought I would have to invest so much time in it.
After finishing the project I would like to give something back to the project with the manual I am currently writing and the improvements in the Java Configurator.
I hope that this will save other beginners a lot of frustration.


I very much appreciate the offer to become a maintainer and also your work.
Unfortunately I have no more freetime for it. The conversion of the bike should
only be a interesting Christmas present, but the amount of work involved has gotten
already out of hand (which has delayed other projects of mine significantly).
At first i mant to use a completed conversation kit but no one offered a not very expencive kit with a torque sensor.
So i deside to build it by my own.


There is an issue reported on github, perhaps you can try the recommented solution, if you are editing the Java Tool anyway.
You have fix it already as i see.
I have had a look on it and see that the problem with the directory name come from the point, that in the JavaConfigurator-directory there the subdirectory is called "inc" and in the main Path it called "Inc".
Do have a clear sollution on of both directorry names should be changed (after the change in the java configurator maybe JavaConfigurator/inc to JavaConfigurator/Inc
Source

In short:
Code:
battery current = duty cycle * motor current

The Source was realy insightful.
But the problem remain. For the Battery Current I sould use 7 A ( the ratet current of the controller), because otherwise it could overhead when using it longer time at its limit e.g. drive up a montain.
Espacily when the internal temperatur is not a good overheading protection for the mosfets.

A overload management would fix this but for now i will not implment it.
For example within 3 minutes, the maximum current may only be called up for a total of 20s, when exceeding it it is limited to the rated currend. This would also only be a rough estimate, because you would need very precise data from the manufacturer regarding the thermal behavior for accurate setup.

For the Maximum Motor current it is the same.
But here i will keept the 50 A for the maximum motor current in the dokumentation even with a bit bad feeling.

With 50 A it is possible to destroy the motor when driving to long time with much load and slow speed.
As a automation engineer im realy used to only use the Values from the supplyer, but a industrial supllyer have most times mutch more detailed documentations than supplyer of the ebike motors.

Is the gear ration value somehow needed when you have a external speed sensor?

Whats abbout the gear ratio?
I don`t see any point in the code where it is used when having a external speedsensor or did i anything overlooked?
 
A overload management would fix this
The best measure to avoid damage on the system is to install a temperature sensor in the motor. Then the controller can reduce the power, if the motor is getting too hot. This feature is already implemented in the firmware, but not many motor manufacturers equip their motors with temperature sensors. That's another big advantage of the Kclamber casette sensor, it sends the motor temperatur, the wheel speed, the torque... everything on just the one white wire from the motor :cool:

Whats abbout the gear ratio?
you are right, it is only needed to calculate the wheel speed if there is no external speed sensor.

Thank you for your efforts! (y)

regards
stancecoke
 
That's another big advantage of the Kclamber casette sensor, it sends the motor temperatur, the wheel speed, the torque... everything on just the one white wire from the
I have read about this in the german forum an this seems like the best solution but with the downsides of doing some turning work on the motor case and building some electronics by your selfe.
Where you buy the sensor when implementing it?
The best measure to avoid damage on the system is to install a temperature sensor in the motor. Then the controller can reduce the power, if the motor is getting too hot. This feature is already implemented in the firmware, but not many motor manufacturers equip their motors with temperature sensors.
When not buy the producer you can add a Temperature sensor by your selfe and connect it to the white wire.
Im not getting the point why a beside this realy well made Motor like the Sengyi DGWX2 have no temperatur sensor implemented by default. Did you know how the default software of lishui controller deal with the often not existing temperature sensors?


tenet
 
Did you know how the default software of lishui controller deal with the often not existing temperature sensors
Most OEMs that are using Lishui Controllers like Fischer, NCM, Himiway, Radrunner don't limit the power as far as I know. If the rider creeps uphill with low speed and highest assist level, the motor will burn after a few minutes.
Some dealers like EBS in Germany or Grin equip their systems with motors with temperature sensors. But they use customized controller hardware and firmware (white wire connected to an anlog input)

Where you buy the sensor when implementing it?
I bought my first motor with the KCLamber cassette sensor at Phoebe Liu EV Parts (aliExpress).
Meanwhile there are many manufacturers, that offer motors with this sensor, like Aikema, Bofeilli, Truckrun..... See the posts of @mechaniker at the German pedelecforum.
Grin offers the all axle motor with the Kclamber meanwhile, but of course not in combination with Lishui controllers.
I'm still waiting for the day, when the first dealer will offer a smart set of motor, controller and battery with the Kclamber cassette sensor ;)

regards
stancecoke
 
I have an apt 800s display but i can't seem to get it to work with the opensource firmware I keep getting communication failed. Could anyone maybe tell me what protocol I should use for this display to work?
 
Ok will do this week. A couple of more questions. I flashed the firmware with the javascript gui. My kick scooter runs great.
1. Am I correct that I flashed the debug version with autocalibrate enabled after it ran, i flashed with display version and there is no need to run autocalibrate again since calibration settings are in a virtual eeprom that doesnt get overwritten duren a reflash?
2. How to calibrate voltage, I see in advanced there are calibration settings but i have no clue how to use them?
3. My kick scooter runs on throttle only. My motor jerks a bit the first 2 seconds when going from stop to running on throttle only. If I help by kiking first it doesn't do that. Can I tune that out? I already disabled postition ppl. since that made my motor run rough.
4. I use the 750w DGW25P motor from shengy it says on there website gearing is 1:05 but i guess thats a type error and should be 1:5 controller is 12A rated an max 25A my max motro current is set to 22800 so i guess that should be save. Also my battery is 48v 17,5 ah and setting is batterycurrent max 15000 so that is below 1c.

Best fun i had in months flashing this kick scooter.
 
Last edited:
there is no need to run autocalibrate again
You are right, the virtual EEPROM is not overwritten by a reflash. Only if you do a full chip erase, the content is deleted.

How to calibrate voltage
There is no need to calibrate it, as long as Lishui uses the same resistor values in the voltage divider as usual.

My motor jerks a bit the first 2 seconds
I guess the motor current limiter kicks in, as you have set the motor current to a very low value.
Increase the motor current limit to about 50 amps and try if that solves the issue.

Can you post the content of your recent config.h, or is it at GitHub? Then I can check the settings...

I have not worked with the Java configurator for years now and I never tried the last updates from the community myself.

regards
stancecoke
 
This is my config h and you mean up the vallue form 22800 to 50000? Wont tha be an issue with my controller since it is 12 en 25 amp?
#ifndef CONFIG_H_
#define CONFIG_H_
#include "stdint.h"
#define DISPLAY_TYPE_DEBUG (1<<0) // For ASCII-Output in Debug mode);
#define DISPLAY_TYPE_KUNTENG (1<<1) // For Kunteng display
#define DISPLAY_TYPE_BAFANG_LCD (1<<2) // For 'Blaupunkt' Display of Prophete Entdecker
#define DISPLAY_TYPE_BAFANG_850_860 (1<<3) // Bafang 850/860. Can do 9k6 baud, also compatible with 1200 baud detection at startup
#define DISPLAY_TYPE_KINGMETER_618U (1<<4) // King-Meter 618U protocol ( J-LCD)
#define DISPLAY_TYPE_KINGMETER_901U (1<<5) // King-Meter 901U protocol (KM5s)
#define DISPLAY_TYPE_EBiCS (1<<6) // Protocol using the ANT+ LEV logic
#define DISPLAY_TYPE_NO2 (1<<7) // For China Protokoll "No_2" S866 display for example
#define DISPLAY_TYPE_BAFANG (DISPLAY_TYPE_BAFANG_LCD|DISPLAY_TYPE_BAFANG_850_860)
#define DISPLAY_TYPE_KINGMETER (DISPLAY_TYPE_KINGMETER_618U|DISPLAY_TYPE_KINGMETER_901U)
#define EXTERNAL 1
#define INTERNAL 0
#define LEGALFLAG

#define TRIGGER_OFFSET_ADC 50
#define TRIGGER_DEFAULT 2020
#define _T 2028
#define CAL_BAT_V 256
#define CAL_V 25
#define CAL_I 38LL<<8
#define INDUCTANCE 6
#define RESISTANCE 40
#define FLUX_LINKAGE 1200
#define GAMMA 9
#define BATTERY_LEVEL_1 323000
#define BATTERY_LEVEL_2 329000
#define BATTERY_LEVEL_3 344000
#define BATTERY_LEVEL_4 368000
#define BATTERY_LEVEL_5 380000
#define P_FACTOR_I_Q 500
#define I_FACTOR_I_Q 20
#define P_FACTOR_I_D 500
#define I_FACTOR_I_D 20
#define P_FACTOR_PLL 5
#define I_FACTOR_PLL 11
#define P_FACTOR_SPEED 100
#define I_FACTOR_SPEED 10
#define SPDSHFT 0
#define SPEEDFILTER 1
#define SIXSTEPTHRESHOLD 3500
#define TS_COEF 60000
#define PAS_TIMEOUT 8000
#define RAMP_END 1600
#define PAS_IMP_PER_TURN 32
#define FRAC_HIGH 30
#define FRAC_LOW 15
#define THROTTLE_OFFSET 750
#define THROTTLE_MAX 3000
#define PUSHASSIST_CURRENT 30
#define WHEEL_CIRCUMFERENCE 2000
#define GEAR_RATIO 10
#define SPEEDLIMIT 45
#define PULSES_PER_REVOLUTION 1
#define PH_CURRENT_MAX 600
#define BATTERYCURRENT_MAX 15000
#define REGEN_CURRENT 200
#define REGEN_CURRENT_MAX 10000
#define VOLTAGE_MIN 500
#define VOLTAGE_MAX 1600
#define SPEC_ANGLE -715827882
#define DISPLAY_TYPE DISPLAY_TYPE_KINGMETER_618U //J-LCD
#define SPEED_PLL 0
#define SPEEDSOURCE EXTERNAL
#define AUTODETECT 0
#define REVERSE 1
#define THROTTLE_OVERRIDE

#endif /* CONFIG_H_ */
 
Hello! I've gotten my hands on a LSW772-64-9F Lishui controller that has no hall sensor connector although the pins and traces on the PCB are all setup and connected to the MCU. I soldered a 3 pin jst sm female connector with the leads going to the hall sensor pins SA(yellow), (SB?)(green), SC(blue). Then flashed the firmware with the attached config.h.

My problem is that the motor runs very jerky and almost sounds like a moped with all the vibration both during the autodetect and after in "normal" operation. This does not happen when it's connected and run with an OSEC flashed Kunteng controller.

I suspect an electrical difference on the controller PCB, if so. What part is different? Can it be modified/replaced to be compatible?
I can provide more pictures/readings with a multimeter and a usb oscilloscope/logic analyser if that helps.

Thank you.
 

Attachments

  • 20250316_145747.jpg
    20250316_145747.jpg
    1 MB · Views: 4
  • 20250316_145657.jpg
    20250316_145657.jpg
    2.2 MB · Views: 4
  • config.h
    2.5 KB · Views: 2
Back
Top