New "TSDZ2 Torque Sensor Central Motor"

casainho said:
Done on the LCD side. We can quick configure max battery power usage by clicking on buttons onoff + up. Long click on onoff button to leave.

That value we see on LCD is sent to the motor controller. Now I just need to grab that value on motor controller side and set it.

Casainho, am I reading the Youtube vid correctly that you can set each assist levels max wattage ? That would be cool if you can as we can then fully customise each level to suit our riding terrain, which at the moment we cannot do as its very dependent on the battery voltage level of the moment.

I'm just about to order the LCD3, are we definately in a position to get on with some good testing for you ?

By the way thanks for all the work you are doing, this should really make this little engine something special.
 
echew said:
My battery arrived! :D

Just wanted to say thanks to recycles-ebike.com for a such a speedy delivery!

I'm based in NZ and my delivery times were:

- 13 days from placing order for the TSDZ2 motor
- 16 days from placing order for the battery

I'm not sure why but I ordered a battery 3 days ago, but there was no info, message or whatever on that. :(. Paid and i"m really concern about this in the events of support....

Not sure what happen.
 
Done!! Although there is a bit of oscillation on the wheel and power that I wans't expecting, anyway, very good for the first iteration.

The throttle at my left hand was always at max position. My lab power supply was setup for 45V and it can't give more than 5 amps, so max power could not be more than 225W, that is why I didn't tested with a higher value.

So, on LCD I was setting the target max power (when we see the value blinking and I increase/decrease in steps of 50) and the throttle was at full/max position, although as we can see, the firmware on the motor controller controls the motor current and hence the motor power in a way the power don't pass (to much) the defined max value:

[youtube]F4RdW0Mr2YA[/youtube]
 
I did a quick test of battery voltage vs max engine rpms today. Going up and down my street (which has a very slight grade for water drainage).

56v = 10.6 mph uphill, 11.8 mph downhill
49v = 9.6 mph uphill, 10.8 mph downhill

The test would have been better with a lower gear but this is our first gear. At both voltages we top out between 15-20mph in higher gears so that is not a factor. So it appears cadence is in fact effected by battery voltage. The increase from 49v to 56v gives an additional 10 rpm or so, so I would assume running at 63v (the controller capacitor maximum voltage) would likely increase cadence by another 10 rpm. If 48v cadence is about 90 then 63v cadence should be 110 or so, at least from my very limited experiment.
 
wired a speed sensor cable to flash my controller and worked like magic! I used the 5v input and didn't have the battery hooked up, and it all worked fine. Thank you Casainho for all your fantastic work on this project!

I'm just about to flash the firmware via Linux for the LCD3, I soldered the pins and have it powered on, but am getting an error after the following:

stm8flash -c stlinkv2 -p stm8s105?6 -w LCD3_TSDZ2_firmware_v1.bin
Determine FLASH area
Due to its file extension (or lack thereof), "LCD3_TSDZ2_firmware_v1.bin" is considered as RAW BINARY format!
16365 bytes at 0x8000... Tries exceeded

I have it pined correctly...not sure what else to try (maybe resoldering the pin connectors, I did run out of solder and it was a small space to work in. Is the flash script correct?

Looking at Casinoho's notes, I understood that the TDSZ2 controller uses a STM8S105S4T6C chip and the LCD3 uses a larger STM8S105C6T6 that has 32kbytes of flash memory rather than 16.

I'm a little new to Linux, and I didn't see any instructions to remove write protection.

I'm also curious if it's possible to re-flash the original LCD5 firmware. I'm out of resources on my own today to troubleshoot and was curious for more insight.

Thanks!
 

Attachments

  • 20180607_211331.resized.jpg
    20180607_211331.resized.jpg
    62.7 KB · Views: 2,361
  • 20180607_215523.resized.jpg
    20180607_215523.resized.jpg
    58.2 KB · Views: 2,361
pawepie said:
wired a speed sensor cable to flash my controller and worked like magic! I used the 5v input and didn't have the battery hooked up, and it all worked fine. Thank you Casainho for all your fantastic work on this project!

I'm just about to flash the firmware via Linux for the LCD3, I soldered the pins and have it powered on, but am getting an error after the following:

stm8flash -c stlinkv2 -p stm8s105?6 -w LCD3_TSDZ2_firmware_v1.bin
Determine FLASH area
Due to its file extension (or lack thereof), "LCD3_TSDZ2_firmware_v1.bin" is considered as RAW BINARY format!
16365 bytes at 0x8000... Tries exceeded

I have it pined correctly...not sure what else to try (maybe resoldering the pin connectors, I did run out of solder and it was a small space to work in. Is the flash script correct?

Looking at Casinoho's notes, I understood that the TDSZ2 controller uses a STM8S105S4T6C chip and the LCD3 uses a larger STM8S105C6T6 that has 32kbytes of flash memory rather than 16.

I'm a little new to Linux, and I didn't see any instructions to remove write protection.

I'm also curious if it's possible to re-flash the original LCD5 firmware. I'm out of resources on my own today to troubleshoot and was curious for more insight.
I am pretty sure you can't flash LCD3 firmware because the firmware is protected and it needs first to be erased. Hmmm, so I didn't put the information on how to unprotect thr STM8 - here it is:

https://opensourceebikefirmware.bitbucket.io/INSTALL_FIRMWARE--Tools_build_and_flash_firmware--How_to_erase_and_unlock_protected_read_memory.html

Well, but I think you should choose a different value for that option bytes in a way that PWM channel will not be enabled - you just need to look at STM8 datasheet to see what are the default values.
 
Hello everyone.

This is my first post to Endless Sphere. I installed a TSDZ2 on my bike last Aug after discovering this forum. As of today it has done 2282 trouble-free km. I had been an avid cyclist for 70 odd years before surgery and chemo therapy knocked the starch out of me last year. The electric assist is helping me to regain my strength and stamina. I'm currently using level 2 about 70-80% of the time, using only levels 3 or 4 when I run out of gears or steam. My goal is to get down to level 1 before the snow returns. What I need is an objective way to plot my progress.

So here's a proposal. How about adding data logging capability to the LCD3 display, similar to Grin Tech's CA2/CA3. Here's a reference to the CA3: https://endless-sphere.com/forums/viewtopic.php?f=2&t=91409&p=1335971&hilit=data+logger#p1332621

At first glance it looks easy and inexpensive to do. Casainho has already done most of the hard work. His firmware can display motor power, human power, total energy in W-h, cadence and so on. Is it possible to send that same data out on a serial line? If the answer is yes then an inexpensive data logger such as Sparkfun's Openlog should be able store it without too much effort on the part of the programmer https://www.sparkfun.com/products/13712

Of course there will always be a problem. Offhand I can think of two. The first is finding physical access to the I/O pins on the LCD3's processor. A recent post mentioned that the circuit board is covered in hard potting compound that's hard to remove. The second is whether the processor has enough speed and RAM and uarts to run the extra code.

Anyway it could be a useful add-on for us data junkies looking to optimize the performance of either their electric motors or their human ones. Thoughts?
 
angusinalberta said:
Hello everyone.

This is my first post to Endless Sphere. I installed a TSDZ2 on my bike last Aug after discovering this forum. As of today it has done 2282 trouble-free km. I had been an avid cyclist for 70 odd years before surgery and chemo therapy knocked the starch out of me last year. The electric assist is helping me to regain my strength and stamina. I'm currently using level 2 about 70-80% of the time, using only levels 3 or 4 when I run out of gears or steam. My goal is to get down to level 1 before the snow returns. What I need is an objective way to plot my progress.
Good!!

angusinalberta said:
So here's a proposal. How about adding data logging capability to the LCD3 display, similar to Grin Tech's CA2/CA3. Here's a reference to the CA3: https://endless-sphere.com/forums/viewtopic.php?f=2&t=91409&p=1335971&hilit=data+logger#p1332621

At first glance it looks easy and inexpensive to do. Casainho has already done most of the hard work. His firmware can display motor power, human power, total energy in W-h, cadence and so on. Is it possible to send that same data out on a serial line? If the answer is yes then an inexpensive data logger such as Sparkfun's Openlog should be able store it without too much effort on the part of the programmer https://www.sparkfun.com/products/13712
Technically is very easy to implement that with our improved original firmware, because all of that data is already sent to the LCD3 by the serial line.
With an Arduino, I would connect TSDZ2 motor controller TX line that goes to LCD, to also the Arduino so Arduino could read and log the data to a microSDCard. Or Arduino can resend the data to Bluetooth with a cheap module and the log can then be saved on Android.
In fact, I am doing this kind of things to debug while development the firmware.

angusinalberta said:
Of course there will always be a problem. Offhand I can think of two. The first is finding physical access to the I/O pins on the LCD3's processor. A recent post mentioned that the circuit board is covered in hard potting compound that's hard to remove. The second is whether the processor has enough speed and RAM and uarts to run the extra code.

Anyway it could be a useful add-on for us data junkies looking to optimize the performance of either their electric motors or their human ones. Thoughts?
It is the XH18-LCD of TSDZ2 circuit board that is covered in hard potting compound but LCD3 don't has any potting and so is very easy to access.
Anyway, I think that best idea is just to connect in parallel to the wire that comes from TSDZ2 motor controller to the LCD3, that that means no need to open or wire anything inside LCD3.
 
Just a FYI note.
I ordered the 48v, 750W version with VLCD , throttle , lights etc,..from Ebird store via Aliexpress.
$379 with free shipping .
Ordered on June 10 th, arrived today June 19th....9 days door to door (and 5 days of that was customs clearance !)
Just checking things out now befor i try the install on a Specialised FSR .
 
Hi guys,
i am kind of new to the ebike "business" and need a tip.
i want to convert my old street bike to an electric street racer.
my idea is to put an tsdz2 and a 13S5P 13Ah battery on the bike.
i want to drive at about 40km/h on the flat while pedalling.
my assumption is that i can put in about 200 watt constant by myself.
so about 250 watts needed from the motor.
cadence should be about 80-100rpm.
now my question:
is it better to use the 36v tsdz2 (with firmware hack by casainho, thanks for that!!) or the 48v tsdz2 for my needs?
which one is more efficient in this use case? any overheating problems?
thanks for your help
cheers
 
On the firmware version of the previous video, I was not very happy because the current was oscillating a bit as also the wheel speed. Now I improved the current controller, because it was actuating to fast that what hardware can read.

Here is a real time log of motor speed in ERPs (green line), voltage on the motor phases (duty_cycle, purple line) and the battery_current (torque, green line).
On left side, running with previous firmware and on right side the improved firmware (the same conditions).
Current controller sets the voltage on the motor phases so the current/torque is stable.

Still it has some very little oscillation, I think that will not be noticeable because even the torque sensor signal value will also be oscillating, the load of the ebike, etc.



Adjusting in real time the desired power in watts. The real power value that is measured and also the measured battery current in amps are also shown on the LCD:
[youtube]1hMBvAP-LgY[/youtube]
 
vscope said:
Hi guys,
i am kind of new to the ebike "business" and need a tip.
i want to convert my kona rove al street bike to an electric street racer.
my idea is to put an tsdz2 and a 13S5P 13Ah battery on the bike.
i want to drive at about 40km/h on the flat while pedalling.
my assumption is that i can put in about 200 watt constant by myself.
so about 250 watts needed from the motor.
cadence should be about 80-100rpm.
now my question:
is it better to use the 36v tsdz2 (with firmware hack by casainho, thanks for that!!) or the 48v tsdz2 for my needs?
which one is more efficient in this use case? any overheating problems?
thanks for your help
cheers

40kph = 25mph. That is a bit fast but depending on how much weight you will be pushing (and how hard you will be pedaling) it may be doable. 25mph is a bit too fast for me pushing myself and Cecil and bike (270lbs total), but I also never tested my speedometer calibration so my results may be off a bit. For us about 20mph is sustainable and 25mph is a lot of work. We have a 48v 750w motor and I am using a 14s battery (but undercharged to 56v max due to not hacking the bios yet).

I would suggest getting the 52v 750w motor. Another user has reported that the cadence is a bit higher than on the 48v engine so it apparently uses the same 48v motor winding. I would also go with a 14s battery. By running in the 58.8v - 42v range your max engine rpm (cadence) should be in the 100 (full battery) - 80 (depleted battery) range as you requested.
 
Thanks for the reply! Update: I wired it nicely with an external JST connector so I don't have to open it up each time I flash. Also, I think your instructions may be backward (at least they were for me)

You wrote:
The connections to STLinkV2 clone:
• pin1: do not connect
• pin2: connect to STLinkV2 RST pin
• pin3: connect to STLinkV2 GND pin
• pin4: connect to STLinkV2 SWIM pin

I had
PIN1 (not connected)
PIN2 SWIM
PIN3 GND
PIN4 RST

(in the same order from left to right as the KT-S controllers and it worked for me.
Well, I do indeed need to flash the option bytes now to remove write protection.

I'm going to try factory defaults first, as I don't know how to only modify certain values (and I don't understand the Alternate Function Remapping that your values seems to do. I will report back!

I'll be doing
echo "00 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes_pwm_n_channels_enabled.bin
instead of
echo "00 00 ff 20 df 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes_pwm_n_channels_enabled.bin

controller datasheet here:
https://www.mouser.com/datasheet/2/389/stm8s105c4-956362.pdf

there are more bytes to be written, but I'm not sure how to skip bytes to actually "factory reset" it.

UPDATE: I flashed the option bytes of the "factory reset (though I know I'm missing the last values, but then was unable to use the keys to power up the display. I wired in PIN1 into 5v from my STLinkV2 and was able to flash the lightly recommended OPT bytes.
I then flashed the LCD3_TSDZ2_firmware_v1.bin and when I power it up, it everything is just "ON" and no buttons respond.

Any suggestions on how to proceed? Perhaps I need to flash new option bytes?
 
pawepie said:
Will update on what happens!
Yes, this should work:
Code:
echo "00 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes.bin

Well, maybe the erase will simple put that default values and so no need to write option_bytes after erase.

The Alternate Function Remapping I use is for define some pins to work as PWM mode. It just works like that, I am doing that on both KT motor controllers firmware as also onTSDZ2 motor controller.
 
hmm...just did this:

echo "00 00 ff 20 df 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes_pwm_n_channels_enabled.bin
sudo stm8flash -c stlinkv2 -p stm8s105?6 -s opt -w option_bytes_pwm_n_channels_enabled.bin
Determine OPT area
Due to its file extension (or lack thereof), "option_bytes_pwm_n_channels_enabled.bin" is considered as RAW BINARY format!
15 bytes at 0x4800... OK
Bytes written: 15

stm8flash -c stlinkv2 -p stm8s105?6 -w LCD3_TSDZ2_firmware_v1.bin
Determine FLASH area
Due to its file extension (or lack thereof), "LCD3_TSDZ2_firmware_v1.bin" is considered as RAW BINARY format!
16365 bytes at 0x8000... OK
Bytes written: 16365

note, I made sure and re-flashed the TSDZ2_improved_original_firmware-v3.bin firmware for the controller.
Throttle and brakes both work, but assist via torque sensors doesn't seem to work (at least with hand force...didn't try going on the bike).

and have the same result (stays powered on with backlight and symbols and does not respond). Are my option bytes different from yours on the LCD3? Are they identical to the KT-S controllers? Curious where the error might be.
 
pawepie said:
hmm...just did this:

echo "00 00 ff 20 df 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes_pwm_n_channels_enabled.bin
sudo stm8flash -c stlinkv2 -p stm8s105?6 -s opt -w option_bytes_pwm_n_channels_enabled.bin
Determine OPT area
Due to its file extension (or lack thereof), "option_bytes_pwm_n_channels_enabled.bin" is considered as RAW BINARY format!
15 bytes at 0x4800... OK
Bytes written: 15

stm8flash -c stlinkv2 -p stm8s105?6 -w LCD3_TSDZ2_firmware_v1.bin
Determine FLASH area
Due to its file extension (or lack thereof), "LCD3_TSDZ2_firmware_v1.bin" is considered as RAW BINARY format!
16365 bytes at 0x8000... OK
Bytes written: 16365

and have the same result (stays powered on and does not respond). Are my option bytes different from yours on the LCD3? Are they identical to the KT-S controllers?
Hmmmm, I think I didn't uploaded latest LCD3 version firmware.
Anyway, it waits to receive first communication from the controller other way will stay all symbils enabled.
 
I added V3 to this folder: https://github.com/OpenSource-EBike-firmware/Kunteng_LCD3_firmware/tree/master/firmware

That is the latest version for LCD3.
 
casainho said:
and have the same result (stays powered on and does not respond). Are my option bytes different from yours on the LCD3? Are they identical to the KT-S controllers?
Hmmmm, I think I didn't uploaded latest LCD3 version firmware.
Anyway, it waits to receive first communication from the controller other way will stay all symbils enabled.
[/quote]
So, flash LCD3 firmware V3 as also TSDZ2 motor controller improved original firmware V3. For TSDZ2 you need to flash also the option bytes and the EEPROM other way it will not work!!

LCD3 starts with all symbols set and just after receiving a communication from TSDZ2, will start showing information. So TSDZ2 must also be working!
 
John and Cecil said:
I would suggest getting the 52v 750w motor. Another user has reported that the cadence is a bit higher than on the 48v engine so it apparently uses the same 48v motor winding. I would also go with a 14s battery. By running in the 58.8v - 42v range your max engine rpm (cadence) should be in the 100 (full battery) - 80 (depleted battery) range as you requested.

Has this higher cadence been confirmed on the 52v version?
 
Hmm....I downloaded the latest v3 LCD3 firmware (thanks!), flashed successfully, and then made sure to flash my TSDZ2 controller as follows below (I actually edited a value in the eeprom to work with 52V).

Same result :( (throttle and brake work, but display is all on (no backlight this time)): doesn't respond to signals, and no torque sensing (probably since assist is at zero)

echo "00 00 ff 20 df 00 ff 00 ff 00 ff 00 ff 00 ff" | xxd -r -p > option_bytes_pwm_n_channels_enabled.bin
stm8flash -c stlinkv2 -p stm8s105?6 -s opt -w option_bytes_pwm_n_channels_enabled.bin
stm8flash -c stlinkv2 -p stm8s105?6 -w LCD3_TSDZ2_firmware_v3.bin

stm8flash -c stlinkv2 -p stm8s105?4 -w TSDZ2_improved_original_firmware-v3.bin
stm8flash -c stlinkv2 -p stm8s105?4 -s eeprom -w TSDZ2_48V_original_firmware_eeprom.bin
stm8flash -c stlinkv2 -p stm8s105?4 -s opt -w TSDZ2_48V_original_firmware_option_bytes.bin

I tried editing option bytes for TSDZ2 so values were 00 00 ff 20 df.....instead of 00 00 ff 28 d7..., and brakes and throttle didn't work that time :( (neither did the display)

Are you using a custom option bytes for the TDSZ2?
 
dojrude said:
John and Cecil said:
I would suggest getting the 52v 750w motor. Another user has reported that the cadence is a bit higher than on the 48v engine so it apparently uses the same 48v motor winding. I would also go with a 14s battery. By running in the 58.8v - 42v range your max engine rpm (cadence) should be in the 100 (full battery) - 80 (depleted battery) range as you requested.

Has this higher cadence been confirmed on the 52v version?

The cadence appears to be a product of motor winding and voltage. From statements made earlier in this thread the 52v version is the same as a 48v version except it is flashed to allow the use of a higher voltage battery. I believe eyebyesickle clained the higher cadence with the 52v motor running at higher voltages. I have tested my 48v motor at different voltages and motor rpms are substantially higher when running my 48v motor at 56v as opposed to 48v. Apparently the more volts you give it the faster it will spin. I really want to remove the upper voltage limit in the firmware and try a 15s battery. Casainho claims the capacitors are rated to 63v which just happens to be the max voltage of a 15s battery.
 
pawepie said:
Same result :( (throttle and brake work, but display is all on (no backlight this time)): doesn't respond to signals, and no torque sensing (probably since assist is at zero)

Are you using a custom option bytes for the TDSZ2?
If no backlight, that means it is working as it starts with backlight off.

The firmware blocks here:
Code:
uint8_t first_time_management (void)
{
  uint8_t ui8_status = 0;

  // don't update LCD up to we get first communication package from the motor controller
  if (ui8_motor_controller_init &&
      (uart_received_first_package () == 0))
  {
That is so you know when you can start ride the ebike, as before that, TSDZ2 motor controller seems to make calibrations like for torque sensor. So, LCD all symbols will be enabled up to receive the first communication package from TSDZ2 motor controller -- I guess you maybe swapped the TX for RX line -- please try to exchange them.
 
John and Cecil said:
The cadence appears to be a product of motor winding and voltage.

This is correct. This is how overvolters build 60mph e-bikes with hub motors. Although I have not seen any winding specs for these TSDZ2 motors it is clear that the 48v motor has more windings than the 36v such that it spins slower at higher volts. It is most likely that they are wound to have the same RPMs at their respective voltages. Feed 48 or 52v into the 36v motor that has fewer windings and it will spin faster. Feed 36v into the 48v motor that has more windings and it will spin painfully slow.
 
Back
Top