TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

554226203 said:
tomtom50 said:
554226203 said:
Thanks for the contribution, I don't know English, so I use Google Translate, I would like to ask, I have a 350w 36v tsd z2 xh18, if I brush the firmware, can I have more power and speed?
You can increase power two ways:

1. Increase the allowed amperage in the manufacturer firmware.
2. Install the open source firmware and set a higher power level. This is harder and you need to wire in a different display. (KT-LCD3).

350W at 36V is 9.7 amperes. You can overheat your motor if you use many more amperes for long time.

At 36V 350W is safe. 550W (15A) is OK for 5 - 10 minutes to climb a hill. 550W to go fast for a long time might overheat your motor.

Thank you for your reply, then please, how can I do the first solution?


read here
https://www.eco-ebike.com/blogs/eco-cycles-instructionals/tsdz2programmingfromscratch
 
More on the high backward resistance with the motor on ...
thineight said:
After this, i guess the only major bug left to solve is the backwards resistance. :thumb:
casainho said:
thineight said:
Any idea about the backward resistance possible solution I wrote 2 posts ago?
For backward resistance, I would implement detection of pedals rotating backwards.
jbalat said:
Firstly let me say version 16 is really cool - Love it, great work !!!!! :bigthumb:

In summary the only updates it needs is.
1. walk mode
2. no resistance backwards
3. cadence display - What happened to this, is it gone ???
4. Long keypress to fast cycle button clicks - I too got stuck doing like 100000000000 keypresses because default values are for 48v :)

I am happy to report that version 18.2 with its "no throttle mode" works great for coaster brake motors. However, the above listed backward resistance issue turns out to be a show stopper for coaster brake versions of the motor.

I did not realize how massive this backward resistance is until we got the software working on a coaster brake motor on a hand-cycle. The resistance is so high when you try to pedal backward that it feels like you are applying the coaster brake before the coaster brake even kicks in. With only arm power on a hand-cycle, it is impossible to overcome the resistance when you want to brake.

Apparently, the high backward resistance is only an issue on regular (non-coaster brake) motors when you push the bike backward because the motor freewheels at the cranks. The coaster brake version of the motor does not freewheel at the cranks so it is also an issue whenever you pedal backward.

I hope there is a solution for this as this is the only mid-drive motor that supports coaster brakes. This is crucial on hand-cycles for riders who do not have the use of their hands for braking. The Flexible Open Source Firmware is otherwise perfect for handcycles because the torque sensitivity can be adjusted according to the strength of the rider.
 
This is a historic mark:

Time to time I get some donations, which I am being using to buy resources for my investigations and developments. I have not been grateful publicly or privately the donations because I have so little time that is not enough for the developments that are needed to be done.

This days I got a donnation with the following message:
Sold a few FOS firmware products on my Website http://www.electrifybike.com/store/c37/TSDZ2_Flexible_Open_Source_Firmware_Products.html I will be contributing 10% of sales to the developers for a period of time.

I am spreading this because this shop because other than being friendly for the developent of our OpenSource firmware for TSDZ2 (that can be applied for other ebike motor controllers, or any BLDC motor controller), this shops sells the needed TSDZ2 and LCD3 already programmed with our firmware and connections!!!
I will link to this shop on wiki as this may be very important for some users!!



https://www.electrifybike.com/store/c37/TSDZ2_Flexible_Open_Source_Firmware_Products.html#/
 
zappan said:
I hope there is a solution for this as this is the only mid-drive motor that supports coaster brakes. This is crucial on hand-cycles for riders who do not have the use of their hands for braking. The Flexible Open Source Firmware is otherwise perfect for handcycles because the torque sensitivity can be adjusted according to the strength of the rider.

That's quite easy to implement in the ebike_app.c, just disable the PWM if erps = 0 and no power wanted:

Code:
if(erps == 0 && battery_target_current == 0)TIM1_CtrlPWMOutputs(DISABLE);

and enable PWM again, if power is wanted:

Code:
if(erps == 0 && battery_target_current != 0)TIM1_CtrlPWMOutputs(ENABLE);

regards
stancecoke
 
Rydon said:
I did not realize how massive this backward resistance is until we got the software working on a coaster brake motor on a hand-cycle. The resistance is so high when you try to pedal backward that it feels like you are applying the coaster brake before the coaster brake even kicks in. With only arm power on a hand-cycle, it is impossible to overcome the resistance when you want to brake.

Apparently, the high backward resistance is only an issue on regular (non-coaster brake) motors when you push the bike backward because the motor freewheels at the cranks. The coaster brake version of the motor does not freewheel at the cranks so it is also an issue whenever you pedal backward.

I hope there is a solution for this as this is the only mid-drive motor that supports coaster brakes. This is crucial on hand-cycles for riders who do not have the use of their hands for braking. The Flexible Open Source Firmware is otherwise perfect for handcycles because the torque sensitivity can be adjusted according to the strength of the rider.
So, TSDZ2 main gear on the coaster brake does not have a clutch??

I wounder if when rider backpedals to brake, if it is possible the motor to keep rotate a bit on forward... I mean, how fast is the reaction of the rider to brake?? does the original firmware immediately stops the motor and free it?? Can you feel any kind of delay??

For my experience (and can you please test this?? looking at LCD3 torque sensor value), when backpedaling the torque sensor detects force as if it is a forward pedaling. Can someone please verify this on LCD3??
If so, I guess the only way to detect backpedaling is by looking at the PAS signal...

stancecoke said:
zappan said:
I hope there is a solution for this as this is the only mid-drive motor that supports coaster brakes. This is crucial on hand-cycles for riders who do not have the use of their hands for braking. The Flexible Open Source Firmware is otherwise perfect for handcycles because the torque sensitivity can be adjusted according to the strength of the rider.

That's quite easy to implement in the ebike_app.c, just disable the PWM if erps = 0 and no power wanted:

Code:
if(erps == 0 && battery_target_current == 0)TIM1_CtrlPWMOutputs(DISABLE);

and enable PWM again, if power is wanted:

Code:
if(erps == 0 && battery_target_current != 0)TIM1_CtrlPWMOutputs(ENABLE);
Thanks!!

Do you ever did this when erps > 0?? because I wonder if waiting for motor stop will cause a delay...

And on TSDZ2 original firmware that we did disassembly, I recall to see disabling PWM by disabling ONLY the 3 high side mosfets and keep always the 3 low side enabled. I must check this again.
 
Rydon said:
More on the high backward resistance with the motor on ...

Apparently, the high backward resistance is only an issue on regular (non-coaster brake) motors when you push the bike backward because the motor freewheels at the cranks. The coaster brake version of the motor does not freewheel at the cranks so it is also an issue whenever you pedal backward.
There's a fairly constant 5w of power being consumed as soon as the KT display is switched on (0.103 amps) which, when the bike is pushed backwards, fluctuates towards zero as if the motor is now a generator.
 
I have just converted to the new firmware a 6pin 48V 750W(new version) and an 8pin 36V 350W (quite old, 2015, and like a bag of nails) and it is awesome. The old 36v motor hasn't quite been turned into a silk purse from a sow's ear but nearly.

This was really worthwhile doing and congratulations to casainho and his many helpers for doing this. It converts that motor from something tediously grudging when required to do something into a truly sparkling performer.
 
James Broadhurst said:
when the bike is pushed backwards, fluctuates towards zero as if the motor is now a generator.

you are right in principle, but the motor control algorithm does not know a reverse running rotor. If the hall sensor-state says "recent rotorposition is 60°" the software assumes, that the next hall-based position signal will be 120° and it interpolates the rotor position and the according PWM pattern from 60° to 120°. But of course the next hall-position (and true rotorposition) will be 0° when pushing the bike backward. So the PWM pattern is not synced with the rotorposition and this will cause bad current peaks and high pushing resistance...

casainho said:
Do you ever did this when erps > 0??
Yes, with the BionX direct drive. Disabling with turning motor is no problem, but enabling with turning rotor is difficult, as you have to predict the right dutycycle for the recent rotor speed to avoid current peaks. (See the experimental implementation in the Kunteng-Master)

regards
stancecoke
 
stancecoke said:
Yes, with the BionX direct drive. Disabling with turning motor is no problem, but enabling with turning rotor is difficult, as you have to predict the right dutycycle for the recent rotor speed to avoid current peaks. (See the experimental implementation in the Kunteng-Master)
Thanks!!
Have you ever tried what you once told me: "let the current controller handle it". I mean, when the current increase we increase duty-cycle up to min current value.

Anyway, we have only 2 different motors and we know their BEMF constant, rate with erps: 48V motor --> 48v / 4000 rpm. The user already identifies the motor voltage on LCD3, because of FOC algorithm calculations and so we add the parameters for the BEMF constant.

Let's see if all this work.
 
Rydon, I have a different idea if what can be happening. Please help to test/validate this ideas.

So you are reporting for when users use the coast brake TSDZ2 version, that is a direct drive motor (has no clutch like TSDZ2 regular version).

Since I remember for my very little experience with coast brakes, to brake, user needs very little amplitude of movement of back pedaling. I really think it is not enough to get almost any regen current. I have another theory:

When we pedal forward or backward, our firmware was not developed to detect the backward pedaling because that is not a need for most of us that uses a regular TSDZ2 and has the clutch to avoid the back pedaling.

On coast version TSDZ2, the torque sensor detects pedal torque for both pedal directions. Also, the pedal cadence is calculated for both directions. Guess what?? When you pedal backwards, you get motor assistance and in this case, it assist you against your movement direction!! The harder you pedal, the harder more motor assistance you get against you!! Does this make sense?? If so, please validate this by looking at PWM value on LCD3 that increase when motor assistance increase!! Please see if the PWM increases when you back pedal.

At assist level 0, even if you back pedal, the PWM value is always 0. Try that way and see if that works ok because if so, we just need to detect cadence in backward direction and stop motor assistance on that situation.

Rydon said:
More on the high backward resistance with the motor on ...
thineight said:
After this, i guess the only major bug left to solve is the backwards resistance. :thumb:
casainho said:
thineight said:
Any idea about the backward resistance possible solution I wrote 2 posts ago?
For backward resistance, I would implement detection of pedals rotating backwards.
jbalat said:
Firstly let me say version 16 is really cool - Love it, great work !!!!! :bigthumb:

In summary the only updates it needs is.
1. walk mode
2. no resistance backwards
3. cadence display - What happened to this, is it gone ???
4. Long keypress to fast cycle button clicks - I too got stuck doing like 100000000000 keypresses because default values are for 48v :)

I am happy to report that version 18.2 with its "no throttle mode" works great for coaster brake motors. However, the above listed backward resistance issue turns out to be a show stopper for coaster brake versions of the motor.

I did not realize how massive this backward resistance is until we got the software working on a coaster brake motor on a hand-cycle. The resistance is so high when you try to pedal backward that it feels like you are applying the coaster brake before the coaster brake even kicks in. With only arm power on a hand-cycle, it is impossible to overcome the resistance when you want to brake.

Apparently, the high backward resistance is only an issue on regular (non-coaster brake) motors when you push the bike backward because the motor freewheels at the cranks. The coaster brake version of the motor does not freewheel at the cranks so it is also an issue whenever you pedal backward.

I hope there is a solution for this as this is the only mid-drive motor that supports coaster brakes. This is crucial on hand-cycles for riders who do not have the use of their hands for braking. The Flexible Open Source Firmware is otherwise perfect for handcycles because the torque sensitivity can be adjusted according to the strength of the rider.
 
casainho said:
Have you ever tried what you once told me: "let the current controller handle it". I mean, when the current increase we increase duty-cycle up to min current value.

Yes, of course, that's the normal way, the Kunteng Master branch handles "active freewheeling" for direct drives. But that's only working, if the motor runs in forward direction. As I wrote before, if you are pushing in reverse, this can't work. With a gearless direct drive it doesn't matter as you will not reach the erps where the software switches to 60° interpolation. With a geared motor, you will reach the switch level easily with pushing the bike backwards (depending on your settings). If the software raises the dutycycle because of the missing direction detection and a positive torque signal, it's even worse of course :shock:

regards
stancecoke
 
So I went to test the resistance when pushing my bicycle backwards. I need to put in gears that result in most rotation possible of the pedal crank, that means more torque and more cadence!!

If I keep the TSDZ2 turned off, the resistance is like none, just the one from the mechanical system rotating.

If turn on TSDZ2 but keep assist level at 0, I get high resistance when pushing backwards. This should be the regen happening.

Then, If I put assist level at 1, I keep getting the resistance.

Then If I put assist level at something like 5 or 9, I not only get high resistance and soon I get bicycle moving forward in a strong and fast way (dangerous!!).

So seems we the 2 things here when we push backwards: motor assist power applied AND regen current.

I think I will start on the most easy part to do that is detecting backward pedaling using the pedals cadence sensor and put assist level at 0 at that situation.
 
Hello, everyone,
I need to convert a 6 pin motor side cable to a programming cable,
for that I would need to know the colors (or function) of the wires of the wheel speed sensor corresponding to these numbers, and especially the colors purple (RST), orange (GND), black (SWIM), brown (VCC):

cofNeCC.jpg


Could someone with a programming cable help me?
Thanks !
 
casainho said:
So, TSDZ2 main gear on the coaster brake does not have a clutch??

I wounder if when rider backpedals to brake, if it is possible the motor to keep rotate a bit on forward... I mean, how fast is the reaction of the rider to brake?? does the original firmware immediately stops the motor and free it?? Can you feel any kind of delay??

That is correct. The coaster brake motor does not have a clutch. It does not freewheel at the cranks.

The OEM firmware stops immediately when you stop pedaling with no delay. This is only true of coaster brake motor with controller for coaster brake motor. I put a regular (non-coaster brake) controller with OEM firmware on a coaster brake motor and it had a delay. When you stop pedaling, the pedals rotate forward for a fraction of a second, about 1/8 of a rotation. The FOS firmware seems to also have this delay but not quite as much.

casainho said:
Rydon, I have a different idea if what can be happening. Please help to test/validate this ideas.

So you are reporting for when users use the coast brake TSDZ2 version, that is a direct drive motor (has no clutch like TSDZ2 regular version).

Since I remember for my very little experience with coast brakes, to brake, user needs very little amplitude of movement of back pedaling. I really think it is not enough to get almost any regen current. I have another theory:

When we pedal forward or backward, our firmware was not developed to detect the backward pedaling because that is not a need for most of us that uses a regular TSDZ2 and has the clutch to avoid the back pedaling.

On coast version TSDZ2, the torque sensor detects pedal torque for both pedal directions. Also, the pedal cadence is calculated for both directions. Guess what?? When you pedal backwards, you get motor assistance and in this case, it assist you against your movement direction!! The harder you pedal, the harder more motor assistance you get against you!! Does this make sense?? If so, please validate this by looking at PWM value on LCD3 that increase when motor assistance increase!! Please see if the PWM increases when you back pedal.

At assist level 0, even if you back pedal, the PWM value is always 0. Try that way and see if that works ok because if so, we just need to detect cadence in backward direction and stop motor assistance on that situation.

Ok, we tested the coaster brake in assist level 0. It had heavy resistance pedaling backward similar to the other assist levels. I do not have the bike in the shop but will have it tomorrow and will run more tests for PWM and torque sensor readings pedaling backward. Let me know if you need me to test anything else as I will only have it for a few hours.
 
NIPSEN said:
Hello, everyone,
I need to convert a 6 pin motor side cable to a programming cable,
for that I would need to know the colors (or function) of the wires of the wheel speed sensor corresponding to these numbers, and especially the colors purple (RST), orange (GND), black (SWIM), brown (VCC):

cofNeCC.jpg


Could someone with a programming cable help me?
Thanks !

This picture answers your question. You can find it on github with the pin descriptions here: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Wire-KT-LCD3-to-TSDZ2


 
Rydon said:
Ok, we tested the coaster brake in assist level 0. It had heavy resistance pedaling backward similar to the other assist levels. I do not have the bike in the shop but will have it tomorrow and will run more tests for PWM and torque sensor readings pedaling backward. Let me know if you need me to test anything else as I will only have it for a few hours.
For now I can simulate your issue with pushing my bicycle backwards.

I wonder if the controller is different and has no low pass filter on the throttle signal. You may remember the video I recorded about 1 year ago showing a graph in real time on troque sensor signal, we can see there the delay because of the low pass filter.

Maybe you could look at the LCD3 torque sensor values and check if you see less delay on the torque sensor signal at increase/decrease?? Like when quick pull the pedals and push??
 
Rydon said:
NIPSEN said:
Hello, everyone,
I need to convert a 6 pin motor side cable to a programming cable,
for that I would need to know the colors (or function) of the wires of the wheel speed sensor corresponding to these numbers, and especially the colors purple (RST), orange (GND), black (SWIM), brown (VCC):

cofNeCC.jpg


Could someone with a programming cable help me?
Thanks !

This picture answers your question. You can find it on github with the pin descriptions here: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Wire-KT-LCD3-to-TSDZ2


tsdz2-plug.jpg

Hello, i think this picture is from the 6 pins LCD side, not from wheel speed sensor.
 
ri53hu said:
nipsen cheat here on the post. https://github.com/hurzhurz/tsdz2/blob/master/programming.md

This picture is from LCD side 6 pins, are you sure that it is the same with wheel speed sensor side ?

stlink-connection.jpg
 
NIPSEN said:
Hello, i think this picture is from the 6 pins LCD side, not from wheel speed sensor.

The picture is for both. The wiring charts and signals are different but the wire colors to pin mappings are the same. Most speed sensor connectors are black like the display connectors. Yours is yellow. If you still doubt just meter it out. :)
 
buba said:
Okay, anyone want to test out the 0.19.0 beta 1? :wink:

Here is a link to the hex file for the KT-LCD3:
https://drive.google.com/open?id=1kgcgkNtmCiIDREVW_bBf5ekDKftLnotw

Here is a link to the wiki:
https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Features-and-configurations-for-version-0.19.X-(BETA)

Here are some changes:

* Added a new sub field in the odometer field temporarily called Energy where user will see energy consumption and estimated range

* Added a function that measures and calculates consumed watt-hours per traveled distance since power on

* Added a function that estimates range since power on depending on how much capacity is left

* More accurate watt-hour measurement, do not forget to update the capacity of your battery

* More accurate time measurement

* Safer Walk Assist and Cruise

* Added option to enable or disable motor power limit quick-set-menu in the main screen

* Added option to set motor power limit in the configuration menu

* Merged previous configuration menu LCD Setup with configuration menu General Setup for better and faster setup. This also optimizes program size, see the wiki for more information

* Added option that enables user to enable or disable display of motor temperature in the odometer field

* Changed order in the Main Screen Setup menu in the configuration menu

* Changed order in the odometer field

* Added two new Main Screen Setup items

* Heavily optimized code size and speed, also cleaned up code and comments

I am testing version-0.19.1-(BETA) but the wiki menu numbers don't seam to be right has this changed?

I have 11 menu's but the list of menu's in the wiki...

https://github.com/OpenSource-EBike...-and-configurations-for-version-0.19.X-(BETA)

..show just 10 menu levels Now?

Looking at the revisions it apears the motor options have moved from menu 10 to menu 8? and menu 10 has been removed/ replaced with advanced menu 11? Is there a later Beta that uses this menu layout thats documented in the Wiki?
 
casainho said:
Rydon said:
Ok, we tested the coaster brake in assist level 0. It had heavy resistance pedaling backward similar to the other assist levels. I do not have the bike in the shop but will have it tomorrow and will run more tests for PWM and torque sensor readings pedaling backward. Let me know if you need me to test anything else as I will only have it for a few hours.
For now I can simulate your issue with pushing my bicycle backwards.

I wonder if the controller is different and has no low pass filter on the throttle signal. You may remember the video I recorded about 1 year ago showing a graph in real time on troque sensor signal, we can see there the delay because of the low pass filter.

Maybe you could look at the LCD3 torque sensor values and check if you see less delay on the torque sensor signal at increase/decrease?? Like when quick pull the pedals and push??

Had a few days bad weather so just did the testing. The torque sensing on a coaster brake motor has the same low pass filter delay as the regular motors. No difference that I could tell looking at the values on the LCD3 while applying torque. One thing that was readily apparent though is that there is no torque reading on the LCD3 display in the reverse direction. Maybe when torque goes to 0 it can be used to cut off the resistance.
 
Rydon said:
Had a few days bad weather so just did the testing. The torque sensing on a coaster brake motor has the same low pass filter delay as the regular motors. No difference that I could tell looking at the values on the LCD3 while applying torque. One thing that was readily apparent though is that there is no torque reading on the LCD3 display in the reverse direction. Maybe when torque goes to 0 it can be used to cut off the resistance.
Nice to know there apparently is no different on the throttle circuit.

Well, at regular motor, I could see torque sensor values go high when pushing bicycle backwards and sometimes the value start to go lower than the resting value.

I am looking at our current code and it does already put cadence at 0 when we back pedal. However, since I have the configuration "Motor assistance startup without pedal rotation = 1", the motor starts with torque sensor signal only and no need of cadence value.

I am looking to test the variable ui8_pedaling_forward and only give motor assist when it is ui8_pedaling_forward = 1.

I want also to make more robust the count on time between PAS pulses, to make sure that cadence is only calculated after we have at least 2 sequential PAS pulse in the same direction, this way we will avoid erroneous high cadence value when considering the very first time of the very first pulse.

TSDZ2 PAS has 20 magnets and 2 PAS sensors, phased out. Other PAS I used on KT motor controllers only had 1 sensor and much less magnets (like 6 or 8 magnets), this means on TSDZ2 we have like more x8 resolution/faster detection of stop and inverse direction. I really hope all this means and can fast detect stop pedaling and reverse and cut the motor power.
 
Back
Top