Lishui Controller Programming File
To program a Lishui e-bike controller , the best "piece" or resource depends on whether you want to stick with official tools or dive into open-source customization. 1. Official Lishui Programming Tool
The standard way to update or adjust a Lishui controller is using the official LSH_File_Update_Tools.
Purpose: Primarily for flashing .lsh firmware files provided by manufacturers or Lishui’s tech team.
Key Feature: By unchecking the "Keep Current Settings" box, you can modify basic parameters like maximum current and undervoltage limits directly.
Secret Menu: Clicking the "Clear Info" button multiple times within the tool reveals a hidden "File Conversion" menu for converting hex files to .lsh format.
Hardware Required: A USB-to-TTL programmer or a specialized Lishui USB programming device. 2. Open-Source Firmware (EBiCS)
For advanced users who want full control (e.g., adding Field Oriented Control or torque-sensing), the EBiCS Firmware on GitHub is the gold standard.
Hardware: Requires an ST-Link V2 programmer instead of a standard USB-TTL cable to flash the STM32-based controllers.
Customization: Offers a user-friendly GUI for setting up battery levels, speed limits, and PAS (Pedal Assist) behavior. 3. Display-Based Programming
If you just need to tweak performance without a computer, many Lishui controllers allow advanced setting access through the display: EggRider: The EggRider V2 Go to product viewer dialog for this item.
display provides a mobile app interface to adjust Lishui-specific settings like wheel size, speed limits, and PAS gain.
Manual Codes: Some models use a passcode (often 1919) in the display menu to enter advanced settings and increase the Amp output.
For a visual walkthrough of the official software installation and flashing process: Lishui Controller Program Downloader Instruction Nanjing Lishui Controller YouTube• Sep 21, 2023 I have a Lishui Controller .lsh firmware file lets mod it
Programming a Lishui controller typically involves two paths: using the official Lishui parameter setting software for minor adjustments or flashing custom open-source firmware for advanced control. 1. Official Lishui Programming (LSH Files)
Most modern Lishui controllers (like the LSW-675) come with a pre-installed bootloader that allows firmware updates via the display connector.
Hardware Required: A USB-to-UART serial adapter or the official Lishui "USB program device". Software: The Lishui Controller Programmer utility. Connection: Disconnect the display from the controller.
Connect the USB adapter to the controller's display cable. Ensure RX connects to the controller’s TX and TX to the controller’s RX.
The "Secret" Menu: Clicking the "Clear Info" button multiple times in the programmer software unlocks a hidden File Conversion tab. This allows you to convert standard hex files into .LSH files, which are compatible with the Lishui bootloader.
Power Tip: If your programmer was made after Sept. 2015, it may be "USB boost powered" and won't require the e-bike battery to be connected during flashing. Otherwise, you must power on the battery when the software prompts you. 2. Advanced Open-Source Firmware (OSFW)
For total control over motor performance (like Field Oriented Control/FOC), enthusiasts use custom firmware such as EBiCS or CloneYCRS. Lishui "Open Source Firmware" project / KingMeter 5S lishui controller programming
Programming a Lishui e-bike controller allows you to unlock higher speeds, adjust current limits, and customize the riding feel through field-oriented control (FOC) or torque simulation
. While stock programming is often restricted by manufacturers, there are three primary ways to modify these controllers depending on your technical comfort level. 1. Official Manufacturer Tools (Basic Configuration) If you have a
firmware file provided by a tech team or found online, you can use official software to update parameters like max current and undervoltage limits. : Download the LSH_File_Update_Tools LS_Controller_Update.exe from the official Lishui Controller Download Page
: You typically need a Lishui-specific USB programmer (like the The "Secret" Menu
: In some versions of the programmer, clicking "Clear Info" multiple times reveals a "File Conversion" tab used to convert hex files to
: Connect the programmer to the controller's display connector (RX to TX, TX to RX). You may need to power the controller via the e-bike battery during the process if the USB port doesn't provide enough current. 2. Open Source Firmware (Advanced Customization) For users wanting total control, the EBiCS (E-Bike Controller System)
project provides a free FOC firmware for Lishui controllers that use the STM32F103 processor. Key Features
: Supports sinewave driving, throttle, torque-simulation, and torque sensors. Flashing Method : Requires an ST-Link V2
programmer. For newer controllers, you may need to open the housing and solder wires to the GND, +3.3V, SWDIO, and SWCLK pins. Source Code : Available on the EBiCS GitHub Repository 3. Display-Based Adjustments (Quick Settings)
If you aren't ready to flash new firmware, many Lishui controllers support "P-settings" through the LCD display (like the : Speed Limit (0–100 km/h).
: Current Limit (set to match your controller's amp rating).
: Some manufacturers lock these settings at the factory, in which case flashing (Option 1 or 2) is the only way to override them. Warning: Safety First
Lishui controllers (LS), manufactured by the Nanjing Lishui Electronics Research Institute, are widely used in e-bikes for their smooth Field-Oriented Control (FOC) performance. Programming these units allows riders to fine-tune torque delivery, adjust current limits, and even install custom open-source firmware. Essential Programming Tools
To interface with a Lishui controller, you need specific hardware to bridge the gap between your computer and the controller’s display or programming port:
USB-to-Serial Adapter: A standard FT232RL-based adapter is the industry standard for stable communication.
Programming Cable: Depending on your controller model, you may need a Julet 5-pin or 4-pin waterproof connector cable that breaks out into RX, TX, GND, and VCC.
ST-Link V2 (Optional): Required for flashing deep firmware or unbricking controllers that do not have a bootloader accessible via the display port. The Official Programming Process
Official programming is typically done using the Lishui LSH_File_Update_Tools. This utility allows you to upload .lsh firmware files provided by manufacturers or tech teams.
Driver Setup: Install the appropriate USB serial drivers. If the software shows a COM port number, the connection is successful. To program a Lishui e-bike controller , the
Connection: Connect the adapter to the controller's display port. Most modern controllers can be "self-powered" by the USB port, but older versions require the e-bike battery to be connected and switched on during the process.
Loading Firmware: Use the "Local File" button to load your .lsh file.
Adjusting Basic Settings: By unchecking the "Keep Current Settings" box, users can often manually adjust the maximum current and undervoltage cutoff limits before flashing.
Flashing: Press Program (F5) and wait for the "Write successful" confirmation. Third-Party & Open-Source Options
For advanced users, the official software can be restrictive. Several community-driven alternatives exist:
EggRider V2 Display: A popular aftermarket display that allows you to configure Lishui settings directly from a smartphone app via Bluetooth.
EBiCS Open Source Firmware: A community project on GitHub that provides free FOC firmware for Lishui controllers, offering features like regenerative braking and customized torque sensing.
XPD (Extended Parameter Designer): Older software used for some sine wave controllers to adjust ramp times and PAS (Pedal Assist) sensitivity. I have a Lishui Controller .lsh firmware file lets mod it
This report outlines the primary methods for programming and configuring Lishui e-bike controllers, ranging from simple display-based adjustments to advanced firmware flashing for custom Field Oriented Control (FOC) profiles. 1. Configuration via LCD Display
For most users, "programming" refers to adjusting operational parameters through the bike's existing display. These settings are often locked behind a PIN (commonly Common Adjustable Parameters: Screen brightness and speed units (km/h vs. mph). System voltage (24V, 36V, 48V, 52V, 60V).
Wheel diameter and number of motor magnets for accurate speed sensing. Maximum speed limit (0–100 km/h).
Controller current limit (typically 1–20A depending on the model). Procedure:
Connect the display (e.g., C500, SW900) to the controller, power on, and navigate to "System Settings" to make real-time adjustments without external software. 2. Official Desktop Programming (LSH Tool)
Advanced configuration and official firmware updates are performed using the proprietary Lishui LSH Programmer
Introduction
Lishui controllers are popular electronic speed controllers (ESCs) used in various applications, including robotics, automation, and industrial control systems. Programming a Lishui controller requires a basic understanding of programming concepts and the specific commands used by the controller. This guide provides a step-by-step introduction to Lishui controller programming.
Hardware Requirements
- Lishui controller (e.g., Lishui LS-ESC- V1.0)
- Programming cable (usually a USB-to-TTL serial cable)
- Computer with a terminal emulator or programming software (e.g., Arduino IDE, Python)
Software Requirements
- Lishui controller firmware (download from the manufacturer's website)
- Programming library or framework (optional)
Basic Programming Concepts
- Serial Communication: Lishui controllers communicate through a serial interface (e.g., UART, TTL). The programming cable connects the controller to the computer, allowing data transmission.
- Command Structure: Lishui controllers use a specific command structure, consisting of:
- Header: A fixed byte sequence (usually 0x55 0xAA) indicating the start of a command.
- Command ID: A unique identifier for the command (e.g., 0x01 for setting the speed).
- Data: The command-specific data (e.g., speed value).
- Checksum: A calculated value verifying the command integrity.
Programming Steps
- Connect the Controller: Connect the Lishui controller to the computer using the programming cable.
- Open a Terminal Emulator: Open a terminal emulator (e.g., Arduino IDE, HyperTerminal) and set the serial communication parameters:
- Baud rate: Typically 115200 bps (check the controller's documentation).
- Data bits: 8 bits.
- Stop bits: 1 bit.
- Parity: None.
- Send Commands: Send commands to the controller using the terminal emulator or programming software. The command structure is:
- Header (0x55 0xAA)
- Command ID
- Data
- Checksum
Common Commands
- Set Speed (Command ID: 0x01):
- Data: 2 bytes (speed value, 0-100%)
- Example: 0x55 0xAA 0x01 0x00 0x64 (set speed to 100%)
- Get Speed (Command ID: 0x02):
- No data required
- Example: 0x55 0xAA 0x02 (get current speed)
- Set Direction (Command ID: 0x03):
- Data: 1 byte (direction, 0x00 for forward, 0x01 for reverse)
- Example: 0x55 0xAA 0x03 0x00 (set direction to forward)
Programming Examples
- Arduino Example:
#include <SoftwareSerial.h>
SoftwareSerial serial(2, 3); // RX, TX
void setup()
serial.begin(115200);
void loop()
// Set speed to 50%
serial.print("\x55\xAA\x01\x00\x32");
serial.println();
delay(100);
// Get current speed
serial.print("\x55\xAA\x02");
serial.println();
delay(100);
- Python Example (using PySerial library):
import serial
ser = serial.Serial('COM3', 115200)
# Set speed to 75%
ser.write(b'\x55\xAA\x01\x00\x4B')
# Get current speed
ser.write(b'\x55\xAA\x02')
Troubleshooting
- Communication Issues: Verify the serial communication parameters (baud rate, data bits, stop bits, parity).
- Command Errors: Check the command structure and checksum calculation.
Conclusion
Lishui controllers are widely used in ebikes and can be programmed through two primary methods: standard parameter adjustment via the display and deeper firmware flashing using dedicated hardware. 1. Standard Parameter Adjustments (Display)
Most Lishui-based ebikes (like those using SW900 or KT-LCD displays) allow you to modify basic performance settings through a built-in menu. Common parameters include:
P01–P03: Screen brightness, units (km/h vs. mph), and battery voltage (24V, 36V, 48V, etc.).
P06–P08: Wheel diameter, motor magnet count, and the maximum speed limit. P13: Controller amperage setting to adjust power output. 2. Firmware Programming (Advanced)
For deeper customization (e.g., Field Oriented Control (FOC) tuning or current limits), you must flash the controller directly using a computer.
Official Tools: Lishui provides a "LSH Programmer" tool and specific .lsh encrypted firmware files. To use these, you typically need a Lishui-specific USB programming stick (FPS2) or a compatible USB-to-UART adapter connected to the display cable's RX/TX pins.
Open Source Alternatives: Projects like EBiCS_Firmware and the Flexible OpenSource Firmware allow you to bypass factory restrictions. These often require an ST-Link V2 programmer to connect directly to the controller’s internal STM32 pins.
Custom Settings: By unchecking "Keep Current Settings" in official Lishui tools, you can sometimes manually set new maximum current and low-voltage cutoff values. 3. Necessary Hardware Connection Point Display Buttons Handlebar Display Basic speed and PAS level limits. USB-to-UART Adapter Display Connector Parameter adjustment and .lsh firmware updates. ST-Link V2 Internal PCB Pins Complete open-source firmware replacement.
Safety Warning: Always use a fuse in your power supply when flashing firmware to prevent permanent damage to the controller or battery if a short circuit occurs.
Part 3: Step-by-Step Guide to Lishui Controller Programming
Warning: Incorrect programming can brick the controller, overheat MOSFETs, or cause battery damage. Proceed at your own risk.
What Can You Actually Change?
On a user-accessible Lishui (non-encrypted), you can adjust:
- Speed limit (km/h or % of max RPM)
- Current limit (battery vs. phase – careful!)
- Throttle curve (linear, exponential, or step)
- Regenerative braking strength (0–5 settings)
- Low voltage cutoff (LVC) – for upgrading batteries
- PAS (pedal assist) levels (power % per level)
What you cannot change without special firmware:
- Motor timing angle (hall sensor offset)
- Over-temperature thresholds
- CAN bus node ID
8. Example: Temperature control sequence (end‑to‑end)
Goal: Hold oven at SP with heater and alarm if overtemp.
- Inputs: Temp_AI (scaled), Start_PB, Stop_PB, Overtemp_Limit (parameter).
- Outputs: Heater_AO (0–10 V), Alarm_DO.
- Logic:
- On Start_PB: enable PID; set SP from operator panel.
- PID computes ControlOutput → scaled to AO.
- If Temp_AI ≥ Overtemp_Limit → disable PID, turn off Heater_AO, set Alarm_DO, latch fault until manual reset.
- Log event with timestamp and measured temp.
- Safety: Hardware high‑limit thermostat should be wired in series with heater as independent protection.
3. Programming workflow
- Create new project in IDE — select controller model and CPU slot.
- Configure I/O mapping and communication ports.
- Define global variables/tags (names, data types: BOOL, INT, REAL, STRING).
- Build logic using chosen language (LD/FBD/ST).
- Add PID controllers or math blocks as needed.
- Implement alarms, interlocks, and safety conditions.
- Simulate (if IDE supports) or compile to check errors.
- Download program to controller and run in test mode.
- Monitor variables online, adjust tuning and setpoints.
- Save project and document version/revisions.