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

20170602149641168359316e23d2087.jpg

The latest connected wires,but it fail to rotate too. The power supply volatage is adjusted to 24V.
 
KingQueenWong said:


The latest connected wires,but it fail to rotate too. The power supply volatage is adjusted to 24V.
But are you trying to run the original controller, with the original firmware or trying my OpenSource firmware?
 
I am trying to run the original controller,next i will try your firmware,finally i will change your firmware.
 
KingQueenWong said:
I am trying to run the original controller,next i will try your firmware,finally i will change your firmware.
Good plan!! :)

I see that you are not using the LCD -- I bought the LCD and is useful as it shows some error code and motor do not runs. What I know for my case:
- need to connect the hall sensors, without that motor will not run and LC will show an error
-- seems you are shunting that wires to avoid using the LCD
- I use the throttle, never tested with PAS

If you can't make it working, maybe it is faster to flash the firmware!! The instructions:
- wire first the STLinkV2 and explained here: https://opensourceebikefirmware.bitbucket.io/Development_tools--Flash_and_debug_connector_on_S_Series_controller.html

- install the usual development software, at least to build the firmware and flash it using "stm8flash"
-- https://opensourceebikefirmware.bitbucket.io/Development_tools--Debug_OpenOCD_and_Eclipse--stm8-binutils-gdb.html
-- https://opensourceebikefirmware.bitbucket.io/Development_tools--Flash_programming.html

- Unlock the memory (just need to make first time):
echo "00 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > factory_defaults.bin
stm8flash -c stlinkv2 -p stm8s105?6 -s opt -w factory_defaults.bin
-- more info: https://opensourceebikefirmware.bitbucket.io/Various--How_to_unlock_proteced_read_memory.html

- Get the firmware, build it, flash it and profit: https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware (master branch, on the commit with log: Motor now runs with 6 steps. Also break coast the motor)
 
Maybe you are right,i try to hack the controller's schematic.

Type Component Package Publisher
Mosfet: TK150E09NE (TO-220AB) Toshiba
Current Sensor: ACS711 (QFN) Allegro
LDO: LM317 (TO-220) ST
MCU: STM8S105C6T6 (LQFP48) ST
Operational Amplifier: LM358 (SO8) ST
 

Attachments

  • 201706031496470531593254039329f.jpg
    201706031496470531593254039329f.jpg
    238.7 KB · Views: 7,520
  • 201706031496470758593254e6ecba5.jpg
    201706031496470758593254e6ecba5.jpg
    148.8 KB · Views: 7,520
  • 201706031496471031593255f72df98.jpg
    201706031496471031593255f72df98.jpg
    247.4 KB · Views: 7,518
  • 201706031496470945593255a15054a.jpg
    201706031496470945593255a15054a.jpg
    118.6 KB · Views: 7,520
  • elschema_kathmandu - 01 - Main circuit - Rev B-Model.pdf
    139.5 KB · Views: 583
KingQueenWong said:
Maybe you are right,i try to hack the controller's schematic.

Please reuse all th information I already got, like the pins that goes to microcontroller: https://opensourceebikefirmware.bitbucket.io/Controllers--BMSBattery_S06x--S06S.html

And I will complement my notes with the information you just shared!! :)
 
One note: the metal case can be open just on the top side!! this is great for keep the controller open for development/testing and still have the needed heat sink working!! Also for the complete assembly.
 
I am trying to draw the s06s controller's schematic. :)
 

Attachments

  • 2017060414965605115933b37fe8ee0.jpg
    2017060414965605115933b37fe8ee0.jpg
    322.1 KB · Views: 7,500
  • S06S-Controller.PDF
    517.4 KB · Views: 585
KingQueenWong said:
I am trying to draw the s06s controller's schematic. :)

That's great!!!! I would like to the the source files for the schematic on your GitHub ;) even better if was designed with KiCad because is OpenSource.

There is one issue I have: my board with my firmware just works when I have the STLinkV2 connected and powered. Seems it controls the reset line of the STM8. Can you please look to this part of schematic and see what the hardware does for reset line???
 
001.jpg

The NRST pin just connect a 100K pull up Resistor to 5V and a 0.1uf Capacitor to GND.
The SWIM pin just connect a 10K pull up Resistor to 5V.
 
KingQueenWong said:


The NRST pin just connect a 100K pull up Resistor to 5V and a 0.1uf Capacitor t0 GND.
The SWIM pin just connect a 10K pull up Resistor to 5V.
Thanks. Seems it is ok. I don't know if there is any special flag on configuration bits of STM8S105 that can cause this behavior I did refer...

I just added you to https://github.com/OpenSource-EBike-firmware so you can put your repo there, if you prefer. Also for future firmware development.

When you have the schematic finalized, please tell me so I can put it on the notes file!!! :)
 
Found a bug on firmware and finally I implemented the firmware that does 4 quadrant bipolar PWM and tested it on an electric unicycle motor. I know this motor and I am having this one as a comparison with Q85 motor. When I decelerate, the motor regen and the power supply voltage increases as it is supposed. Unlike my latest tries when the firmware had a bug and with Q85 motor, the power supply voltage do no increase when I accelerate the motor nor the motor asks to much current -- it is running very well.
I didn't tested yet this firmware of Q85 motor.

[youtube]Q_nsoUYa6iA[/youtube]
 
Good Procedures!
1.Disconnect the ST-link's wires(includes GND,5V,SWIM,NRST) to s06s board,it can solve the problem that firmware run unsuccessfully.
2.The wires needs to be inserted deeper.(The last days,I just insert half of depth :( )
20170606149674668359368abb04214.jpg
 
Another experiment, the same firmware and controller as on the last video but this time with that Q85 Ebike motor, which is very small, light and less powerful (200W) when compared to the EUC motor. And this motor runs bad, with noise, asking a lot of current (motor heats)!!

And why so different this motor VS the EUC motor??
I think the main different is that this small and light motor have much less coils inductance and resistance:

http://www.diyelectriccar.com/forums/showthread.php/bldc-controllers-suitable-very-low-inductance-76770.html
There are many low inductance motors around these days. By low I mean 5μH and lower. These are coreless or compact outrunners.
The problem is that the inductance is so low, that it is unable to integrate the PWM and current ripple blows the controller or overheats a motor. Or significantly lowers motor's maximum useful current at least.

Seems that this low inductance motors are more hard/expensive to control... and seems that one way is to lower the voltage supply to minimum so the current peaks will be lower... but on EUC motor can be different and that is also one reason for them to have high voltage supply??
I will keep thinking if there is a way to improve the current way to control this motor...

[youtube]3RyFWzoS6g0[/youtube]
 
I finished the 4Q bipolar PWM with motor current control and I think is the most advanced PWM scheme I know. Although motor max current is controlled, the motor makes noise, don't rotate so quick as original firmware and also the mosfets do heat a lot.
Took me a lot of time to develop this firmware and I had to make some code with bit shifting operations because processing power is very limited. At some time, I could not make a division of a uint32_t and had to make a workaround...

Current motor control schemes:
- 6 steps: works very well but should not work for regen/breaking. The code is on this branch:
https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/tree/6_steps

- 4Q bipolar PWM SVM: most advanced PWM scheme that should work for regen/breaking. Includes max motor current control. The code is on this branch:
https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/tree/SVM

I will now try to replicate the original PWM scheme as it do not heat the mosfets, should work for regen/breaking BUT makes more noise than 6 step WPM scheme. The code will be on this branch:
https://github.com/OpenSource-EBike-firmware/BMSBattery_S_controllers_firmware/tree/original_sinewave
 
KingQueenWong said:
I am trying to draw the s06s controller's schematic. :)
Seems that you did finish the schematic, which is great!! Can you please push to github and export to PDF and PNG file??
 
What is the signal "LEARN"?? I didn't found a documentation for the black and blue wires on the S controller...

I can't understand the signal "AN8"... is that the inverted of "OC" signal?? Can you please explain??
 
I have updated the schematic.I am sure the schematic is correct.
I am not sure that the "BLUE" and "BLACK" whether LEARN or not(It seem that the old version s06s board have this function).
The LM358's two channel operational amplifiers seem that both just for measures current(only over current?).

View attachment 1
 

Attachments

  • S06S-Controller.PDF
    600.6 KB · Views: 378
Thanks for the schematic!! I just added to my notes here: https://opensourceebikefirmware.bitbucket.io/Controllers--BMSBattery_S06x--S06S.html
 
Nice to see someone taking care of the cheap stuff from the land of china.
Been reading along on ES/vedder/esk8 and you really seem to be serious about the open source.
Big thumbs up! I really hope some hassle free firmware useable for people that know nothing about FOC and sh*t will grow out of the effort taken. Yes, it will never be on the same level as VESC, BUT it will take 13S for sure without any magic smoke - and IF it smokes it does cost only a little.

So, this is the sine wave controller I have inside my bike:
https://endless-sphere.com/forums/download/file.php?id=178595&mode=view
Its taken from the bottle battery from BMS Battery and I modified it to take XT90 input
from my homemade 13S5P 18650 instead.

I've got a second of these laying around which will power the front wheel soon and
I am very willing to flash some custom firmware that would allow to sync them in a way
that will stop the front wheel from spinning free in case its lifted. Any other kind of
improvement is for sure welcome as well. Will solder anything beside SMD.

I chose these controllers as they come with the nice waterproof plugs.
I question myself how close they are to the "boxed" BMS battery sine wave controllers.
I can shoot some better close up of the circuits if needed.

Here is a link to the original (incomplete) build tread:

https://endless-sphere.com/forums/viewtopic.php?f=2&t=71810

Best wishes for your investigation!
 
MisterMint said:
Nice to see someone taking care of the cheap stuff from the land of china.
Thank you for your words. Talking by myself, I would like to give some love to this cheap and widely available EBike motor controller and technology. Even if we don't get a better firmware than original, at least sharing knowledge about them is important for repair and modding/hacking.

Your controller, seems to me, that is equal to S06x. I think you can consider S06x schematic: https://opensourceebikefirmware.bitbucket.io/Controllers--BMSBattery_S06x--S06S.html#h1-1

I put your pictures on the documentation page - thanks: https://opensourceebikefirmware.bitbucket.io/Controllers--BMSBattery_bottle_battery_controller.html
 
I asked to a moderator, Alan B (that was very helpful), to moved this thread from "Electric Bicycles ‹ E-Bike Technical" to "Electric Vehicle Technology ‹ Motor Technology" as this last one seems where the discussion about other motor controllers happen, even the user developed ones.
 
Ok I got the 4 quadrant bipolar PWM and tested it on the Q85 motor. Seems very near the performance of original firmware.

Next step should be limit max current and try to put current at +90º of hall sensors signal. The idea is to have a god and robust motor control firmware.

[youtube]I9drsvp3GKA[/youtube]
 
Back
Top