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

New release 860C_850C_SW102_v1.0.0-alpha.3 with changes only for solve the issue with the lights: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/860C_850C_SW102_v1.0.0-alpha.3

Changelog:
- added configuration for lights ADC current step
- added battery ADC steps to configurations technical menu (to help user find the amount of battery current ADC steps that his lights pull)

casainho said:
cityboy19 said:
I will focus next on this. I don't have lights to test but I know what is the issue. The TSDZ2 motor controller has only one sensor to measure the battery current and that also includes the current on the lights. The firmware is not accounting for that and so gives that issue. I plan to make an option to see the ADC value of the current sensor and user see the difference and configure that value BUT use a default value that may work for most of the users. I think it will be something like 1, 2 or 3 ADC units and then maybe used always a fixed value and remove this configuration.
If you need help ... write to me
1. Install this alpha.3 version
2. On the display, enable the lights as usual
3. Go to configurations, Technical and see the very first value of "ADC battery current / ADC bat cu". This is the amount of current your lights pull.
4. Go to configurations, Various and on "ADC lights offset / ADC lights", set the previous value. I do not expect to be more than 4. And please report here the value you did configure.

Please report here if this worked and please test later on 4. every value from 0 to 4 and see what works and not so maybe I can use a fixed value and remove this configuration OR use as default value.
 
Hi,

My build is almost complete, took a quick test ride today and the motor seems to work well. However I have a few issues:

1- The UP/DOWN buttons (850C) are reversed. I click on DOWN to increase the assist level. Another user (nassal) had mentioned this problem but I couldn't find a resolution in the forum.

2- I can't get into the settings configuration mode on the display. I tried both quick PWR followed by long press PWR, and also UP/DOWN and PWR long press. It just turns off the display.

Any ideas?

Thanks,
Chris

EDIT:
using 0.6.2 on Display and 0.51.0 on TSDZ2
 
OttawaEbiker said:
Hi,

My build is almost complete, took a quick test ride today and the motor seems to work well. However I have a few issues:

1- The UP/DOWN buttons (850C) are reversed. I click on DOWN to increase the assist level. Another user (nassal) had mentioned this problem but I couldn't find a resolution in the forum.

2- I can't get into the settings configuration mode on the display. I tried both quick PWR followed by long press PWR, and also UP/DOWN and PWR long press. It just turns off the display.

Any ideas?

Thanks,
Chris

EDIT:
using 0.6.2 on Display and 0.51.0 on TSDZ2


you can toggle the buttons for oppisite use in config... I did the same and are on same firmware

to get to config.....short click, long press... POWER BUTTON

K
 
OttawaEbiker said:
Thanks ktronic, everything works perfect now. I had not understood how quick the short click had to be.


another good idea is to look at the lowest config setting, 'techinal' I think it says...., its a data screen where you can compare your touque sensor output...to the ones in your touque sensor settings...these settings are stock....and for better performance, you should make sure these two are close... :)
 
ezrider1199 said:
casainho said:
As I told before, I don't have throttle and so I can't develop and test. I hope that you or others collaborate in implementing and test that feature, and submit it, doing a pull request on the github repository.

Ok thanks I hope at least itll work on versions marked stable when the time comes.
Edit: I'm definitely willing to test any code change for throttle. If anyone wants to fix it and make it more responsive I'll get them and casainho beer, lots of it. Thanks.

I second this! Casainho, if you don't mind just trying to explain the the theory of operation for the throttle, I will take another look at the code and try to get it fixed and tested. Then I will make a pull request once it is working.

Thanks again for the amazing work.
 
gatorsean said:
ezrider1199 said:
casainho said:
As I told before, I don't have throttle and so I can't develop and test. I hope that you or others collaborate in implementing and test that feature, and submit it, doing a pull request on the github repository.

Ok thanks I hope at least itll work on versions marked stable when the time comes.
Edit: I'm definitely willing to test any code change for throttle. If anyone wants to fix it and make it more responsive I'll get them and casainho beer, lots of it. Thanks.

I second this! Casainho, if you don't mind just trying to explain the the theory of operation for the throttle, I will take another look at the code and try to get it fixed and tested. Then I will make a pull request once it is working.

Thanks again for the amazing work.
I decided to implement the virtual throttle and it will be a value sent by the display. It should be mixed with original throttle value so I will get the feature virtual throttle implemented as also correct issues with real one. Let's see if I can finish this by today and then we can talk again.
 
hello guys , i have a question that why the opensource code is based on the motor tsdz2 instead of bafang motor . so what is the difference between the main products of tongsheng and bafang?
 
casainho said:
I just want to finish this project and move to the next one, that will be also for outdoor sports on mountain -- will be the ELegs / exoskeleton for sports, for going to trails on mountains!!

Sounds exciting, do you have any more info you can share ?
 
randy_cena said:
hello guys , i have a question that why the opensource code is based on the motor tsdz2 instead of bafang motor . so what is the difference between the main products of tongsheng and bafang?
Because no one did the firmware for Bafang. I tried to look at it and I wrote my notes here: https://github.com/OpenSource-EBike-firmware/Bafang_BBS02_BBSHB/wiki

NOTE: this motor controllers seems to have 2 microcontrollers, one probably to deal with the display only and run the ebike logic and other specific to control the motor. There are no developing tools for the one that controls the motor so no possible to develop firmware.

I think this is a chinese clone of the Renesas (formerly NEC) D79F9211, sometimes branded as a X8M06, well known from the old KU63 controllers. 44 Pin LQFP package.
 
I have a 48V TSDZ2 and a 48V battery. I pedalled yesterday with 860C_850C_SW102_v1.0.0-alpha.3.

Battery SOC% and battery volts did not match. I’m wondering why? Or should the battery be fully charged when installing the new firmware?

The light that came with the TSDZ2 worked well. Otherwise, it is poor, low light output. I plan to buy next fall a similar light as cityboy19 has.

Is there a long delay when measuring battery resistance? I did it as instructed and no value was displayed. After checking at home, it had entered a value of 227.

860CSOC%1.JPG

860cVolts1.JPG

Resistance1.JPG
 
dameri said:
I have a 48V TSDZ2 and a 48V battery. I pedalled yesterday with 860C_850C_SW102_v1.0.0-alpha.3.

1. Battery SOC% and battery volts did not match. I’m wondering why? Or should the battery be fully charged when installing the new firmware?

2. The light that came with the TSDZ2 worked well. Otherwise, it is poor, low light output. I plan to buy next fall a similar light as cityboy19 has.
1. do your work and read Features and configurations on display wiki page.

2. What value did you usee for the lights ADC current step?

jbalat said:
casainho said:
I just want to finish this project and move to the next one, that will be also for outdoor sports on mountain -- will be the ELegs / exoskeleton for sports, for going to trails on mountains!!
Sounds exciting, do you have any more info you can share ?
The chinese are not yet selling on Ebay or such, but, they are selling on other types to stabilization of video recording systems with gimbals and such and also kind of "exoskeleton chairs". Who knows if in 2 or 5 years they start selling exoskeletons for general public?

See here about ELegs: https://endless-sphere.com/forums/viewtopic.php?f=1&t=100507&p=1550865#p1550865
 
casainho said:
gatorsean said:
ezrider1199 said:
casainho said:
As I told before, I don't have throttle and so I can't develop and test. I hope that you or others collaborate in implementing and test that feature, and submit it, doing a pull request on the github repository.

Ok thanks I hope at least itll work on versions marked stable when the time comes.
Edit: I'm definitely willing to test any code change for throttle. If anyone wants to fix it and make it more responsive I'll get them and casainho beer, lots of it. Thanks.

I second this! Casainho, if you don't mind just trying to explain the the theory of operation for the throttle, I will take another look at the code and try to get it fixed and tested. Then I will make a pull request once it is working.

Thanks again for the amazing work.
I decided to implement the virtual throttle and it will be a value sent by the display. It should be mixed with original throttle value so I will get the feature virtual throttle implemented as also correct issues with real one. Let's see if I can finish this by today and then we can talk again.

Thank you very much for addressing this! :D
 
casainho said:
New release 860C_850C_SW102_v1.0.0-alpha.3 with changes only for solve the issue with the lights: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/860C_850C_SW102_v1.0.0-alpha.3

Changelog:
- added configuration for lights ADC current step
- added battery ADC steps to configurations technical menu (to help user find the amount of battery current ADC steps that his lights pull)

casainho said:
cityboy19 said:
I will focus next on this. I don't have lights to test but I know what is the issue. The TSDZ2 motor controller has only one sensor to measure the battery current and that also includes the current on the lights. The firmware is not accounting for that and so gives that issue. I plan to make an option to see the ADC value of the current sensor and user see the difference and configure that value BUT use a default value that may work for most of the users. I think it will be something like 1, 2 or 3 ADC units and then maybe used always a fixed value and remove this configuration.
If you need help ... write to me
1. Install this alpha.3 version
2. On the display, enable the lights as usual
3. Go to configurations, Technical and see the very first value of "ADC battery current / ADC bat cu". This is the amount of current your lights pull.
4. Go to configurations, Various and on "ADC lights offset / ADC lights", set the previous value. I do not expect to be more than 4. And please report here the value you did configure.

Please report here if this worked and please test later on 4. every value from 0 to 4 and see what works and not so maybe I can use a fixed value and remove this configuration OR use as default value.

On my screen ADC bat cu was 0.
On ADC lights I tested values 0 - 4 and lights
were working with all values.
 
casainho said:
HughF said:
I understand... I actually find that for the single speed bike (one of the benefits of electric assistance, you don't need gears) there is hardly any issue with the bike moving unintentionally. If you have 'assist without pedal rotation' enabled, then sure you can get a little creep/pushing at times, but because the gearing is so high, it will not cause you to move forwards. As a result, I would always recommend this is switched off. In fact, does anyone use this feature?

Perhaps r0mko would like to maintain a torque only fork that tracks your new code base, and can also include the field weakening features etc? I would love to take on this fork as I really like the single speed and will probably build another one, but alas I do not have the time.
You can go read the messages backwards and you will see people reporting to use the "assist without pedal rotation", like having a throttle at max value and release the brakes at stop lights, then the motor will start fast as possible, in this case without need for any pedal rotation.

If r0mko or others prefer to keep other forks, then please create a specific thread to discuss them. On this thread, let's discuss only my code (as explicit on the title of this thread) and the latest version.

My experience of assistance without pedal rotation is very different. Anyway, I will ask r0mko to start a new thread for his fork as you request.

Your new project looks very cool, good luck with it
 
casainho said:
randy_cena said:
hello guys , i have a question that why the opensource code is based on the motor tsdz2 instead of bafang motor . so what is the difference between the main products of tongsheng and bafang?
Because no one did the firmware for Bafang. I tried to look at it and I wrote my notes here: https://github.com/OpenSource-EBike-firmware/Bafang_BBS02_BBSHB/wiki

NOTE: this motor controllers seems to have 2 microcontrollers, one probably to deal with the display only and run the ebike logic and other specific to control the motor. There are no developing tools for the one that controls the motor so no possible to develop firmware.

I think this is a chinese clone of the Renesas (formerly NEC) D79F9211, sometimes branded as a X8M06, well known from the old KU63 controllers. 44 Pin LQFP package.

Thanks for replying me, i am so excited because i have seen the code in github and some test video in youtube ,you are so amazing and talented ,i did't expect that you will have time to reply me cause i think my question may look simple and unprofessional . I am a junior student majors in Electrical engineering and automation in China . I am interested in your project and admire your skill about the hardware and software. you are such a pro to me. Also i have consulted someone who knows about the e-bike market abroad, he says bafang is quite popular and relatively famous compared to tongsheng especially in USA, and bafang has more product line of mid-drive motor(i am not advertising :wink: ). one thing confuses me is that in terms of the function and performence of these two brands motors, which is better.
besides ,bafang company is just in the city where i study, i may have the chance to visit that company and consult some
technicians there. if i have some useful imformation i will tell you to help your development in the firmware for bafang.
last but not least, thanks for your reply :D
 
casainho said:
1. Install this alpha.3 version
2. On the display, enable the lights as usual
3. Go to configurations, Technical and see the very first value of "ADC battery current / ADC bat cu". This is the amount of current your lights pull.
The values were 0 <-> 1
4. Go to configurations, Various and on "ADC lights offset / ADC lights", set the previous value. I do not expect to be more than 4. And please report here the value you did configure.
Please report here if this worked and please test later on 4. every value from 0 to 4 and see what works and not so maybe I can use a fixed value and remove this configuration OR use as default value.


Unfortunately, all values (0,1,2,3 and 4) do not work :(
light - works
engine - not working

I don't know if it's important but ...
When the light is on I cannot change the value in "Various" ... (error on the display). I had to change values when the light was off.
 
TSDZ2 virtual throttle

I implemented the virtual throttle feature, now we don't need a physical throttle installed. I think this feature may be useful for the ones that use sporadically the throttle and may prefer to not install it and have the handler bars less cluttered - or others like me that have the motor temperature sensor installed.

Check the video to see this feature working. You can also see:

NOTE: the noise is the bicycle tire rubbing on the training rollers.

1. (0:03) quick enter on the MAX POWER configuration
2. (0:07) after 1., quick enter on the VIRTUAL THROTTLE mode - throttle value not increasing because assist level is 0
3. (0:24) throttle now increases because assist level is higher than 0. Note that first user need to do long press on UP button for first value increase, this is a safety measure
4. (0:38) as throttle increases in steps of 5%, the motor current also increases
5. (1:17) the motor speed goes up to 655 ERPS when the PWM goes over up to 107 (the max value would be 111). The nominal motor speed 525 ERPS (4000 RPM) --> pedal cadence 90 RPM but here the motor is running with Field Weakening and so is achieving +25% motor speed. Note that PWM and motor speed fields transition the color to yellow and red and the values approach the limit
6. (1:47) on configurations screen, changing the virtual throttle increase/decrease step from 5 to 1
7. (2:00) increase throttle now with steps of 1%
8. (2:35) releasing the UP or DOWN buttons and the throttle value goes to 0, this is a safety measure

[youtube]vtmDy7YFLvQ[/youtube]

Changelog:
- added virtual throttle: user can use UP and DOWN buttons to increase throttle value (from 0 to 100%). User must keep pressed UP or DOWN buttons, otherwise, after one second the throttle value goes to 0 (this works as a security measure)
- added configuration for virtual throttle increase/decrease steps in %

Download here the new version v1.0.0-alpha.4: https://github.com/OpenSource-EBike-firmware/Color_LCD/releases/tag/860C_850C_SW102_v1.0.0-alpha.4
 
casainho said:
TSDZ2 virtual throttle

I implemented the virtual throttle feature, now we don't need a physical throttle installed. I think this feature may be useful for the ones that use sporadically the throttle and may prefer to not install it and have the handler bars less cluttered - or others like me that have the motor temperature sensor installed.

This implies that the physical throttle is also fixed? i just want to confirm before i flash and test it
 
ezrider1199 said:
casainho said:
TSDZ2 virtual throttle
I implemented the virtual throttle feature, now we don't need a physical throttle installed. I think this feature may be useful for the ones that use sporadically the throttle and may prefer to not install it and have the handler bars less cluttered - or others like me that have the motor temperature sensor installed.
This implies that the physical throttle is also fixed? i just want to confirm before i flash and test it
It will run the motor using the highest throttle value from both physical and virtual. Let's say physical is 0 if you do not touch it, then only virtual will take effect

I don't have a physical throttle so I did not test it, please be careful.
 
casainho said:
ezrider1199 said:
casainho said:
TSDZ2 virtual throttle
I implemented the virtual throttle feature, now we don't need a physical throttle installed. I think this feature may be useful for the ones that use sporadically the throttle and may prefer to not install it and have the handler bars less cluttered - or others like me that have the motor temperature sensor installed.
This implies that the physical throttle is also fixed? i just want to confirm before i flash and test it
It will run the motor using the highest throttle value from both physical and virtual. Let's say physical is 0 if you do not touch it, then only virtual will take effect

I don't have a physical throttle so I did not test it, please be careful.


Just flashed it. Weather is bad around here so i was testing in the long hallway of my apartment building. Everything seems excellent. I enabled field weakening. I was able to get the pwm above 100. There was no on/off lurching with the throttle even when starting from high gear. Bike was behaving predictably. One minor bug is that immediately after flashing and setting all my options/values, I wasnt getting any power from the throttle despite the PWM value rising when pressing the throttle. I had to powercycle the bike and then i was able to get power from the throttle. So yeah minor bug, the description of it is probably more intensive than the bug itself. Also the torque calibration is enabled by default now which wasnt the case in the earlier firmwares i believe. Will take it outside when the weather clears up but I really like it so far. Thanks!!!
 
ezrider1199 said:
Just flashed it. Weather is bad around here so i was testing in the long hallway of my apartment building. Everything seems excellent. I enabled field weakening. I was able to get the pwm above 100. There was no on/off lurching with the throttle even when starting from high gear. Bike was behaving predictably. One minor bug is that immediately after flashing and setting all my options/values, I wasnt getting any power from the throttle despite the PWM value rising when pressing the throttle. I had to powercycle the bike and then i was able to get power from the throttle. So yeah minor bug, the description of it is probably more intensive than the bug itself. Also the torque calibration is enabled by default now which wasnt the case in the earlier firmwares i believe. Will take it outside when the weather clears up but I really like it so far. Thanks!!!
Thanks for the feedback.

I will check for that minor issues. Torque sensor calibration enabled by default, looking at the code it should not and I tested 3 times reseting the defaults on 860C and it never enables this feature.
 
ok virtual throttle is a funny feature. :thumb:

after enabling it, how do i get back to assist mode? long press UP and POWER only cycles between max power and throttle mode.
 
raw said:
ok virtual throttle is a funny feature. :thumb:

after enabling it, how do i get back to assist mode? long press UP and POWER only cycles between max power and throttle mode.
Long press on/off button.

I need now to write the features and configurations page.
 
casainho said:
New firmware: TSDZ2 cadence increase from 90 to 120 RPM as also motor power "amplification" on this same high cadence

You guys get ready for the most advanced and powerful TSDZ2 firmware!!


This is the first time I made the version as 1.0.0 because all major features about TSDZ2 motor control are now implemented like FOC and Field Weakening. Also on the display side, I don't plan any new big changes.
There certainly features that can be added in future versions like 1.1.0 and polish the current ones, and I plan to do that.

Would this be considered a "simplified FOC" or was there some testing done for optimization?

Very exciting stuff!!
 
Back
Top