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

I changed the firmware for this new values:
- motor max current of 30 amps
- battery max current of 20 amps (note that on original firmware this max value is 16 amps)

BUT please note this: the limit of max battery current on original firmware is 16 amps!! - I will put this information on the wiki but let users choose a higher value and so melt their motors faster if they choose to do so.
 
izeman said:
Buster84 said:
Hi,
New to the forum and ebikes. I tried to find information if the 500w TSDZ2-motor with the 850C display can be restricted to a lower power level like 250w? In my country You will need a traffic license for motors over 250w. During my daily commutes more power probably won't be needed.
You don't say what country you're from. But most probably your country does NOT restrict MAXIMUM power but CONTINOUS power. And continous power is not easily changeable. So it basically is a matter of definition from the manufacturer. It's based on how much power the motor can take "endlessly" without taking damage.
That's a simplified definition but it's easier to understand that way.
Almost EVERY legal system you can find in eg. Europe must obey to the 250W limit, but still output like 700W boosts. But not for 100% of the time.
So just pust a sticker on your motor saying 250W. Being that super small you should be fine, because basically that is all it can output over infinite time.

EDIT: Sorry. This post wasn't updated in my browser, so I didn't see that this topic already was answered in detail 8)
This makes sense to me and I tested a commercial bicycle from a famous brand, that has the BOOST feature and that was I decided to implement it.

Maybe we can improve BOOST function and let it enabled on street mode -- that would be supper important for users at city to have a BOOST at start like at red lights, and have less disadvantage over motorcycles and cars.
 
elfnino said:
Virtual Throttle is nice to have but I realized it is just too difficult to activate and to slow down or stop in dynamic situations is just too slow and little bit dangerous.
I would much rather prefer to have the Cruise mode from previous versions. In v0.20 it was smooth and safe as well.
Because there weren’t any buttons left to press, cruise was also walk just that you had to be doing >9kph for it to cruise. I never liked it although once the physical throttle became the temperature control, there was something to be said for cruise. Without brake sensors these add-ons become dangerous imho.
 
Casainho,

The actual boost function does not help for red light start because it takes too long to kick in, even with the 8amp/s current ramp. However, the start acceleration from zero speed was solved in Marcoq code using a function call "K soft start". His idea was to smooth the motor acceleration using a K factor of 0.990. However, several user change that factor to a lower value, 0.4 to 0.3, increasing the acceleration ramp for 1 second or less and it makes a huge difference.

I encourage you to take a look at this option.

The parameters in the Java configurator were:

Initial soft start assist value power assistance : 20% by default and always less than the ECO value. The motor starts the initial ramp with this level of assistance
Soft start timeout (1/10 s): we use less than 10, therefore 1 second or less. This is the transition from the initial high ramp to the selected assist level (ECO, TOUR, SPORT, TURBO)
K soft factor: 0.4 to 0.3. The lower the higher power at the start
Here is his code. He imposed the condition of using k soft factor when the boost is disable, which is disable by default.


Code:
		// assist level factor x10 must be greater than zero
  	if(configuration_variables.ui8_assist_level_factor_x10 > 0)
    {
  		// soft start work only if boost is disabled:
			if(configuration_variables.ui8_startup_motor_power_boost_feature_enabled == 0)
			{
				#if CLR_SOFT_START_WHEN_CADENCE_RPM_ZERO
				// when pas cadence rpm is zero
				if(ui8_pas_cadence_rpm == 0)
				{
					// clear soft start factor
					f_soft_start_factor = 0.0;

					// clear soft start factor old
					f_soft_start_factor_old = 0.0;

					// clear soft start time
					ui16_soft_start_time = 0;
				}
				#endif

				#if CLR_SOFT_START_WHEN_SPEED_ZERO
				// when pas cadence rpm is zero and wheel speed lower than 4km/h
				if((ui8_pas_cadence_rpm == 0)&&(ui16_wheel_speed_x10 < 40))
				{
					// clear soft start factor
					f_soft_start_factor = 0.0;

					// clear soft start factor old
					f_soft_start_factor_old = 0.0;

					// clear soft start time
					ui16_soft_start_time = 0;
				}
				#endif

				// verify soft start factor value
				if(f_soft_start_factor < 1.0)	
				{					
					// verify soft_start_time
					if(ui16_soft_start_time++ < SOFT_START_TIMEOUT)
					{
						// pas cadence rpm is greater than threshold pas cadence:
						if(ui8_pas_cadence_rpm > THRESHOLD_SOFT_START_PAS_CADENCE)
						{
							#if ENABLE_LOW_PASS_SOFT_START_RAMP
							//********************************************
							// K = 0.990
							// Value = (Value_Old * K) + (1 * (1 - K))
							// Value_Old = Value
							//********************************************
							// update soft start factor
							f_k_soft_start_factor = K_SOFT_START_FACTOR;
							f_temp = f_soft_start_factor_old * f_k_soft_start_factor;
							f_soft_start_factor = f_temp + (1 * (1 - f_k_soft_start_factor));
							f_soft_start_factor_old = f_soft_start_factor;
							#endif

							#if ENABLE_LINEAR_SOFT_START_RAMP
							//********************************************
							// K = 0.010
							// Value = Value + K
							//********************************************
							f_temp = 1.000;
							f_k_soft_start_factor = f_temp - K_SOFT_START_FACTOR;
							f_soft_start_factor += f_k_soft_start_factor;
							#endif
						}
						
						// calculate initial soft start assist level power and calculate delta assist level power
						if(configuration_variables.ui8_assist_level_factor_x10 > INITIAL_SOFT_START_ASSIST_VALUE)
						{
							f_temp = (float) (configuration_variables.ui8_assist_level_factor_x10 - INITIAL_SOFT_START_ASSIST_VALUE) * (float) ui16_pedal_power_x10;
						}
						else
						{
							// force soft start factor value
							f_soft_start_factor = 1.0;
						}						
					}
					else
					{
						// force soft start factor value
						f_soft_start_factor = 1.0;
					}
 
casainho said:
New firmware release: v1.0.0-beta.1

Changes from previous alpha version:
- added configuration for motor current control as torque mode as also keeping the previous power mode
- changed Walk assist max speed to 6 km/h while previously was 8 km/h
- added a few configuration to clock field: disable, clock, battery SOC % and battery volts

Download here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/860C_850C_SW102_v1.0.0-beta.1
Absolutely fine, many thanks! One of the things that is so good about your software is that the motor, it’s not silent, but hums contentedly. There are silk purses being made out of pigs ears here.

With alpha5 Going up a hill I found that above assist 8 you had to pedal quite hard until you got the cadence over 40 when the power kicked in. Normally I run the motor between 6 and 8 and, if you were in a low enough gear, the power kicked in at 20rpm which got you going. In other words the cadence rule seemed not to apply at lower assist levels. Version beta1 set to “torque” gets the job done.

I’m keeping with IS units until I hear that there is a fix for imperial?
 
casainho said:
I changed the firmware for this new values:
- motor max current of 30 amps
- battery max current of 20 amps (note that on original firmware this max value is 16 amps)

BUT please note this: the limit of max battery current on original firmware is 16 amps!! - I will put this information on the wiki but let users choose a higher value and so melt their motors faster if they choose to do so.

Interesting !
Maybe it's possible to ask the motor to run at 30A for a VERY fast period (like <3s) without frying it.

About motor cooling :
I have filled up entirely one of my TSDZ2 with car engine oil for experience purpose

It runs well and much quieter, even if I have a brass gear !
The oil plays both the role of coolant and lubricant

There's a small leak on the right side of the motor but this is because I didn't add silicone in the casing to prevent oil going from the left to the right side of the motor

It doesn't avoid the increase of oil temperature at continuous high power (I was able to reach more than 80°C at 750W for long period)

But... the oil have a thermal inertia and it may prevent the winding to burn as there are in direct contact. The temperature of the different elements (magnets, casing, winding, etc... ) is way more homogenous

My main concern is not the winding but the magnets, there are surely cheap and they begin to demagnetize at 90°C, which is a shame

Anyway, just for the motor running very quietly, I think it's actually a good idea to fill the case with oil
 
Nfer said:
The actual boost function does not help for red light start because it takes too long to kick in, even with the 8amp/s current ramp. However, the start acceleration from zero speed was solved in Marcoq code using a function call "K soft start". His idea was to smooth the motor acceleration using a K factor of 0.990. However, several user change that factor to a lower value, 0.4 to 0.3, increasing the acceleration ramp for 1 second or less and it makes a huge difference.
So, what was the solution? Can you describe with simple words the solution concept?
 
casainho said:
Nfer said:
The actual boost function does not help for red light start because it takes too long to kick in, even with the 8amp/s current ramp. However, the start acceleration from zero speed was solved in Marcoq code using a function call "K soft start". His idea was to smooth the motor acceleration using a K factor of 0.990. However, several user change that factor to a lower value, 0.4 to 0.3, increasing the acceleration ramp for 1 second or less and it makes a huge difference.
So, what was the solution? Can you describe with simple words the solution concept?

I am not a developer, only an user with a child seat and hill with traffic lights in my way to the day care. So my comments could not be very technical. Basically the motor starts from zero speed with 20% initial assistance (or whatever value you want) and the motor kicks delivering power as a function of time*K factor for the short period of time (1 second or less maybe). It is only the time you need to put both feet on the pedals and start pedaling.
So the concept is that the red light situation, the boost should be a function of the time only and the acceleration ramp and independent of the torque value.

Basically, in my situation is a safety condition. Hope it clarifies the concept
 
casainho said:
raw said:
i will improve the street mode to archive this goal and create a PR on this. i hope you would accept it as i want to contribute.
I accepted your pull request for the improvement to walk assist - it was simple but good improvement.

About the street mode, for me ok that virtual throttle can be disabled.

But I did not understand the new configurations you added:
1. Enable Mode (there is already Street mode feature enable...)
2. Hotkey enable

Can you please explain the need for each new configuration?

having a key combination to switch the street mode on and off at will cannot be considered street legal (at least in europe). so there needs to be a way to disable this handy feature :mrgreen:
because the hotkey was the only way to enable/disable the street mode, the "Enable Mode" (Better name welcome) setting is required so it can be switched using the configuration screen.
 
NexusG said:
Interesting !

About motor cooling :
I have filled up entirely one of my TSDZ2 with car engine oil for experience purpose

It runs well and much quieter, even if I have a brass gear !
The oil plays both the role of coolant and lubricant

There's a small leak on the right side of the motor but this is because I didn't add silicone in the casing to prevent oil going from the left to the right side of the motor

It doesn't avoid the increase of oil temperature at continuous high power (I was able to reach more than 80°C at 750W for long period)

But... the oil have a thermal inertia and it may prevent the winding to burn as there are in direct contact. The temperature of the different elements (magnets, casing, winding, etc... ) is way more homogenous

My main concern is not the winding but the magnets, there are surely cheap and they begin to demagnetize at 90°C, which is a shame

Anyway, just for the motor running very quietly, I think it's actually a good idea to fill the case with oil

That is very interesting!
I had no idea you could fill a brushless motor completely up with oil and the motor would still run.
What kind of long term negative effects could this have?
I'm sure that as the motor spins in the Oil there is some friction-drag compared to Air?
I do realize it would help in keeping the motor cool and the temp consistent throughout.
I would think that the oil would seep out of the case at the small gear into the large gear and then Leak out?
 
casainho said:
New firmware release: v1.0.0-beta.1

Changes from previous alpha version:
- added configuration for motor current control as torque mode as also keeping the previous power mode
- changed Walk assist max speed to 6 km/h while previously was 8 km/h
- added a few configuration to clock field: disable, clock, battery SOC % and battery volts

Download here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/860C_850C_SW102_v1.0.0-beta.1
Tested with the torque sensor calibration enable and the correct calibration values. I could not find the related changes you did in the source but now everything is working as expected.
- the weight is correctly calculated on both left and right side;
- tested with assist level 20. At the max there is initials a hard kick. With every rotation after it becomes smaller and almost disappears after the third or fourth pedal turn. I expect that in real conditions, where the bike is loaded, it will be even better with the increase of the inertial moment of the whole system.

The filter value is 20. In case I incase it, you said you are using 80, should the peaks disappears faster or slower?
 
plpetrov said:
casainho said:
New firmware release: v1.0.0-beta.1

Changes from previous alpha version:
- added configuration for motor current control as torque mode as also keeping the previous power mode
- changed Walk assist max speed to 6 km/h while previously was 8 km/h
- added a few configuration to clock field: disable, clock, battery SOC % and battery volts

Download here: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/860C_850C_SW102_v1.0.0-beta.1
Tested with the torque sensor calibration enable and the correct calibration values. I could not find the related changes you did in the source but now everything is working as expected.
- the weight is correctly calculated on both left and right side;
- tested with assist level 20. At the max there is initials a hard kick. With every rotation after it becomes smaller and almost disappears after the third or fourth pedal turn. I expect that in real conditions, where the bike is loaded, it will be even better with the increase of the inertial moment of the whole system.

The filter value is 20. In case I incase it, you said you are using 80, should the peaks disappears faster or slower?
Good to know and yes, I did not changed anything related to that issues.

The higher the value, the higher the filtering. I did not make default an high value because it would add a reaction delay also - more filtering means also more delay.
 
raw said:
having a key combination to switch the street mode on and off at will cannot be considered street legal (at least in europe). so there needs to be a way to disable this handy feature :mrgreen:
because the hotkey was the only way to enable/disable the street mode, the "Enable Mode" (Better name welcome) setting is required so it can be switched using the configuration screen.
Totally right. But who knows about the feature? And I think that a "well known" combination is worthless if you intend to hide the "illegal mode". Only a per-user defined combination of up, down, ok, brake of a user defined sequence length can be considered "safe".
And disabling "street mode" by software would make it legal almost everywhere around the globe. It's just important that it can not be disabled without any "tools" on the road, be it hand tools like a screw drivers, any electronic device or such.
 
casainho said:
elfnino said:
I would much rather prefer to have the Cruise mode from previous versions. In v0.20 it was smooth and safe as well.
You are mixing the features/concepts, right?

Indeed throttle and cruise are different concepts but both work to achieve the same goal to make or to keep ebike running without pedaling. In a fact in real life (including car driving) 80% of time the throttle is used to maintain constant speed - cruise.


Cruise in previous releases:
pedal to desired speed -> lock cruise -> stop cruise
+ simple to lock cruise just with long press of single down button
+ fast stop (few milliseconds) in case of emergency
- difficult to change speed
- need pedaling

Virtual Throttle:
throttle up/down to desired speed - > maintain speed (cruise) -> change speed -> stop
+ no need to pedaling
+ easy to change speed
- difficult to switch to VT menu using multiple button seqence ( 2x UP and then ON/OFF long)
- unable to change Assist level while VT menu is active
- the long delay to stop in case of emergency (break sensors should be recommended)

I am not saying VT should be replaced with Cruise.. each concept has its own benefits so why to not to have both options..
 
elfnino said:
Virtual Throttle:
throttle up/down to desired speed - > maintain speed (cruise) -> change speed -> stop
+ no need to pedaling
+ easy to change speed
- difficult to switch to VT menu using multiple button seqence ( 2x UP and then ON/OFF long)
- unable to change Assist level while VT menu is active
- the long delay to stop in case of emergency (break sensors should be recommended)

I am not saying VT should be replaced with Cruise.. each concept has its own benefits so why to not to have both options..
I do not want to discuss cruise as it is a different feature, with different objective.

As for virtual throttle (VT), I have no expectations for it to be as easy to use as a physical throttle because I think it is impossible. For me, VT will be used when I have to disable some sensor maybe because it was damaged and is incorrectly working or maybe some crank had an issue and then I can´t pedal no more - VT will be only a temporary solution for that case. This is my expectation.
 
izeman said:
It's just important that it can not be disabled without any "tools" on the road, ... any electronic device or such.
Are you sure on this? Because this seems impossible to guarantee. Imagine a well known brand ebike, you can always change some configuration because the manufacturer produces the same product for different markets with different laws, so, the product is always configurable. I think the implementation of that configuration should be up to the manufacturer and on our firmware could be the "enforce street legal mode" that could be enabled by default.

Then, if user decide to disable the "enforce street legal mode", it could then even switch between street legal mode or off-road mode, knowing that he should not do it anyway but I think that may depend on local laws anyway so everything is possible.
 
A quick review of the latest 1.0.0.beta:

Great work Casainho and all other contributors.

I found that the latest SW102 firmware is quite prone to locking up/hanging when navigating the menu and setting things up. It needed many power cycles to get all the settings entered correctly.
I set motor and battery current to maximum, also set current ramp to maximum (10A) because I am interested in maximum off the line performance.

It ride in torque mode and it is nearly the same as the old torque fork by r0mko, I think slightly slower on the take off from a standstill on a single speed. I tried to enable assistance w/o pedal rotation, but this seemed to only work one time and did not work on subsequent starts. Or perhaps I did not notice it.

The new firmware is able to consistently deliver much higher motor watts at a lower RPM than the previous versions, I noticed 600-700w came up much sooner. The motor is able to consistently deliver this high wattage during sustained load when climbing hills, even as the pedal cadence drops. I was able to climb a very steep and long hill that I often ride up at a consistent 19km/h and 700w.

I did however gobble up 51% of my battery :) I am going to build a bigger/better pack.
 
Nfer said:
So the concept is that the red light situation, the boost should be a function of the time only and the acceleration ramp and independent of the torque value.
If I understand correctly, the BOOST would be:
1. duration: configurable fixed amount of time like 1 second
2. power: configurable and fixed amount of motor power like 500W
3. current ramp: specific current ramp, faster than 8 amps / second

Is that right? BOOST would not depend at all from the pedal torque and cadence values?
 
casainho said:
elfnino said:
Virtual Throttle:
throttle up/down to desired speed - > maintain speed (cruise) -> change speed -> stop
+ no need to pedaling
+ easy to change speed
- difficult to switch to VT menu using multiple button seqence ( 2x UP and then ON/OFF long)
- unable to change Assist level while VT menu is active
- the long delay to stop in case of emergency (break sensors should be recommended)

I am not saying VT should be replaced with Cruise.. each concept has its own benefits so why to not to have both options..
I do not want to discuss cruise as it is a different feature, with different objective.

As for virtual throttle (VT), I have no expectations for it to be as easy to use as a physical throttle because I think it is impossible. For me, VT will be used when I have to disable some sensor maybe because it was damaged and is incorrectly working or maybe some crank had an issue and then I can´t pedal no more - VT will be only a temporary solution for that case. This is my expectation.

I like the idea of virtual throttle as a backup solution if your motor or bike is broken. this may easily happen when you are touring with the kids and is stuck in the middle of nowhere without tools.

I also think of an idea of running the motor in some kind of default mode without the connection to your display. This doesn't happen often but I like the idea of using a motor without display. very little wiring and les components to break. The display can be connected only for changing this default configuration.
 
Hello Casainho, installation and configuration Version 1.0.0 beta on 860C no problem, no freeze.
The mistake: - "If i go first in Menu "Various" and next in Menu "Display" then i get a freeze with black screen with text: 0x2 0x8010c64." - is fixed! Thank you!
 
casainho said:
Nfer said:
So the concept is that the red light situation, the boost should be a function of the time only and the acceleration ramp and independent of the torque value.
If I understand correctly, the BOOST would be:
1. duration: configurable fixed amount of time like 1 second
2. power: configurable and fixed amount of motor power like 500W
3. current ramp: specific current ramp, faster than 8 amps / second

Is that right? BOOST would not depend at all from the pedal torque and cadence values?

Thanks Casainho for taking a look at this.

1. duration: configurable fixed amount of time like 1 second. Yes
2. power: configurable and fixed amount of motor power like 500W. No idea. What Marcoq has right now is a initial start assist of 20% and the fast current ramp. If the initial push is too high it is going to be unsafe.
3. current ramp: specific current ramp, faster than 8 amps / second. Yes
4. Only kicks in when speed is 0.
5. No input from torque or cadence sensor values.

I think this function should not replace the current BOOST because I am sure its actual functionality is helping other users.
I envision this new function for cyclist that are not able to push hard the pedals or stand up on the pedals to provide more torque for whatever reason (safety, knee problem, cargo bike, child seat) at the start, and can be enable/disable.
 
Why not calling this function STANDUP and instead of a configurable duration, you turn if off when the bike reaches 6km/h (or configurable speed) that way it will always behave the same way if you use it in a climb, a downhill or a flat road.

Nfer said:
Thanks Casainho for taking a look at this.

1. duration: configurable fixed amount of time like 1 second. Yes
2. power: configurable and fixed amount of motor power like 500W. No idea. What Marcoq has right now is a initial start assist of 20% and the fast current ramp. If the initial push is too high it is going to be unsafe.
3. current ramp: specific current ramp, faster than 8 amps / second. Yes
4. Only kicks in when speed is 0.
5. No input from torque or cadence sensor values.

I think this function should not replace the current BOOST because I am sure its actual functionality is helping other users.
I envision this new function for cyclist that are not able to push hard the pedals or stand up on the pedals to provide more torque for whatever reason (safety, knee problem, cargo bike, child seat) at the start, and can be enable/disable.
 
Nfer said:
2. power: configurable and fixed amount of motor power like 500W. No idea. What Marcoq has right now is a initial start assist of 20% and the fast current ramp. If the initial push is too high it is going to be unsafe.

I think this function should not replace the current BOOST because I am sure its actual functionality is helping other users.
I envision this new function for cyclist that are not able to push hard the pedals or stand up on the pedals to provide more torque for whatever reason (safety, knee problem, cargo bike, child seat) at the start, and can be enable/disable.
2. What means start assist of 20%? 20% of what??

There are feedback from users of cargo bikes that like the BOOST at startup.

I was thinking in maybe remove BOOST since other users/developers say it is not needed anymore if using torque mode instead of power mode. I would prefer to not add new features and even ones that maybe be similar, hard to understand the difference from others.
 
agphil said:
Why not calling this function STANDUP and instead of a configurable duration, you turn if off when the bike reaches 6km/h (or configurable speed) that way it will always behave the same way if you use it in a climb, a downhill or a flat road.

Nfer said:
Thanks Casainho for taking a look at this.

1. duration: configurable fixed amount of time like 1 second. Yes
2. power: configurable and fixed amount of motor power like 500W. No idea. What Marcoq has right now is a initial start assist of 20% and the fast current ramp. If the initial push is too high it is going to be unsafe.
3. current ramp: specific current ramp, faster than 8 amps / second. Yes
4. Only kicks in when speed is 0.
5. No input from torque or cadence sensor values.

I think this function should not replace the current BOOST because I am sure its actual functionality is helping other users.
I envision this new function for cyclist that are not able to push hard the pedals or stand up on the pedals to provide more torque for whatever reason (safety, knee problem, cargo bike, child seat) at the start, and can be enable/disable.

Agree
 
casainho said:
2. What means start assist of 20%? 20% of what??

There are feedback from users of cargo bikes that like the BOOST at startup.

I was thinking in maybe remove BOOST since other users/developers say it is not needed anymore if using torque mode instead of power mode. I would prefer to not add new features and even ones that maybe be similar, hard to understand the difference from others.

With the 20% I am trying to say that this function needs an initial power value a 0.000001s to achieve the goal.
The problem I experience with the torque mode is that I don't have the legs to increase the speed only with torque from standstill.
Obviously, it is impossible to cover with only one firmware the different types of user (trail, city, leisure, speed, old, young, strong....).
If I am the only one with this is issue and the rest of the city cyclists using this firmware don't have any problem with it, it doesn't make sense to spend time on this functionally.
For me, it doesn't make sense to carry a battery of 696wh and a 750W motor and feel that I have stand up on the pedals every red light because the system doesn't deliver any power when I need the most, but I have to push against the motor drag and carry the extra weight.
In NYC there is a red light at every other block and I am not going to put my life at risk as other people running red lights to keep the momentum.
 
Back
Top