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

honya96 said:
I can use KTY, they are used mostly in bigger motors,

I've derived the linear approximation coefficients for a KTY84-151 based on the mid values in the datasheet in the relevant temperature range, see picture.

a=1.6
b=-110.4

The calculation will need floating point operations in the code. I hope it will be fast enough.
The error of the linear approximation is acceptable, I think.

regards
stancecoke

 
Where's the X4 pad? I can't find it on my PCB. Also, I would suggest using a 10k NTC. They're the most common type of sensor, are completely passive and used by just about every thermometer out there. Plus they're small and easy to integrate into a motor.
 
1N4001 said:
Where's the X4 pad? I can't find it on my PCB. Also, I would suggest using a 10k NTC. They're the most common type of sensor, are completely passive and used by just about every thermometer out there. Plus they're small and easy to integrate into a motor.

But they are not that good for "in motor use" I think. You can get KTY cheap.. and if you buy motor with sensor allready, it's probably KTY.

@ stancecoke
As I understand It will show 130°C max?
Why not 150?
 
1N4001 said:
Where's the X4 pad? I can't find it on my PCB.
This depends on your board revision. At my controller, you can find it somewhere below the yellow phase wire, see arrow.

fetch.php


1N4001 said:
I would suggest using a 10k NTC.
The characteristic of a NTC is not linear at all, so we would need a third-degree polynomial for an acceptable calibration (takes much processor-time) or a look-up table (takes much memory)

calculation linear approximation coefficients NTC 10k.PNG



honya96 said:
As I understand It will show 130°C max?
Why not 150?

a signed integer on an 8bitter can hold values from -127 to +127.

Code:
B9: motor temperature, can be negative or positive,T(C)=(int8)B8+15,
    if temperature > 120C LCD screen is flashing.
    e.g 0xDA T=-23°C, 0x34 T=67°C

so the highest temperature that can be displayed on the LCD3 is 0x7F+15 = 127+15 = 142°C

I've added the temperature to the display protocol now. I've set the coefficients for a KTY84-151 in the config.h. I can't test it, as I have no LCD3 and no KTY84. The Java Tool is not updated with the new parameters yet, so please don't use it actually.

regards
stancecoke
 
Hi all,

I would like to pair a kt controller with a yamaha pw drive. Would it be possible for the kt controller with/without open source fw to process the output of the Yamaha Torque Sensor?

There is no battery nor display so I would like to use a custom controller with raised voltage to overcome the low assist of Yamaha at higher cadence.

I made a new topic with this:
https://endless-sphere.com/forums/viewtopic.php?f=28&t=95306

Thx In advance
 
fixvid said:
I would like to pair a kt controller with a yamaha pw drive. Would it be possible for the kt controller with/without open source fw to process the output of the Yamaha Torque Sensor?

There is no battery nor display so I would like to use a custom controller with raised voltage to overcome the low assist of Yamaha at higher cadence.
You may have luck since I think Stancecoke have one of that motors and use(??) this firmware on it.
 
casainho said:
Sorry but I can't implement support for KT controllers on LCD3, because of time limitations. But I accept pull requests/contributions from others that want to make support for KT firmware.

Finally my controllers and dev boards arrived. I'm doing a little soldering practice before tackling the controllers and setting up the tool chain to be able to build. Meanwhile I've been studying up on the STM8 and skimming the code in the repo.

I suppose I'll find this out when I build it, but off hand, on the controller and on lcd3/5 how much of the flash and ram are in use? I have some feature ideas than might need more room, so I'm curious. Thanks.
 
casainho said:
fixvid said:
Would it be possible for the kt controller with/without open source fw to process the output of the Yamaha Torque Sensor?
You may have luck since I think Stancecoke have one of that motors and use(??) this firmware on it.

It was not me, but the user mtdr.
There are different generations of torquesensors in the yamaha drives. The older one delivers an linear output 0-5V, that's easy to implement. I don't know the one that mtdr showed, but it has 3 wires so perhaps it's an analogue output also. Perhaps you can check the voltage on the wires of the connector and post a photo of the sensor...

I never got a feedback from mtdr, if the open firmware worked for him finally...

regards
stancecoke
 
stancecoke said:
casainho said:
fixvid said:
Would it be possible for the kt controller with/without open source fw to process the output of the Yamaha Torque Sensor?
You may have luck since I think Stancecoke have one of that motors and use(??) this firmware on it.

It was not me, but the user mtdr.
There are different generations of torquesensors in the yamaha drives. The older one delivers an linear output 0-5V, that's easy to implement. I don't know the one that mtdr showed, but it has 3 wires so perhaps it's an analogue output also. Perhaps you can check the voltage on the wires of the connector and post a photo of the sensor...

I never got a feedback from mtdr, if the open firmware worked for him finally...

regards
stancecoke

Thx, I somehow managed to understand German with Google translate.

From my understanding mtdr did make it work with s06 controller, but he didn't say a word about making it work with the Torque sensor.

Although I didn't buy the bike yet, the torque sensor has 3 wires. I'm somewhat hesitant to buy it if I cannot make to motor run efficiently.
 
2 days ago I did the very first ride with our OpenSource firmware for TSDZ2, which is based on this KT firmware we did develop. That ride of 12kms went very well and because I was late for my Zumba class I hadn't time to be gentle with the motor and I always drove at max assist level/power!! To resume: we should be proud of our hard work!!

Also on LCD3, I implemented a new configuration submenu that just shows some data from the motor controller, like the raw ADC value of throttle and torque sensor, motor speed in ERPS, etc. And with this tests, I decided to remove from the firmware the automatic offset reading from the throttle and torque sensor, because for instance if a user connect a throttle after powering up the system, the motor start fast without any warning and that can be dangerous. Also, user can press that sensors at power up and the calibration will be incorrect and the system will not work well and user will not understand that bad behavior... -- my suggestion is for not using automatic offset reading for that sensors.

[youtube]e8-MfsmI7fo[/youtube]
 
stancecoke said:
I've now updated the Java Tool with the temperature coefficients. Would be nice, if somebody could test it with a LCD3!

regards
stancecoke

Can test it.

Do I need some pull up resistor as you wrote before? I think I removed it.

And then sensor between X4 and GND?

edit: Please add pause in the compiling again.
 
honya96 said:
Can test it.

Thanks! :D

honya96 said:
Do I need some pull up resistor as you wrote before? I think I removed it.

Yes, it has to be 6.6kOhm for the derived calibration factors. You can take any other value e.g. 1k, just tell me, then I can derive the right values for Cal_A and Cal_B easily. It's just one cell in the excel sheet to be changed....

honya96 said:
And then sensor between X4 and GND?

Yes, I emulated the KTY84 with a poti and it worked for the printout in diagnostics mode. You have to disable the diagnostics mode, otherwise the LCD3 will show nothing.

honya96 said:
edit: Please add pause in the compiling again.

done :wink:

regards
stancecoke
 
few months old versions are working.. now I cant flash

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.hex in PROGRAM MEMORY image in computer
(API) ERROR : No such file or directory

C:\BMSBattery_S_controllers_firmware-Master>pause
Press any key to continue . . .
 
have you upgraded to SDCC 3.7.0, already? If not, please do, see tutorial...

regards
stancecoke
 
stancecoke said:
have you upgraded to SDCC 3.7.0, already? If not, please do, see tutorial...

regards
stancecoke

Done, updated java also and waiting for stvd download link.. still not working
 

Attachments

  • log.txt
    4.6 KB · Views: 81
honya96 said:
still not working
OK, there seem to be two problems in the path definition.

1. Please check, if the SDCC.exe (3.7.0) is located in this path

Code:
C:\SDCC\usr\local\bin

If not, please adapt the first line of the Start_Compiling.bat according to your file system.

2. I've now changed the syntax "%~p0\" in the Start_Compiling.bat to "%~dp0" for the right syntax in the path to the cygwin binaries. The old syntax worked for me also, but now it's correct definitely.

I'll add the hint to check the path to the FAQs.

regards
stancecoke
 
stancecoke said:
honya96 said:
still not working
OK, there seem to be two problems in the path definition.

1. Please check, if the SDCC.exe (3.7.0) is located in this path

Code:
C:\SDCC\usr\local\bin

If not, please adapt the first line of the Start_Compiling.bat according to your file system.

2. I've now changed the syntax "%~p0\" in the Start_Compiling.bat to "%~dp0" for the right syntax in the path to the cygwin binaries. The old syntax worked for me also, but now it's correct definitely.

I'll add the hint to check the path to the FAQs.

regards
stancecoke

I've also tried to flash this branch, but seem to be having similar problems to honya96. My SDCC (running 3.7.0) file locations and paths all seem correct.

This is no immediate problem for me but I've attached my cmd dump for info, maybe you could take a look sometime... :)
 
stancecoke said:
I'll add the hint to check the path to the FAQs.

For us, dump users.. you can note the exact version which we have to download, with a screenshot and arrow :lol: in the instructions.

but anyway, its still not working

Thanks for your help :wink:
 
Ah, I see, there is a bug in the constant naming in the config.h created by the java tool, I just fixed it at github.

The working SDCC archive is this:
https://sourceforge.net/projects/stm8-binutils-gdb/files/cygwin/x86_64/release/sdcc/sdcc-3.7.0-1.tar.xz/download

regards
stancecoke
 
stancecoke said:
Ah, I see, there is a bug in the constant naming in the config.h created by the java tool, I just fixed it at github.

The working SDCC archive is this:
https://sourceforge.net/projects/stm8-binutils-gdb/files/cygwin/x86_64/release/sdcc/sdcc-3.7.0-1.tar.xz/download

regards
stancecoke

Success.. now flashes just fine... :D

A quick test seems to show I have no motor response to throttle or pas input, tried all four ride modes. Not sure if my config.h is good, have attached below.
 
It works!

https://drive.google.com/file/d/1i8cYBSM0-NKS4t2fKt6PXJLWFm5Ouxpq/view?usp=drivesdk

Tested with pot. I don't have the 6.6k resistor but by my rough calculation it may be showing correctly....

I like the flashing when too high, but I'll apreciate more then 127 positive, negative can be way less.

But I don't know the problematics behind it.

Haven't tested anything else, I have to solder in some mosfets first :lol:
 
geofft said:
Success.. now flashes just fine... :D

fine! :D

geofft said:
A quick test seems to show I have no motor response to throttle or pas input, tried all four ride modes.

The config.h seems to be OK, make sure that your battery has more then 42,5V.

To be near my default debug settings, that are proofed to be working, please try with settings "external speed sensor" and "throttle" and set the "motor specific angle" to 214. The 238 are specific for the BionX IGH3.

If all of this doesn't lead to success, I fear, you have to swap the phase- and hall-wires by trial and error, it might be different to casainhos fork.

It would be great, if you could use a bluetooth module or USB-UART converter to plot the data in diagnostics mode, it would be much easier to find the fault then. :shock:


honya96 said:
It works!
8)

regards
stancecoke
 
stancecoke said:
The config.h seems to be OK, make sure that your battery has more then 42,5V.

To be near my default debug settings, that are proofed to be working, please try with settings "external speed sensor" and "throttle" and set the "motor specific angle" to 214. The 238 are specific for the BionX IGH3.

If all of this doesn't lead to success, I fear, you have to swap the phase- and hall-wires by trial and error, it might be different to casainhos fork.

None of those things seem to work.
I don't think it's motor or hall phase, there's not even a kick or any sign of activity from the motor...
I'm noticing that the 'build' phase of the flash proceedure is now very short, just a few seconds - doesn't look right. Take a look below, see what you think...
 

Attachments

  • cmd dump 190718(2).txt
    2.8 KB · Views: 49
please rename the firmware folder and avoid parenthesize! See here:
https://www.avrfreaks.net/forum/make-interruptexception-caught-code-0xc00000fd-addr

regards
stancecoke
 
Back
Top