KT LCD3 firmware -- Flexible OpenSource firmware for Kunteng KT-LCD3

Get all your technical information about electric bikes here.
casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

KT LCD3 firmware -- Flexible OpenSource firmware for Kunteng KT-LCD3

Post by casainho » May 03 2018 12:33pm

I started the project of OpenSource firmware for the popular BMSBattery S series controllers / Kunteng KT and TSDZ2 mid drive motor controllers.

There are a few models of LCDs used on KT controllers and LCD3 seems to be the most complete, that shows for instance the motor real time power in watts.
On TSDZ2, his LCD is really poor, it can't even show the motor real time power in watts nor even the battery voltage :-(

Both KT and TSDZ2 motor controllers use the same microcontroller STM8S105, and the LCD3 also uses the same STM8S105!! This is an opportunity to exploit LCD3 and improve with our own firmware, like adding extra working modes for both KT and TSDZ2 motor controllers :-)

LCD3 uses STM8S105C6T6 that has 32kbytes of flash memory, which should be plenty.
The only other IC on the board is the LCD controller Holtek HT1622 that has datasheet in English language, there are even OpenSource Arduino firmware for it.

The flashing and debugging SWIM header is easily accessible on LCD3 board.

Anyone that believes this firmware will bring value and with some time to help??
Last edited by casainho on May 18 2018 5:01am, edited 1 time in total.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

lqbweb   100 mW

100 mW
Posts: 47
Joined: Nov 08 2014 10:57pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by lqbweb » May 03 2018 1:31pm

For lcd3 i miss a frocking clock. I can't believe there is none, of course I guess it is not possible as there is no battery for that.

Appart from that, i am not really missing anything. It is more on the controller side rather than the display itself

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 03 2018 1:43pm

lqbweb wrote:
May 03 2018 1:31pm
For lcd3 i miss a frocking clock. I can't believe there is none, of course I guess it is not possible as there is no battery for that.

Appart from that, i am not really missing anything. It is more on the controller side rather than the display itself
What do you miss on the controller side?
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 04 2018 12:25pm

Very first code to run on LCD3!! This code waits for a press on the DOWN BUTTON to enable/disable the LCD backlight.

Source code is here: https://github.com/OpenSource-EBike-fir ... 3_firmware

Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

chilltrout   10 W

10 W
Posts: 69
Joined: Oct 30 2016 8:08am

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by chilltrout » May 04 2018 8:00pm

Need Ah's used like on CA :P

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 04 2018 8:10pm

chilltrout wrote:
May 04 2018 8:00pm
Need Ah's used like on CA :P
Do you know how to calculate that?
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

chilltrout   10 W

10 W
Posts: 69
Joined: Oct 30 2016 8:08am

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by chilltrout » May 04 2018 8:14pm

casainho wrote:
May 04 2018 8:10pm
chilltrout wrote:
May 04 2018 8:00pm
Need Ah's used like on CA :P
Do you know how to calculate that?
Wouldn't it just be the time derivative of watts ? watt hours is fine

1N4001   10 W

10 W
Posts: 72
Joined: Nov 28 2017 7:55am

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by 1N4001 » May 05 2018 4:31am

Not derivative, the opposite. Ah (or better Wh) is the integral of current/power over time. Take power measurements at regular intervals, say 1s, then add up 1/3600 of it to the total.

e.g. exactly 100W for each measurement, over the course of 1 hour, will give you 100 Wh (Watt-hour).

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 05 2018 6:02am

1N4001 wrote:
May 05 2018 4:31am
Not derivative, the opposite. Ah (or better Wh) is the integral of current/power over time. Take power measurements at regular intervals, say 1s, then add up 1/3600 of it to the total.

e.g. exactly 100W for each measurement, over the course of 1 hour, will give you 100 Wh (Watt-hour).
Ok, I got it.

STM8 reads the battery voltage on pin PE7. The current value is sent by the controller over UART. So, to have instantaneous Wh:
- P = U * I;
- P * 1/3600 at each shows the instantaneous Wh
- the trip Wh will be: Wh_total = Wh_total + Wh_instantaneous

As I want to define on LCD3 what is motor assist level in Wh and not in amps, so having Wh should be great to manage the available range of a full charged battery.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

lqbweb   100 mW

100 mW
Posts: 47
Joined: Nov 08 2014 10:57pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by lqbweb » May 07 2018 1:22pm

Have you seen the luna ebike kit with the 2 speeds Xiongda motor hub? That color LCD is using the same protocol or a variant of the Kunteng controller i think.

It would be awesome to have a full LCD display, instead of the LCD3. You could display a lot more information. Maybe the efforts should be spent there instead? What do you think?

lqbweb   100 mW

100 mW
Posts: 47
Joined: Nov 08 2014 10:57pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by lqbweb » May 07 2018 1:27pm

casainho wrote:
May 03 2018 1:43pm
lqbweb wrote:
May 03 2018 1:31pm
For lcd3 i miss a frocking clock. I can't believe there is none, of course I guess it is not possible as there is no battery for that.

Appart from that, i am not really missing anything. It is more on the controller side rather than the display itself
What do you miss on the controller side?
I am missing a hidden way to make the bike fully legal in Europe. Some sort of password like going to pas level 1 then to 3 and back to 1, or something like that.

Then the speed would be limited to 25 and power to 250w.

LCD related maybe would be useful to display and estimated range for the current battery and current level. I guess you would first need to figure out a way to estimate the remaining Ah, and Ah/h.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 07 2018 1:32pm

lqbweb wrote:
May 07 2018 1:22pm
Have you seen the luna ebike kit with the 2 speeds Xiongda motor hub? That color LCD is using the same protocol or a variant of the Kunteng controller i think.

It would be awesome to have a full LCD display, instead of the LCD3. You could display a lot more information. Maybe the efforts should be spent there instead? What do you think?
Good point!!

Can you get a link for an online shop selling the LCD??
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

1N4001   10 W

10 W
Posts: 72
Joined: Nov 28 2017 7:55am

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by 1N4001 » May 07 2018 4:09pm

Must be this one: https://lunacycle.com/double-gear-double-torque-motor/
The display: https://cdn8.bigcommerce.com/s-9vkjq73s ... 174808.jpg

It doesn't appear to be sold separately. I also doubt it'll be easy to reprogram. And if it is, it won't be easy to work with as it's graphics-based. But I am curious nonetheless, it could have potential.


What about a general-purpose LCD? It would improve flexibility and could be much smaller. A character-based LCD, like the one used on the CA3 could be an idea.

Compared to the fixed-symbols LCDs, you could for example swap the odometer with a wattmeter at the push of a button. Or have it cycle on its own periodically. Or show the motor temperature, but only if it exceeds a certain treshold. As I said, flexibility.

Of course you'd also need some buttons to control the whole thing. There might be LCD cases with built-in buttons already.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 07 2018 4:29pm

1N4001 wrote:
May 07 2018 4:09pm
Must be this one: https://lunacycle.com/double-gear-double-torque-motor/
The display: https://cdn8.bigcommerce.com/s-9vkjq73s ... 174808.jpg

It doesn't appear to be sold separately. I also doubt it'll be easy to reprogram. And if it is, it won't be easy to work with as it's graphics-based. But I am curious nonetheless, it could have potential.


What about a general-purpose LCD? It would improve flexibility and could be much smaller. A character-based LCD, like the one used on the CA3 could be an idea.

For example swap the odometer with a wattmeter at the push of a button. Or have it cycle on its own periodically. Or show the motor temperature, but only if it exceeds a certain treshold. As I said, flexibility.

Of course you'd also need some buttons to control the whole thing. There might be LCD cases with built-in buttons already.
After thinking a bit more in all this:

- yes, that color LCD does not seem popular, that is a disadvantage (as also we can't know if it is easy to develop firmware for it)
Also, since it is graphic and color LCD, will be much more complex the graphical part so a bigger project -- and let's not forget about the project for the mobile app: we can do the mobile app instead and then sky is the limit -- we just don't have mobile app because we don't develop it because he hardware is ready like Kunteng controllers!! The bluetooth module is cheap or can be even DIY!!

- general-purpose? that would mean DIY and this is not the idea of the project, to make hardware.

For example swap the odometer with a wattmeter at the push of a button. Or have it cycle on its own periodically. Or show the motor temperature, but only if it exceeds a certain treshold. As I said, flexibility.
LCD3 can do all that, it has 3 buttons and we can put numbers some letters - on the odometer we have space for 5 numbers/letters available and 1 point. We can also write 1999 on wattmeter (but we can disable W symbol if needed).
The disadvantage is that the symbols / mask is fixed but we still has the option to hide or show some symbols.
From the hardware side, LCD3 is kind of cheap (for instance, TSDZ2 LCD is 10€ more expensive and can't even show battery voltage or motor real time power) and is watter prof.

Image
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 12 2018 10:06pm

Finally got control of the LCD symbols!!

- This code waits for a press on the UP BUTTON to enable/disable all the LCD symbols.
- This code waits for a press on the DOWN BUTTON to increase the LCD backlight value.

Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

-dg   1 kW

1 kW
Posts: 454
Joined: Jun 01 2012 4:38am
Location: Oakland, CA USA

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by -dg » May 13 2018 12:49am

How likely is it that this can be made to work with the LDC5 display as well?

Also, I thought I saw a picture of the insides of an LCD5, but I can't find it now. If you know of one, please give me a pointer. Thanks!

-dg
If simplicity worked, the world would be overrun with insects.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 13 2018 3:10am

If more developers help, I think I will not be hard:

https://opensourceebikefirmware.bitbuck ... panel.html

Image
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 16 2018 4:32am

Addressing all segments in sequence, for testing:

Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

nieles   10 kW

10 kW
Posts: 635
Joined: Jul 14 2008 5:39pm
Location: The Netherlands

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by nieles » May 16 2018 12:32pm

Hi,

just opened up my display and noticed mine has a different display driver (SHT32E22) but it looks like its pin compatible for the connected pins as far as i could see..

hopefully its also firmware compatible so we dont need multiple firmwares.

is the test code up on the repository?
Attachments
IMG_20180516_185132.jpg

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 16 2018 12:59pm

nieles wrote:
May 16 2018 12:32pm
Hi,

just opened up my display and noticed mine has a different display driver (SHT32E22) but it looks like its pin compatible for the connected pins as far as i could see..

hopefully its also firmware compatible so we dont need multiple firmwares.

is the test code up on the repository?
I quick looking at datasheet seems it works just as the same way, the commands, signals, etc. Also the PCB seems to be the same!!!

Yes, best code is on github. You can just try and see if you get the same result as I show on the video!!
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

rote   100 mW

100 mW
Posts: 38
Joined: May 18 2016 10:44pm
Location: SoCal

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by rote » May 16 2018 8:32pm

Hi casainho,
I don't get on the forum as much as I used to but know you've been working for a while on these KT projects. Good stuff. I am interested in this KT display project. Like others have mentioned, I think it would be cool if you could get one of the outputs to display real-time current (A) and/or accumulated current (Ah) (like the Cycle Analyst).

Sorry I'm not a developer so can't help you with coding. In any case, I wish you good luck!

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 17 2018 2:09am

rote wrote:
May 16 2018 8:32pm
Hi casainho,
I don't get on the forum as much as I used to but know you've been working for a while on these KT projects. Good stuff. I am interested in this KT display project. Like others have mentioned, I think it would be cool if you could get one of the outputs to display real-time current (A) and/or accumulated current (Ah) (like the Cycle Analyst).

Sorry I'm not a developer so can't help you with coding. In any case, I wish you good luck!
Thank you for the feedback.

I don't know nothing about cycle analyst and I lack experience about such features, understand their need and value as also how they shoild be implemented.

Can you gius please write a list of features you th8nk should be implemented and explain how it should be implemented and why it is important to have that feature??

Ideally, that list should be written on the issue tracker so we don't loose track of each point:

https://github.com/OpenSource-EBike-fir ... are/issues
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

Antenor   100 W

100 W
Posts: 117
Joined: May 09 2016 9:38am

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by Antenor » May 17 2018 3:04am

Hi casainho

I was wondering if by lcd settings the slow start mode that sinewave controllers have could be removed or even better, decide by levels how we prefer this ?

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 17 2018 3:08am

Antenor wrote:
May 17 2018 3:04am
Hi casainho

I was wondering if by lcd settings the slow start mode that sinewave controllers have could be removed or even better, decide by levels how we prefer this ?
LCD shows only limited information sent by the controller like wheel speed, battery current and voltage, etc.
Also they can send commands to the controller like predefined assist levels like 0 up to 5. It is up to controller to implement the important features and not the LCD -- that's why the first project was to develop the firmware for the KT motor controllers.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   100 MW

100 MW
Posts: 2679
Joined: Feb 14 2011 2:43pm

Re: LCD3 firmware -- Flexible OpenSource firmware for Kunteng LCD3

Post by casainho » May 17 2018 5:05am

@Nieles, how are you going??

I pushed code that implements the concept of LCD frame buffer. We write the bits we need to enable to the frame buffer and finally send all the frame buffer to LCD so it is updated. This is working and the "W" symbol is now enabled with: lcd_enable_w_symbol(1);
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, you can consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

Post Reply