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

HI all,

i have a strange effect on a complete clean install to 0.14.3. No option was changed after installation. 48V Motor, 48V Battery.
The motor starts to rotate already with a slightly touch the pedals. Riding on the smallest assist-level (set to 400W) is like "no need to pedal".
It seems that my torque sensor is outputting wrong values or the calculation goes mad...

Value 3 on Page 9 jumps instantly from 0 to ~230 if i touch the pedals. ADC value seems to be normal at ~43 on idle and ~70 at pedaling.

Got a dump on everything to fiddle around with the (wrong?) eprom-values. If somebody want to check out at:
https://cloud.privy.de/index.php/s/AKZ3QcGdy9TwMX4

Any ideas?
 
Oh, eeprom_write_if_values_changed (void) is commented out, so every new value from the LCD gets never written to the eprom of the Motor? The Motor always runs with the vars temporary added by the LCD while "online".. hmm, ok :)
 
EndlessCadence said:
gaber said:
Any idea why I would keep getting a 404 error when trying to edit the glossary page you created? My account is verified.
404s is really strange, doesn't sound like an access or rights issue. I don't have administrative rights for the wiki so I can't check if you have access and the required rights. Can't check the repository settings. We have to wait for Casainho :wink:

Figured out why I was getting 404s, turns out GitHub had (for some reason) flagged my account for manual review. That's resolved and my edits to the glossary are in: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/TSDZ2-Glossary

Additional terms I'd think would be helpful to have a good definition of:
ADC?
PWM duty cycle?
EPROM?
ERPS?
 
Casainho and Endless Cadence, you have both gone quiet.. You are not moving on to other projects ?
 
Hello, i own a tsdz2 ( not standard ) and connectors are differents, seems there is a programming port and i don t know the kind of connector to use it, programmation is different, also some pieces inside like nylon gear ..

https://rixbxg.dm.files.1drv.com/y4...ixXN-0XT5Q?width=728&height=587&cropmode=none

i could share other photos if needed, in fact this motor is the one i used one yeart ago to post a video using a 48V battery on a 36V tsdz2, it accept 48V with originale firmware but for sure baregraphe is wrong ( i thinck it s one of the first tsdz2, more than 3 year old )
 
jbalat said:
Casainho and Endless Cadence, you have both gone quiet.. You are not moving on to other projects ?
Yes, I am being busy. My plan is to make Bafang 850C working for TSDZ2, as an alternative to KT-LCD3. I forgot a bit the KT-LCD7 with Bluetooth as EC seems to be working in an alternative to add Bluetooth to any LCD.

casainho said:
Finally I got Bafang 850C LCD working!!!

I had to buy a logic analyzer and was my first time using it -- always learning :)







The firmware is here: https://github.com/OpenSource-EBike-firmware/Color_LCD/tree/master/Bafang_LCD_850C_firmware
 
But I just bought an lcd3 and so did many others, what am I going to do with it now ?

I’m happy you are learning new things but can you guys spend some of your time also sorting the issues ? Don’t mean this in a bad way but it just seems that development has stopped when we are so close to the end.

I think now that lag is better we can totally kick it in the butt and reduce motor noise by applying a constant load on the motor while wheel speed is greater than zero. My friend says his Bafang is using 20w even with no assist !!

If you don’t have time to do this maybe give me some tips and I will try it myself...

Thanks and enjoy
JB
 
Hey, first thanks for the great work on the project :bigthumb:
Already drove quite a bit on my bike with the TSDZ2 and OpenSource firmware.
With my 140kg and 1kwh battery (96 cells 2x 6s in series) can do ~ 70km which is very fine for me. On a lazy mode consuming ~500w when going on flat at ~30km/h at the sporty mode 200w is enough to keep 30km/h. And the offroad mode is a gem, love it with the stupid EU regulations, can just turn off the thing and if police checks it's 250w 25km/h :)

However it's not exactly clear about the lag when pedalling, I installed 14.3 a week ago, however I think that lag is present, do we have to change some settings, or it should not be present with 14.3?
 
tried 14.3 "experimental high cadence mode" but its not working for me.
motor is less efficient when around 90rpm cadence. (20-40 watt more power needed)
less torque too. 36V motor with 12 cell lipo here.
 
markjiizs said:
However it's not exactly clear about the lag when pedalling, I installed 14.3 a week ago, however I think that lag is present, do we have to change some settings, or it should not be present with 14.3?

unfortunately lag is still present in 14.3...
i hard to analyse since its so random...
most of the time it reacts fast, sometimes i needs 2 seconds before motor kicks in again.
 
vscope said:
unfortunately lag is still present in 14.3...
i hard to analyse since its so random...
most of the time it reacts fast, sometimes i needs 2 seconds before motor kicks in again.

From what I know 14.3 only has only high cadence enhancement for 36v on experimental mode. No lag fixes are there.

jbalat said:
I think now that lag is better we can totally kick it in the butt and reduce motor noise by applying a constant load on the motor while wheel speed is greater than zero. My friend says his Bafang is using 20w even with no assist !!
I think we can have that if we have a miniman "human power" in the code. I did not have time to test it.
Now the cadence goes from 0-max_cadence. I plan to have a range of 25-max_cadence. This way you keep the motor permanently under small load and the assist at low cadence will be better.
@Jblat If you want to try the changes I can try to push my branch on git(if I have the right).
 
vscope said:
markjiizs said:
However it's not exactly clear about the lag when pedalling, I installed 14.3 a week ago, however I think that lag is present, do we have to change some settings, or it should not be present with 14.3?

unfortunately lag is still present in 14.3...
i hard to analyse since its so random...
most of the time it reacts fast, sometimes i needs 2 seconds before motor kicks in again.
You guys seems to make a confusion about different things.

That random startup power fail seems that has the duration of startup power boost.

Can you please confirm that ypu have brake sensors installed??
 
casainho said:
vscope said:
markjiizs said:
However it's not exactly clear about the lag when pedalling, I installed 14.3 a week ago, however I think that lag is present, do we have to change some settings, or it should not be present with 14.3?

unfortunately lag is still present in 14.3...
i hard to analyse since its so random...
most of the time it reacts fast, sometimes i needs 2 seconds before motor kicks in again.
You guys seems to make a confusion about different things.

That random startup power fail seems that has the duration of startup power boost.

Can you please confirm that ypu have brake sensors installed??

no brake sensors here.
will try to disable boost and see if lags are gone.
 
jbalat said:
But I just bought an lcd3 and so did many others, what am I going to do with it now ?
You should keep using it.

When Bafang 850C display works, I don´t plan any changes to the interface nor the data that flows from the motor controller, so LCD3 should keep working. I also have ebikes with LCD3 that I may not soon switch to another LCD.

jbalat said:
I’m happy you are learning new things but can you guys spend some of your time also sorting the issues ? Don’t mean this in a bad way but it just seems that development has stopped when we are so close to the end.
Don´t expect me to do every thing and even work on issues that are problems of others.

jbalat said:
If you don’t have time to do this maybe give me some tips and I will try it myself...
That is the best you can do if you want it. I can guide you, look at notes I wrote before about it. Maybe you can fork the code, implement and ask me to review the changes before you test.
 
gaber said:
Additional terms I'd think would be helpful to have a good definition of:
ADC?
PWM duty cycle?
EPROM?
ERPS?
https://en.wikipedia.org/wiki/Analog-to-digital_converter
https://en.wikipedia.org/wiki/EEPROM
https://en.wikipedia.org/wiki/Pulse-width_modulation

ERPS: electric revoltuino per second: https://en.wikipedia.org/wiki/Revolutions_per_minute
 
EndlessCadence said:
The other thing I noticed is that while the code is more organized and release scripts etc are added, we've introduced a lot of complexity in the code in more recent versions. Also, some potentially dangerous functionality wasn't removed. I'm questioning how many users are using these features anyways.

I'm personally thinking of going back to a leaner version with only the required features for a nice and reliable bike with code that's very easy to maintain. This includes only 5 assist levels (multipliers). Redesigned offroad mode. We already have reported issues for most of this, see https://github.com/OpenSource-EBike-firmware/TSDZ2-Smart-EBike/issues. What do you think?
I plan to keep the firmware (the version I initiated) ¨flexible" with advanced options that can help on different applications other than ¨standard¨ ebike -- I want that disabled people, kids, etc can use the motor and for that different ebike applications, they need advanced options like startup the motor with very low force on the pedals.

But yes, this flexibility brings complexity on configuration for user, maybe I can write some wiki pages about an example of configuration for a typical ebike to serve as configuration guide.

EndlessCadence said:
Meanwhile, I have the STM8 (processor in controller and display) ROM bootloader working, this means I'm able to update the firmware without any programmer. This currently still requires my computer.
I'm also experimenting with Bluetooth and am able to update the firmware of the Bluetooth module wirelessly. Hopefully, this can be combined soon, then we have a bike which can be updated and configured by Bluetooth!
This is why I was a bit silent the last few days :D
I hope we can keep things modular so users can decide to use or not each pieces. As we can read on previous messages, I think there are users that prefer only mobile app, others LCD and maybe others both options.

We know that KT-LCD7 is cheap and includes already Bluetooth.

We know that a color LCD for Bafang motors should arrive to market that includes Bluetooth.
 
Hi,

still searching for my strange effect on my bike. While reading the code i got confused about the function torque_sensor_read. This one is used to write the current (mapped) torque value to ui8_torque_sensor which is used to calculate ui8_pedal_human_power which is used to calculate ui8_adc_battery_target_current and so on...

In the function TIM1_CAP_COM_IRQHandler there is another source for the torque sensor which makes a lot more sense to me:
ui16_torque_sensor_throttle_processed_value. This one is filtered for the max value (as we spin the pedals, the torque is not always the same)

..but this value is never used?

I think my ui8_torque_sensor gets boosted (although the function is disabled) and that's why it jumps from 0 to 230 as soon as i touch the pedals...
 
shaddi said:
In the function TIM1_CAP_COM_IRQHandler there is another source for the torque sensor which makes a lot more sense to me:
ui16_torque_sensor_throttle_processed_value. This one is filtered for the max value (as we spin the pedals, the torque is not always the same)

..but this value is never used?
Old code that was not yet removed...

shaddi said:
I think my ui8_torque_sensor gets boosted (although the function is disabled) and that's why it jumps from 0 to 230 as soon as i touch the pedals...
It is possible to have ¨some glitch on the values¨ and if they are found to be an issue, then we need to take care of it.
 
hm, ok. old code..

im still confused. STM8 Datasheet says we have 10 Bit ADCs. Align is set to left, so we have 8 bits in ADC1_DBxL and 2 bits in the ADC1_DBxH register. The old code got the full 10Bit-Value but the current one is only reading the ADC1_DBxH registers, right?
 
shaddi said:
hm, ok. old code..

im still confused. STM8 Datasheet says we have 10 Bit ADCs. Align is set to left, so we have 8 bits in ADC1_DBxL and 2 bits in the ADC1_DBxH register. The old code got the full 10Bit-Value but the current one is only reading the ADC1_DBxH registers, right?
Using 8 bits to be fast on this 8 bits microcontroller. Also works as a low pass filter when losing the resolution from 10 to 8 bits.
 
jbalat said:
Casainho and Endless Cadence, you have both gone quiet.. You are not moving on to other projects ?
jbalat said:
But I just bought an lcd3 and so did many others, what am I going to do with it now ?

I’m happy you are learning new things but can you guys spend some of your time also sorting the issues ? Don’t mean this in a bad way but it just seems that development has stopped when we are so close to the end.
Hmm, not sure if I like your attitude to be honest. Hopefully, I'm completely wrong in this regard.

I've released the latest version exactly 7 days ago, with changes you've asked for. I've been bug hunting last friday, almost all day long.
Next to this I'm experimenting with adding Bluetooth to LCD3 and updating the firmware over the serial connection. Replying to private messages etc... We don't run a business with this firmware. We invest our own spare time and get (almost) nothing in return. I'm buying stuff with my own money to help with development.

This kind of comments kills my motivation and makes me wonder whether I should continue to develop this firmware for the sake of others too. The bike is almost perfect for me already, except for the lag issue.

Btw, I'll continue to use the LCD3 or maybe even a smaller display.
 
I for one appreciate all the work put into this by Endlesscaddence , Casainho & others. As Endlesscaddence says, all this work is done for free, and its a hellofalot of work. They still have to work at their other employment to pay the bills, mortgage etc.

Keep up the great work.
 
A Motor Thermal Model would allow prediction of internal temperatures, without hardware modification.
Probably only a 2-3pole IIR filter is required, running at a fairly slow rate.

requires:

* Multiple motors with temperature sensor and data logging.
* Output of motor current, voltage, rpm, temperature to logger. e.g. Add telemetry channel out the SWIM and BT to phone?
* fitting coeffiecients (genetic alg?) to data from multiple users.
* logging in phone BT/usb software

How many users are there with the temp sensor added, and interest in adding logging port?
 
EndlessCadence said:
This kind of comments kills my motivation and makes me wonder whether I should continue to develop this firmware for the sake of others too. The bike is almost perfect for me already, except for the lag issue.

Yeh sorry it came out that way, it always sounds worse when you write stuff down. Hope you dont take things the wrong way. Much appreciate your efforts guys. I just noticed you haven't been on the forum so I assumed you have abandoned us..
I got scared !!
BTW I consider you guys my friends so if it looks like I'm having a winge dont take it personally and give me some wise crack back :)
 
maximusdm said:
vscope said:
unfortunately lag is still present in 14.3...
i hard to analyse since its so random...
most of the time it reacts fast, sometimes i needs 2 seconds before motor kicks in again.

From what I know 14.3 only has only high cadence enhancement for 36v on experimental mode. No lag fixes are there.

jbalat said:
I think now that lag is better we can totally kick it in the butt and reduce motor noise by applying a constant load on the motor while wheel speed is greater than zero. My friend says his Bafang is using 20w even with no assist !!
I think we can have that if we have a miniman "human power" in the code. I did not have time to test it.
Now the cadence goes from 0-max_cadence. I plan to have a range of 25-max_cadence. This way you keep the motor permanently under small load and the assist at low cadence will be better.
@Jblat If you want to try the changes I can try to push my branch on git(if I have the right).

Yep there is no fix for lag just that setting you will need to change yourself from 75 to 25... see earlier posts.

Also just to make it clear, the bike will not be as efficient at a high cadence however if you find yourself in a situation where you need to peddle fast before you go up a big hill and don’t want to change down gears then this mod let’s you peddle as fast as you can.

The minimum human power should work so long as it only applies while wheel speed > 0.. Will have a look Thanks !! Yes please let me know or just post the code here and I can cut and paste.
 
Back
Top