Page 145 of 161

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 19 2019 6:34am
by Aeron
stancecoke wrote:
Jan 23 2019 1:55pm
Marv1337n wrote:
Jan 23 2019 12:13pm
I saw that you can modify the LVC, so would that fix my problem or is it a hardware problem?
No hardware problem, you can define any LVC with our open firmware. But I don't know, if your LCD works with lower voltages, as a special "high voltage" version of the LCD3 exists.

regards
stancecoke
I have quite the same question but the other way around : I have a 36/48V version, but I want to run it at 52V.
The FETs and caps were changed to their 80V counterparts to accomodate higher voltage (and I am thinking about changing the LM317 regulator*), but is there any hardware modification to make this controller work with 14S battery ? (voltage limits or other)

*edit : original LM317T replaced by TL783CKCSE3.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 19 2019 9:36am
by bushido
Aeron wrote:
Jun 19 2019 6:34am
stancecoke wrote:
Jan 23 2019 1:55pm
Marv1337n wrote:
Jan 23 2019 12:13pm
I saw that you can modify the LVC, so would that fix my problem or is it a hardware problem?
No hardware problem, you can define any LVC with our open firmware. But I don't know, if your LCD works with lower voltages, as a special "high voltage" version of the LCD3 exists.

regards
stancecoke
I have quite the same question but the other way around : I have a 36/48V version, but I want to run it at 52V.
The FETs and caps were changed to their 80V counterparts to accomodate higher voltage (and I am thinking about changing the LM317 regulator), but is there any hardware modification to make this controller work with 14S battery ? (voltage limit sor other)
+1

i would also love to have higher voltage on a small 6FET/9FET controller. because i will use it with high geared hub motors, i would max out @ ~45km/h. i dont need more power (A), just higher voltage.

i just want to know if its an "easy" mod. if i have to replace one third of the components its not worth it

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 20 2019 2:36pm
by geofft
geofft wrote:
Jun 15 2019 3:33am
davideserin wrote:
Jun 14 2019 2:37pm

I'm using the Sempu torque sensor and i have it working, but is it possible to use a throttle in addition to this?
I'm currently using a Sempu T4 torquesensor and also have a throttle connected. My method was to connect both throttle and torquesensor signal lines in parallel to the controller i/p via a couple of blocking diodes, I used shottky diodes here to reduce the signal voltage drop. You'll then have to alter the Throttle min/max settings to suit.

This works well enough for me, there's a little lag in the throttle response due to the averaging function applied by the torquesensor code but not too noticeable in use.
I think I need to add a little more to this. I'm using a version of the firmware that dates back to last October - with this version the motor would operate from rest with torquesensor input only (i.e. without pedal rotation/pas pulses).

I now realise that the current fw downloads also require pas input before the motor will drive. This is the safer method of operation but unfortunately means the throttle method described above won't work in any useful manner. I don't know if the requirement for pas input can be switched off, I can't see anything in the configurator that would do this - maybe there's something in the app..?

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 20 2019 5:31pm
by Xnyle
No, that would be an experimental and dangerous option we could add though.

What changed since October is ACAsetpoint 282.

In the past apparently someone blew up his motor by tilting his pedal against a wall or something. Without this new protection the bike then wanted to move but couldn't.

What I would suggest though instead of yet another option nobody understands is to just change this protection so that it's always on (you could also think of someone leaning his thumb throttle against something) but more lenient

For instance allowing X seconds of throttle without cadence input (just a quick thought).

Low processing power solutions welcome.

Please think about it and come up with some pseudo code.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 20 2019 5:37pm
by casainho
Xnyle wrote:
Jun 20 2019 5:31pm
No, that would be an experimental and dangerous option we could add though.

What changed since October is ACAsetpoint 282.

In the past apparently someone blew up his motor by tilting his pedal against a wall or something. Without this new protection the bike then wanted to move but couldn't.

What I would suggest though instead of yet another option nobody understands is to just change this protection so that it's always on (you could also think of someone leaning his thumb throttle against something) but more lenient

For instance allowing X seconds of throttle without cadence input (just a quick thought).

Low processing power solutions welcome.

Please think about it and come up with some pseudo code.
That issue wasn't on TSDZ2 firmware??

What I did was motor shutoff if torque sensor > 0 for like 15 seconds and wheel speed == 0. Throttle or torque sensor activated means bicycle wheel should move otherwise something is stuck which should not happen.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 21 2019 2:47am
by Xnyle
Not sure where it was, stancecoke reported it to me.

I'll probably just implement a counter that counts when throttle/torque override is present:

if erps <3: down
else: up

if counter reaches 0: disable override
init 127 or something.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 21 2019 3:24am
by geofft
For me there are just two situations where you need throttle capability in the (current) torquesensor mode:-

1) Pulling away quickly from a standstill,
2) In awkward 'feet down' situations where you are manoeuvring at slow speed around obstructions.
For instance allowing X seconds of throttle without cadence input (just a quick thought).
....I guess this could be a problem in situation 2.
What I did was motor shutoff if torque sensor > 0 for like 15 seconds and wheel speed == 0. Throttle or torque sensor activated means bicycle wheel should move otherwise something is stuck which should not happen.
....this seems a good option to me, would you allow brake input to disable this protection? - maybe this is already implemented.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 21 2019 4:04am
by casainho
geofft wrote:
Jun 21 2019 3:24am
What I did was motor shutoff if torque sensor > 0 for like 15 seconds and wheel speed == 0. Throttle or torque sensor activated means bicycle wheel should move otherwise something is stuck which should not happen.
....this seems a good option to me, would you allow brake input to disable this protection? - maybe this is already implemented.
Yes sure, brakes simple keep motor disabled as also keep that counter reset. Also if wheel_speed > 0, the counter is reset.

We send to KT-LCD3 (and the others) a specific error code so users know when this error is active other way they will not understand why system is not working. Some users do not install brake sensors and keep pressing slightly the pedals/resting feet on red lights and the torque sensor is activated and will trigger this issue.

So, this is a kind of feature that can create frustration to some users if they do not have visual feedback from the system.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 23 2019 9:57am
by kuririkura
Hi All,

Sorry if I'm asking very stupid question.

My goal is just to remove 'speed limiter' in my ebike.
Currently my setup is 900s led with KT48ZWS 1000watt(previously is KT36/48 500 watt)
With both controller I'm hitting barrier on the same 43kph (on gps). Even when i feel the bike still have more juices to get higher

1. What's the diferences of setting up the maximum speed in the firmware/controller, than setting it up through the LCD3?

2. Seems my bottleneck is the RPM limiter, but i didn't see options for that on the firmware GUI

3. How to get/read the default parameter value just for recovery plan? Will it load the default when i connect the controller for the first time?

Thanks

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 23 2019 10:37am
by stancecoke
Xnyle wrote:
Jun 21 2019 2:47am
Not sure where it was, stancecoke reported it to me.
viewtopic.php?p=1419585#p1419585

regards
stancecoke

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 25 2019 1:57am
by Aeron
Aeron wrote:
Jun 19 2019 6:34am
I have quite the same question but the other way around : I have a 36/48V version, but I want to run it at 52V.
The FETs and caps were changed to their 80V counterparts to accomodate higher voltage (and I am thinking about changing the LM317 regulator*), but is there any hardware modification to make this controller work with 14S battery ? (voltage limits or other)

*edit : original LM317T replaced by TL783CKCSE3.
Noone knows ?

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 25 2019 8:26am
by stancecoke
Aeron wrote:
Jun 25 2019 1:57am
Noone knows ?
Just try and report!

regards
stancecoke

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 25 2019 9:26am
by Aeron
I don't have a good understanding of the electronics behind LVC so I thought it would be a good idea to ask first.
If I were using a lower voltage, I guess I'd still be in the mesurement range of the LVC circuit.
But when overvolting, isn't there a risk of falling out of that range and saturate the chip ?

The answer I'm looking for is whether or not the LVC circuit needs any modification (in addition to a setting change in the firmware), like change a resistor value, to shift this range (hence adjusting to a slightly higher battery voltage). Wouldn't it be "too easy" if it were already compatible with higher voltages ? Maybe it is already good enough to set LVC to 42-44V, but I thought I'd check.
bushido wrote:
Jun 19 2019 9:36am
+1

i would also love to have higher voltage on a small 6FET/9FET controller. because i will use it with high geared hub motors, i would max out @ ~45km/h. i dont need more power (A), just higher voltage.

i just want to know if its an "easy" mod. if i have to replace one third of the components its not worth it
If you are interested, I'll let you know how the 6fet I have behaves @52V (stock amps, I'm like you and don't want to up the amps for now).

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 27 2019 10:22am
by bushido
Aeron wrote:
Jun 25 2019 9:26am
I don't have a good understanding of the electronics behind LVC so I thought it would be a good idea to ask first.
If I were using a lower voltage, I guess I'd still be in the mesurement range of the LVC circuit.
But when overvolting, isn't there a risk of falling out of that range and saturate the chip ?

The answer I'm looking for is whether or not the LVC circuit needs any modification (in addition to a setting change in the firmware), like change a resistor value, to shift this range (hence adjusting to a slightly higher battery voltage). Wouldn't it be "too easy" if it were already compatible with higher voltages ? Maybe it is already good enough to set LVC to 42-44V, but I thought I'd check.
bushido wrote:
Jun 19 2019 9:36am
+1

i would also love to have higher voltage on a small 6FET/9FET controller. because i will use it with high geared hub motors, i would max out @ ~45km/h. i dont need more power (A), just higher voltage.

i just want to know if its an "easy" mod. if i have to replace one third of the components its not worth it
If you are interested, I'll let you know how the 6fet I have behaves @52V (stock amps, I'm like you and don't want to up the amps for now).
thanks, but its to late, i have just bought 2x S12SNN 72V from BMS Battery. initially i have planned a stealthy build with DIY bottle batteries. but after thinking through how to best setup the cells configuration , i have decided its not worth it, and i know myself, the limit of 45-50kph (48V) with the Bafang RM G310 & FM G370 would annoy me and i would probably upgrade it later anyway for higher V.

in the end i will build somethink like this

viewtopic.php?f=3&t=47631

or this

https://i.pinimg.com/originals/2d/2d/45 ... eddc07.jpg

and place my battery(20S11P NCR18650PF) and controllers there. i will just put a ~40A phase current limit to the controllers so i don't overload the nylon gears with to much torque. anyway, with 2 motors i should still have good torque. with oil cooling and maybe some heatsinks in the future, i should have no problems running like 2000-2500W continuously. although i will end up with like 1000W most of the time.

its like with the internet speed. sure 20mbit might be good enough for the most time, but there will be times when you need more speed for a short period of time.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 30 2019 12:57am
by kdog
Hi KT gurus
Before I destroy another kt controller :( I thought I'd ask first this time!!
The output on the controller that is at battery voltage, I'm assuming it is for lights. Is this regulated at all? Am I safe to chuck in any old led (rated for 6-60v) front and rear combo or do I have to worry about current draw etc
Thanks in advance

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 30 2019 1:39am
by Nixunen
kdog wrote:
Jun 30 2019 12:57am
Hi KT gurus
Before I destroy another kt controller :( I thought I'd ask first this time!!
The output on the controller that is at battery voltage, I'm assuming it is for lights. Is this regulated at all? Am I safe to chuck in any old led (rated for 6-60v) front and rear combo or do I have to worry about current draw etc
Thanks in advance
Kt controllers light output (that output which can control on-off using display etc) has battery voltage, like you say, but current you can draw only 100mA so in 52v it is only 5.2W. I simply use that output to control relay, so i can use any led's / lights after that.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jun 30 2019 3:26am
by kdog
Ah good idea, I'll do that. Cheers

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 20 2019 10:21pm
by mercamg
Hi,

This is my first post so I'm not sure if I'm doing this right.

So, thanks to the efforts of many people on this site I have managed to:
• Convert a square wave controller to sine wave
• Flash it with the OSEC firmware
• Run the BluOsec app
This is all running successfully on a leaf bike 48v, 1000w, hub motor kit. The variable regen function is fantastic since in town I frequently have to slow down for traffic lights and standard bike brakes are not designed for multiple stops from 45 kph!
I have a few outstanding questions on items I don’t understand:
• Cruise control appears to be supported, but it is not clear how it is activated (I cannot find a pin assignment in the code)
• Phase current B – this is measured by the ACS712. It is not clear whether the absolute value of this is important. Does it need to be calibrated or is the firmware just looking at relative values. There is a comment in the code to the effect that for FOC ‘this needs to be regulated to zero’ in which case the absolute value is unimportant. Since the zero current output of the ACS712 sits at VCC/2 I would have expected to find an ADC_value -511 or 512 but I cannot.
In an effort to contribute, I noticed a number of posts saying the BluOsec app frequently crashes. I experienced this as well, but found that moving the HC-05 further away from the controller made a huge difference. It may well be as a result of electromagnetic interference from the switchers.
Also, I have been using my turbo trainer as a dyno to look at currents and voltages under different load conditions via BluOsec logging, current clamp and scope, ammeter, at 5A and 10A battery currents.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 21 2019 4:05am
by stancecoke
mercamg wrote:
Jul 20 2019 10:21pm
• Cruise control appears to be supported, but it is not clear how it is activated (I cannot find a pin assignment in the code)
Casainho implemented the function in the code, but I never set it active. I don't know, if Xnyle has done it. There's no hardware pin for activating, it's automatically activated, if you hold the throttle at a constant value for a certain period of time. It's deactivated by breaking or by turning the throttle.
mercamg wrote:
Jul 20 2019 10:21pm
• Phase current B – this is measured by the ACS712. It is not clear whether the absolute value of this is important. Does it need to be calibrated or is the firmware just looking at relative values. There is a comment in the code to the effect that for FOC ‘this needs to be regulated to zero’ in which case the absolute value is unimportant. Since the zero current output of the ACS712 sits at VCC/2 I would have expected to find an ADC_value -511 or 512 but I cannot.
We are reading the phase B current just with 8 bit resolution, so the FOC algorithm tries to keep the value at 127. We are just looking at the zero crossing, not at the absolute value. The motor current is calculatet from Battery Current / duty cycle internally.

regards
stancecoke

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 22 2019 9:09pm
by mercamg
Thanks that's perfect.
By the way, given the additional switching that's going on, would you expect a sine controller to get hotter than a square wave controller for the same load conditions?

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 23 2019 3:52am
by stancecoke
mercamg wrote:
Jul 22 2019 9:09pm
would you expect a sine controller to get hotter than a square wave controller for the same load conditions?
yes, especially the fact that the pwm is always active, even if the motor is at standstill, the controller gets handwarm even without load. But that's no problem in the normal use of the system.
You can disable PWM at standstill with the experimental option, but we have no feedback, if it causes any problem. There's a certain risk to kill your mosfets with this function.

regards
stancecoke

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 29 2019 4:01am
by flangefrog
I was trying to use this firmware but I get an error when using stm8flash as per this link: https://opensourceebikefirmware.bitbuck ... emory.html
Determine OPT area
Due to its file extension (or lack thereof), "option_bytes_pwm_n_channels_enabled.bin" is considered as RAW BINARY format!
15 bytes at 0x4800... Tries exceeded
Any ideas? I confirmed I'm using the correct connections, tried on a couple of different controllers, tried external power etc. At this point I'm thinking it's most likely an issue with the stlink or stm8flash. Note that I'm using Linux. I don't currently have any Windows PCs around.

BTW I made a simple web app yesterday to interface to stock Kunteng controllers from any mobile/tablet/pc via a HM-10 Bluetooth LE module. In theory it should work with almost any controller/firmware with a few changes. In my case it was not necessary to change any HM-10 module settings or use any extra circuitry. Some here might find it useful. viewtopic.php?f=30&t=95633&p=1484041#p1484041

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 30 2019 12:38am
by stancecoke
flangefrog wrote:
Jul 29 2019 4:01am
Note that I'm using Linux. I don't currently have any Windows PCs around.
Perhaps casainho or Xnyle can give you a hint, I don't use linux.
flangefrog wrote:
Jul 29 2019 4:01am
BTW I made a simple web app yesterday to interface to stock Kunteng controllers from any mobile/tablet/pc via a HM-10 Bluetooth LE module. In theory it should work with almost any controller/firmware with a few changes.
nice work, but can you explain some details. You have to run a local web server on your device, if you want to use it offline? How do you pair the HM10 with your web-application?

I can find the function "connect" in the source code, but nothing happens at my android phone with the chrome browser, if I click the BT-button on the website. :-(

Code: Select all

        function connect() {
            exponentialBackoff(8 /* max retries */ , 1 /* seconds delay */ ,
                function toTry() {
                    time('Connecting to Bluetooth Device... ');
                    document.getElementById("connectBtn").textContent = "bluetooth_searching";
                    return bluetoothDevice.gatt.connect();
                },
                function success(server) {
                    time('Bluetooth Device connected');
                    document.getElementById("connectBtn").textContent = "bluetooth_connected";
                    onConnected(server);
                },
                function fail() {
                    time('Failed to reconnect.');
                    document.getElementById("connectBtn").textContent = "bluetooth";
                });
        }
you can use a high side switch on a GPIO Pin of the HM-10 to switch on/off the controller by the app, I've done this for a Lishui controller:
https://www.pedelecforum.de/forum/index ... dul.45072/

regards
stancecoke

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 30 2019 2:01am
by casainho
flangefrog wrote:
Jul 29 2019 4:01am
I was trying to use this firmware but I get an error when using stm8flash as per this link: https://opensourceebikefirmware.bitbuck ... emory.html
Determine OPT area
Due to its file extension (or lack thereof), "option_bytes_pwm_n_channels_enabled.bin" is considered as RAW BINARY format!
15 bytes at 0x4800... Tries exceeded
Any ideas? I confirmed I'm using the correct connections, tried on a couple of different controllers, tried external power etc. At this point I'm thinking it's most likely an issue with the stlink or stm8flash. Note that I'm using Linux. I don't currently have any Windows PCs around.
Make sure you have permissions to write to device, maybe you need to use sudo??

Another alternative to stm8flash is OpenOCD. I use OpenOCD because it alsoet me debug, which needed for development.

Re: KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW

Posted: Jul 30 2019 2:56am
by flangefrog
stancecoke wrote:
Jul 30 2019 12:38am
flangefrog wrote:
Jul 29 2019 4:01am
BTW I made a simple web app yesterday to interface to stock Kunteng controllers from any mobile/tablet/pc via a HM-10 Bluetooth LE module. In theory it should work with almost any controller/firmware with a few changes.
nice work, but can you explain some details. You have to run a local web server on your device, if you want to use it offline? How do you pair the HM10 with your web-application?
Do you plan to publish the source?

you can use a high side switch on a GPIO Pin of the HM-10 to switch on/off the controller by the app, I've done this for a Lishui controller:
https://www.pedelecforum.de/forum/index ... dul.45072/
No local web servers needed. I will simply use a JavaScript Service Worker. It only requires a few lines of code for a simple offline implementation. The other way it can be done is with the Application Cache but that's now deprecated.

It's even possible to make it add an icon to the home screen on a mobile device and launch the app in a windowless browser (e.g. will seem like any other native app). You might be interested in this site: https://whatwebcando.today/

Bluetooth is done via Web Bluetooth. See Implementation Status for supported platforms and browsers. Note it only supports Bluetooth LE not Bluetooth Classic (although that may be supported in the future through Web Serial). Currently to connect you just click the Bluetooth icon on the header (ux could be better). You should see a Bluetooth device chooser dialog. I haven't implemented any error messages yet so if your device doesn't support Web Bluetooth or Bluetooth is disabled then it won't do anything. You can check in the console (F12) for any messages.

Web Bluetooth with offline support is the same solution I've used for the energy monitor in my signature.

The source is available by right clicking the page and clicking view source or Ctrl+U. Everything is on that single file although the code is not very clean as I just quickly hacked it together.

I did see that post of yours at this link. I didn't have any high side switches/suitable p channel fets on hand though. I'm also not using the ADC for voltage measurement yet.
casainho wrote:
Jul 30 2019 2:01am
flangefrog wrote:
Jul 29 2019 4:01am
I was trying to use this firmware but I get an error when using stm8flash
Make sure you have permissions to write to device, maybe you need to use sudo??

Another alternative to stm8flash is OpenOCD. I use OpenOCD because it alsoet me debug, which needed for development.
Permissions should be fine, I've added the udev rule and also tried using sudo.

I installed OpenOCD 0.10.0 but it seems the scripts for stlink/stm8 weren't compatible with that version. I'll try it again later and post the errors I got.