New "TSDZ2 Torque Sensor Central Motor"

Discussions related to motors other than hub motors.
This includes R/C motors, botttom bracket, roller and geared drives.
beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 29 2021 10:12am

beemac wrote:
Mar 27 2021 5:12pm
casainho wrote:
Mar 27 2021 3:18pm
beemac wrote:
Mar 27 2021 12:54pm
Having weird torque sensor issues on a new motor. Using the 860c to calibrate - either the ADC value is really high (900+) and slowly falls. Or if I can get it to stabilize at, say 170 with no load on the pedals.. Then if I apply load - the value increases but very slightly - e.g. with me standing on the pedals (105kg) maybe rises to 180 - then takes a long time to fall back to the starting value...

Anyone seen similar? Any ideas other than to replace torque sensor/motor. Sod's law it's a motor i've already installed the temp sensor on - so no hope of any warranty...
You really need to check your torque sensor, I saw that kind of issues with a broquen one...
Thanks, yes I think sadly that's looking like it's the case - I've tried lots of things and it's still the same... have another motor on order then I'll dig into this one and see if I can find the problem.

What's interesting though is how the motor behaves.... Turning the pedals briefly the motor runs (fast) and stops - but turning for more than about 3/4 of a turn it runs away at a crazy rate only stopping when you use the brakes - on the 860 the motor rpm and pwm values go into the red - riding it is quite alarming, the acceleration is pretty dramatic. Motor heats up pretty quick too...

I wonder if there's a filter/threshold on the torque adc that's not working properly - as if you didn't have good brakes/brake sensors - it would be quite a rollercoaster :)
I've replaced the motor controller and now the torque ADC is reading sensible values - so looks like sensor was ok..

However - I now cannot get any assist whatsoever in any level. Walk assist works ok - so not a motor problem.

Looks like a software issue - but I've flashed back to release versions - no change...

I have mucked about with settings a lot whilst I was trying to work out what was going on - so that's my primary suspect - but i've put those back (and cleared app cache to boot). Brake sensors all working properly - otherwise walk assist wouldn't work...

What setting/combo of settings would cause no assist in any level...

This is running the wireless controller - but didn't want to jump threads :)

edit: I'll move this to teh wireless thread - think it's to do with the wireless controller rather than a hardware issue...

mctubster   100 W

100 W
Posts: 294
Joined: Feb 26 2018 6:21am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by mctubster » Mar 29 2021 2:35pm

beemac wrote:
Mar 29 2021 10:12am

What setting/combo of settings would cause no assist in any level...
Low battery cutoff?

JohnAnanda   10 mW

10 mW
Posts: 25
Joined: Mar 13 2021 10:50am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by JohnAnanda » Mar 29 2021 5:08pm

Is there a graph of torque vs RPM available for the TSDZ2 ?
I would like to know at which RPM do we have peak power and peak efficiency. I assume the field weakening introduced in the latest versions of the firmware hasn't changed theses values.

Waynemarlow   10 kW

10 kW
Posts: 598
Joined: Jul 09 2016 7:22am
Location: Bucks, England

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by Waynemarlow » Mar 30 2021 3:14am

On some units when reprogramming and I 've had no assist in any levels after progamming, I've had to reprogram the Options Byte page. Not sure why but it seems to work.

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 30 2021 4:08am

Waynemarlow wrote:
Mar 30 2021 3:14am
On some units when reprogramming and I 've had no assist in any levels after progamming, I've had to reprogram the Options Byte page. Not sure why but it seems to work.
Cheers - i think it's probably related to stuff I was testing with street mode... need to roll back some things.

Zeroing option a good idea - better than mine; to troubleshoot I copied the data/program/option bytes from my working bike and as soon as I flashed them the motor ran at 100% and could only be stopped with power off... was very glad it was up on the stand! :)

Waynemarlow   10 kW

10 kW
Posts: 598
Joined: Jul 09 2016 7:22am
Location: Bucks, England

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by Waynemarlow » Mar 30 2021 8:43am

Yes as a routine I now copy 0's to both the program and memory pages to ensure that there are no bits in there which are not supposed to be. I then copy over the new program.

I have raised this issue before but really do not understand why we at times need to reprogram the Options page to get assist back.

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 30 2021 11:14am

Waynemarlow wrote:
Mar 30 2021 8:43am
Yes as a routine I now copy 0's to both the program and memory pages to ensure that there are no bits in there which are not supposed to be. I then copy over the new program.

I have raised this issue before but really do not understand why we at times need to reprogram the Options page to get assist back.
Turns out this was my issue - https://github.com/OpenSourceEBike/TSDZ ... ensor_fail

Torque sensor working fine - but cadence sensor not reading anything... pushed down on the connector for the PAS sensor under all the rubber and started working... :)

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 30 2021 12:51pm

Waynemarlow wrote:
Mar 30 2021 8:43am
Yes as a routine I now copy 0's to both the program and memory pages to ensure that there are no bits in there which are not supposed to be. I then copy over the new program.

I have raised this issue before but really do not understand why we at times need to reprogram the Options page to get assist back.
You should upgrade to the motor software 1.1.1 (https://github.com/OpenSourceEBike/TSDZ ... v1.1.1.hex) - That contains some changes to the way serial is handled as as result of the epic 'assist level 3' issue I worked on - since then I've never had an issue where I had to reflash to get the motor working - whereas I had to do that a few times before. In earlier versions corrupt serial data - or incomplete data e.g. when you connected/reconnected the 6/8 pin cable powered on could potentially overwrite some of the program memory and cause unexpected effects.

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 31 2021 10:23am

Yay finally got my FSR build to a working state... Still waiting on a new battery than hopefully fits in the triangle - and I've yet to work out where to place the 1200W DC booster I'm using - have it set to 58.5v at the moment - not sure if I should push it and run 60v all the time - only used it on a couple of short rides with both the booster and battery in a rucksack - but can definitely notice the difference from a standard 48v battery. Looking forward to no voltage fade on longer rides :)

Wireless controller is on the handlebar - needs a better case but is nice to have the led where I can see it.

Build is currently 17.1kg without battery - not as light as I hoped it would be but reckon I can get it down a bit... was hoping for 18kg with battery but I think it's going to be more like 20 - maybe 19 if I can get some lighter tyres and change the handlebar+crank arms...
File_013.jpeg
File_013.jpeg (5.36 MiB) Viewed 683 times
File_015.jpeg
File_015.jpeg (5.12 MiB) Viewed 683 times
File_017.jpeg
File_017.jpeg (4.48 MiB) Viewed 683 times
File_021.jpeg
File_021.jpeg (3.21 MiB) Viewed 683 times
File_024.jpeg
File_024.jpeg (3.35 MiB) Viewed 683 times

casainho   100 GW

100 GW
Posts: 5227
Joined: Feb 14 2011 2:43pm

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by casainho » Mar 31 2021 11:55am

beemac wrote:
Mar 31 2021 10:23am
Wireless controller is on the handlebar - needs a better case but is nice to have the led where I can see it.

Build is currently 17.1kg without battery - not as light as I hoped it would be but reckon I can get it down a bit... was hoping for 18kg with battery but I think it's going to be more like 20 - maybe 19 if I can get some lighter tyres and change the handlebar+crank arms...
Why don't you 3D print the wireless remote enclosure and use it? you would not use the coin battery and install the DC-DC converter near the TSDZ2 display connector.

That beautiful ebike deserves a small battery as his frame, to keep being beautiful.
For battery savings, you can make your own and save weight and volume by choosing the materials: a smaller BMS, enclosure materials and other parts.
Also very important is to have like one small / lighter and other big battery, so you can use the lighter one daily and the bigger one for some special day like for long ride. There are way to make a quick install / remove fix for the battery.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 31 2021 12:10pm

casainho wrote:
Mar 31 2021 11:55am
beemac wrote:
Mar 31 2021 10:23am
Wireless controller is on the handlebar - needs a better case but is nice to have the led where I can see it.

Build is currently 17.1kg without battery - not as light as I hoped it would be but reckon I can get it down a bit... was hoping for 18kg with battery but I think it's going to be more like 20 - maybe 19 if I can get some lighter tyres and change the handlebar+crank arms...
Why don't you 3D print the wireless remote enclosure and use it? you would not use the coin battery and install the DC-DC converter near the TSDZ2 display connector.

That beautiful ebike deserves a small battery as his frame, to keep being beautiful.
For battery savings, you can make your own and save weight and volume by choosing the materials: a smaller BMS, enclosure materials and other parts.
Also very important is to have like one small / lighter and other big battery, so you can use the lighter one daily and the bigger one for some special day like for long ride. There are way to make a quick install / remove fix for the battery.
I did think about that - but my smallest board is quite a bit larger than just the nrf - so I don't think it will fit your design as-is unfortunately - and after building four of these boards I'm not in a hurry to solder another :)

So I'll probably just print a simple case with a lens for the led for now and when I have to build another board will try to fit in the remote case.

Thanks I am very pleased with it - took a lot of searching to find the right frame!

Yea going to be interesting what the battery is like when it arrives - went for a wallen power one in a new slightly slimmer case than the standard shark. 14s4p - hoping for just over 3kg. Making my own batteries is definitely something that's on my list - is why I got the a30t printer with the larger print size but for now I'm using off the shelf. If I end up rarely using the capacity even when only charging 80% i might make some smaller batteries for shorter rides.

casainho   100 GW

100 GW
Posts: 5227
Joined: Feb 14 2011 2:43pm

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by casainho » Mar 31 2021 12:19pm

beemac wrote:
Mar 31 2021 12:10pm
casainho wrote:
Mar 31 2021 11:55am
beemac wrote:
Mar 31 2021 10:23am
Wireless controller is on the handlebar - needs a better case but is nice to have the led where I can see it.

Build is currently 17.1kg without battery - not as light as I hoped it would be but reckon I can get it down a bit... was hoping for 18kg with battery but I think it's going to be more like 20 - maybe 19 if I can get some lighter tyres and change the handlebar+crank arms...
Why don't you 3D print the wireless remote enclosure and use it? you would not use the coin battery and install the DC-DC converter near the TSDZ2 display connector.

That beautiful ebike deserves a small battery as his frame, to keep being beautiful.
For battery savings, you can make your own and save weight and volume by choosing the materials: a smaller BMS, enclosure materials and other parts.
Also very important is to have like one small / lighter and other big battery, so you can use the lighter one daily and the bigger one for some special day like for long ride. There are way to make a quick install / remove fix for the battery.
I did think about that - but my smallest board is quite a bit larger than just the nrf - so I don't think it will fit your design as-is unfortunately - and after building four of these boards I'm not in a hurry to solder another :)

So I'll probably just print a simple case with a lens for the led for now and when I have to build another board will try to fit in the remote case.

Thanks I am very pleased with it - took a lot of searching to find the right frame!

Yea going to be interesting what the battery is like when it arrives - went for a wallen power one in a new slightly slimmer case than the standard shark. 14s4p - hoping for just over 3kg. Making my own batteries is definitely something that's on my list - is why I got the a30t printer with the larger print size but for now I'm using off the shelf. If I end up rarely using the capacity even when only charging 80% i might make some smaller batteries for shorter rides.
I mean you can put the DC-DC board outside the handle bar, on the TSDZ2 display connector. Then you could use the wireless remote enclosure.
I have batteries of 14S2P (300Wh), so, half of your battery. But you can go with like 12S2P for instance and also not use that battery DC-DC if you are ok to sacrifice a bit of battery power using the Field Weakening feature.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Mar 31 2021 1:54pm

casainho wrote:
Mar 31 2021 12:19pm
beemac wrote:
Mar 31 2021 12:10pm
casainho wrote:
Mar 31 2021 11:55am
beemac wrote:
Mar 31 2021 10:23am
Wireless controller is on the handlebar - needs a better case but is nice to have the led where I can see it.

Build is currently 17.1kg without battery - not as light as I hoped it would be but reckon I can get it down a bit... was hoping for 18kg with battery but I think it's going to be more like 20 - maybe 19 if I can get some lighter tyres and change the handlebar+crank arms...
Why don't you 3D print the wireless remote enclosure and use it? you would not use the coin battery and install the DC-DC converter near the TSDZ2 display connector.

That beautiful ebike deserves a small battery as his frame, to keep being beautiful.
For battery savings, you can make your own and save weight and volume by choosing the materials: a smaller BMS, enclosure materials and other parts.
Also very important is to have like one small / lighter and other big battery, so you can use the lighter one daily and the bigger one for some special day like for long ride. There are way to make a quick install / remove fix for the battery.
I did think about that - but my smallest board is quite a bit larger than just the nrf - so I don't think it will fit your design as-is unfortunately - and after building four of these boards I'm not in a hurry to solder another :)

So I'll probably just print a simple case with a lens for the led for now and when I have to build another board will try to fit in the remote case.

Thanks I am very pleased with it - took a lot of searching to find the right frame!

Yea going to be interesting what the battery is like when it arrives - went for a wallen power one in a new slightly slimmer case than the standard shark. 14s4p - hoping for just over 3kg. Making my own batteries is definitely something that's on my list - is why I got the a30t printer with the larger print size but for now I'm using off the shelf. If I end up rarely using the capacity even when only charging 80% i might make some smaller batteries for shorter rides.
I mean you can put the DC-DC board outside the handle bar, on the TSDZ2 display connector. Then you could use the wireless remote enclosure.
I have batteries of 14S2P (300Wh), so, half of your battery. But you can go with like 12S2P for instance and also not use that battery DC-DC if you are ok to sacrifice a bit of battery power using the Field Weakening feature.
Ah ok - is there room for the mosfet board though? Or you mean put all the power stuff in a separate enclosure? I think if I did go that route I should probably mod your design slightly to accommodate the extra bits in one enclosure...

With the DC booster I can run any battery pack in theory and get the full 60v if I want it even with 14s2p (although 2p might not give enough current unless i choose very high current cells). I recommend it for a new thing to play with - i also bought 1500/1800w versions but they appear to be very similar only differing in fuse/cooling design. The 1200W heat sink is passively cooled and pretty compact and even in a rucksack for a short run only got slightly warm... outside with air flowing over it I reckon should be fine for most conditions.

https://www.banggood.com/1200W-20A-DC-C ... 06423.html

mctubster   100 W

100 W
Posts: 294
Joined: Feb 26 2018 6:21am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by mctubster » Mar 31 2021 3:36pm

beemac wrote:
Mar 31 2021 1:54pm

With the DC booster I can run any battery pack in theory and get the full 60v if I want it even with 14s2p (although 2p might not give enough current unless i choose very high current cells). I recommend it for a new thing to play with - i also bought 1500/1800w versions but they appear to be very similar only differing in fuse/cooling design. The 1200W heat sink is passively cooled and pretty compact and even in a rucksack for a short run only got slightly warm... outside with air flowing over it I reckon should be fine for most conditions.

https://www.banggood.com/1200W-20A-DC-C ... 06423.html
Very interesting. I bought a booster a while ago but was wary of the quality of the power coming from it. I have a scope now so I can put it under load and see what it looks like.

Certainly you want to keep the set output voltage closer to the battery voltage. Only the boost voltage different over the battery voltage is subject to notable losses. Also make sure you set you battery cutoff voltage on the booster well!

You have inspired me I will dig mine out!

Cheers

Elinx   1 kW

1 kW
Posts: 481
Joined: Aug 09 2019 6:58am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by Elinx » Mar 31 2021 4:22pm

beemac wrote:
Mar 31 2021 1:54pm
....
With the DC booster I can run any battery pack i..... The 1200W heat sink is passively cooled and pretty compact and even in a rucksack for a short run only got slightly warm... outside with air flowing over it I reckon should be fine for most conditions.....
:thumb: I was thinking about this too, to feed my 36V tsdz2 (and 36V battery) with 48V, but had doubts about the DC output and heat. It is a relative cheap solution to improve tsdz2, compared to another battery.
I had planned to integrate a small Voltage display on the input, to monitor the battery Voltage, because the controller can't measure this anymore. As I understand, you had no problems with the tsdz2.

Manbeer   100 W

100 W
Posts: 175
Joined: Aug 07 2020 5:59pm

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by Manbeer » Mar 31 2021 7:44pm

that FSR is beautiful and the weight really is pretty decent with the dropper and heavy flat pedal. I am doing a weight weenie build right now and trying to keep it on a budget but its like an endless spiral thats exponentially more past a certain point.

The TS i have on the m2 stumpjumper didnt clear the carbon hardtail frame i picked so im going rear hub on this one with a g310, 7/15a controller and a 13s2p 21700 pack.

https://bicyclemotorworks.com/product/e ... i-52v-8ah/

something like this stuffed in a seat bag would probably not be a bad setup for you for shorter rides if you are trying to keep the weight down

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Apr 01 2021 3:25am

mctubster wrote:
Mar 31 2021 3:36pm
beemac wrote:
Mar 31 2021 1:54pm

With the DC booster I can run any battery pack in theory and get the full 60v if I want it even with 14s2p (although 2p might not give enough current unless i choose very high current cells). I recommend it for a new thing to play with - i also bought 1500/1800w versions but they appear to be very similar only differing in fuse/cooling design. The 1200W heat sink is passively cooled and pretty compact and even in a rucksack for a short run only got slightly warm... outside with air flowing over it I reckon should be fine for most conditions.

https://www.banggood.com/1200W-20A-DC-C ... 06423.html
Very interesting. I bought a booster a while ago but was wary of the quality of the power coming from it. I have a scope now so I can put it under load and see what it looks like.

Certainly you want to keep the set output voltage closer to the battery voltage. Only the boost voltage different over the battery voltage is subject to notable losses. Also make sure you set you battery cutoff voltage on the booster well!

You have inspired me I will dig mine out!

Cheers
Yea I can't vouch for the quality of the power as not looked at it under a scope - hopefully isn't too bad! My new battery will be 52v so I keep the boost to minimum to keep losses low.

I need to do a bit more setup - haven't changed the cutoff and would have probably forgotten had you not mentioned - thanks! I also twiddled the constant current pot before I realised what it was - i think it's set to max now but I need to find a test load to check it's not going to limit current...
Elinx wrote:
Mar 31 2021 4:22pm
beemac wrote:
Mar 31 2021 1:54pm
....
With the DC booster I can run any battery pack i..... The 1200W heat sink is passively cooled and pretty compact and even in a rucksack for a short run only got slightly warm... outside with air flowing over it I reckon should be fine for most conditions.....
:thumb: I was thinking about this too, to feed my 36V tsdz2 (and 36V battery) with 48V, but had doubts about the DC output and heat. It is a relative cheap solution to improve tsdz2, compared to another battery.
I had planned to integrate a small Voltage display on the input, to monitor the battery Voltage, because the controller can't measure this anymore. As I understand, you had no problems with the tsdz2.
So far no issues but I've only gone a few miles as a test - the voltage/soc reading is a bit of a pain - as you say the controller has no idea of battery state any more. If I start to use the DC booster regularly I'm planning to add support for a 2nd SOC sensor on the wireless controller so you can tell the software to use either the built in SOC sensor - or the alternative that can be placed between the battery and DC booster - either as a patch or hopefully included in the main code if casainho agrees - but tbh there are many other changes that are more important than that so might be a while.

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Apr 01 2021 3:36am

Manbeer wrote:
Mar 31 2021 7:44pm
that FSR is beautiful and the weight really is pretty decent with the dropper and heavy flat pedal. I am doing a weight weenie build right now and trying to keep it on a budget but its like an endless spiral thats exponentially more past a certain point.

The TS i have on the m2 stumpjumper didnt clear the carbon hardtail frame i picked so im going rear hub on this one with a g310, 7/15a controller and a 13s2p 21700 pack.

https://bicyclemotorworks.com/product/e ... i-52v-8ah/

something like this stuffed in a seat bag would probably not be a bad setup for you for shorter rides if you are trying to keep the weight down
Thanks i'm very pleased - need to actually ride it - hoping the shock isn't going to need replacing as soon as I ride it properly!

I hadn't considered the pedal weight gotta be a pound there if I went for eggwhisks! And the dropper is nice - never had one before. Funny thing is - showing the bike to my neighbours it's the hydraulic dropper they are most impressed by - when you make the seat pop up - the motor is 2nd place!

I had a carbon misstep too - should have read the forums more closely i was only looking at BB width not the wall thickness - so had to find this frame instead - but you live and learn!

Am quite new to being a weight weenie :) - not going to go crazy but it would be nice if I end up with a 1000W/500Wh ebike that weighs under 20kg.. That battery is nice - comes in about the same weight/Wh as the 52v 10Ah I have on order hopefully...

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Apr 05 2021 12:49pm

@casainho - have a couple of questions about the osf motor controller and how the control works.

This is in relation to me trying to incorporate mspider65's changes - I'm trying to get pwm control to work properly so I can code a calibration process.

The way the ebike_control_motor loop in ebike_app.c seems to work - if you set a target current then the pwm value is forced to 255... if you have a current target of 0 - then pwm is forced to zero..

How should I do variable pwm control? If I don't set a target current I get no motor action... so seems to me I can't have pwm levels between 0 or 255..

i'm sure I'm missing something in the code :)

This is the part that seems to be problematic:

Code: Select all

// apply the target current if motor is enable and if not, reset the duty_cycle controller
  if(ui8_m_motor_enabled)
  {
    ebike_app_set_target_adc_motor_max_current(ui16_m_adc_target_current);
    ebike_app_set_target_adc_battery_max_current(ui16_adc_battery_current_max);
  }
  else
  {
    ebike_app_set_target_adc_motor_max_current(0);
    ebike_app_set_target_adc_battery_max_current(0);
    ui8_g_duty_cycle = 0;
  }

  // set motor PWM target
  if (m_config_vars.ui8_walk_assist && ui8_g_brake_is_set == 0 && ui8_m_motor_enabled)
  {
    if (ui16_wheel_speed_x10 < WALK_ASSIST_CRUISE_THRESHOLD_SPEED_X10)
    {
      motor_set_pwm_duty_cycle_target(ui8_m_walk_assist_target_duty_cycle);
    }
    else
    {
      motor_set_pwm_duty_cycle_target(ui8_cruise_target_PWM);
    }
  }
  // else if (ui16_m_adc_target_current)
  // {
  //   motor_set_pwm_duty_cycle_target(255);
  // }
  // else
  // {
  //   motor_set_pwm_duty_cycle_target(0);
  // }

  // let's reset this counter, meaning this code is called from main loop
  ui16_main_loop_wdt_cnt_1 = 0;
}
The bit at the end i've commented out - is the part that seems to totally override any pwm setting I set...

How do I do pure pwm control - where the current used is just whatever the pwm cycle needs to run with whatever load applied?

edit: and do you by any chance have any notes or other docs that describe what the motor control variables do - the things that confuse me most are things that are similarly named but are ui8_g_yada or ui_m_yada - what's the m/g mean?

e.g.

Code: Select all

(ui8_m_duty_cycle_target < ui8_g_duty_cycle)

casainho   100 GW

100 GW
Posts: 5227
Joined: Feb 14 2011 2:43pm

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by casainho » Apr 05 2021 1:08pm

beemac wrote:
Apr 05 2021 12:49pm
@casainho - have a couple of questions about the osf motor controller and how the control works.

This is in relation to me trying to incorporate mspider65's changes - I'm trying to get pwm control to work properly so I can code a calibration process.

The way the ebike_control_motor loop in ebike_app.c seems to work - if you set a target current then the pwm value is forced to 255... if you have a current target of 0 - then pwm is forced to zero..

How should I do variable pwm control? If I don't set a target current I get no motor action... so seems to me I can't have pwm levels between 0 or 255..

i'm sure I'm missing something in the code :)

This is the part that seems to be problematic:

Code: Select all

// apply the target current if motor is enable and if not, reset the duty_cycle controller
  if(ui8_m_motor_enabled)
  {
    ebike_app_set_target_adc_motor_max_current(ui16_m_adc_target_current);
    ebike_app_set_target_adc_battery_max_current(ui16_adc_battery_current_max);
  }
  else
  {
    ebike_app_set_target_adc_motor_max_current(0);
    ebike_app_set_target_adc_battery_max_current(0);
    ui8_g_duty_cycle = 0;
  }

  // set motor PWM target
  if (m_config_vars.ui8_walk_assist && ui8_g_brake_is_set == 0 && ui8_m_motor_enabled)
  {
    if (ui16_wheel_speed_x10 < WALK_ASSIST_CRUISE_THRESHOLD_SPEED_X10)
    {
      motor_set_pwm_duty_cycle_target(ui8_m_walk_assist_target_duty_cycle);
    }
    else
    {
      motor_set_pwm_duty_cycle_target(ui8_cruise_target_PWM);
    }
  }
  // else if (ui16_m_adc_target_current)
  // {
  //   motor_set_pwm_duty_cycle_target(255);
  // }
  // else
  // {
  //   motor_set_pwm_duty_cycle_target(0);
  // }

  // let's reset this counter, meaning this code is called from main loop
  ui16_main_loop_wdt_cnt_1 = 0;
}
The bit at the end i've commented out - is the part that seems to totally override any pwm setting I set...

How do I do pure pwm control - where the current used is just whatever the pwm cycle needs to run with whatever load applied?

edit: and do you by any chance have any notes or other docs that describe what the motor control variables do - the things that confuse me most are things that are similarly named but are ui8_g_yada or ui_m_yada - what's the m/g mean?

e.g.

Code: Select all

(ui8_m_duty_cycle_target < ui8_g_duty_cycle)
Walk assist uses a fixed PWM value, look at it.

m stands for member variable and g for global variable.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

beemac   100 W

100 W
Posts: 297
Joined: Dec 05 2020 11:08am
Location: Bristol, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by beemac » Apr 05 2021 2:37pm

casainho wrote:
Apr 05 2021 1:08pm
beemac wrote:
Apr 05 2021 12:49pm
@casainho - have a couple of questions about the osf motor controller and how the control works.

This is in relation to me trying to incorporate mspider65's changes - I'm trying to get pwm control to work properly so I can code a calibration process.

The way the ebike_control_motor loop in ebike_app.c seems to work - if you set a target current then the pwm value is forced to 255... if you have a current target of 0 - then pwm is forced to zero..

How should I do variable pwm control? If I don't set a target current I get no motor action... so seems to me I can't have pwm levels between 0 or 255..

i'm sure I'm missing something in the code :)

This is the part that seems to be problematic:

Code: Select all

// apply the target current if motor is enable and if not, reset the duty_cycle controller
  if(ui8_m_motor_enabled)
  {
    ebike_app_set_target_adc_motor_max_current(ui16_m_adc_target_current);
    ebike_app_set_target_adc_battery_max_current(ui16_adc_battery_current_max);
  }
  else
  {
    ebike_app_set_target_adc_motor_max_current(0);
    ebike_app_set_target_adc_battery_max_current(0);
    ui8_g_duty_cycle = 0;
  }

  // set motor PWM target
  if (m_config_vars.ui8_walk_assist && ui8_g_brake_is_set == 0 && ui8_m_motor_enabled)
  {
    if (ui16_wheel_speed_x10 < WALK_ASSIST_CRUISE_THRESHOLD_SPEED_X10)
    {
      motor_set_pwm_duty_cycle_target(ui8_m_walk_assist_target_duty_cycle);
    }
    else
    {
      motor_set_pwm_duty_cycle_target(ui8_cruise_target_PWM);
    }
  }
  // else if (ui16_m_adc_target_current)
  // {
  //   motor_set_pwm_duty_cycle_target(255);
  // }
  // else
  // {
  //   motor_set_pwm_duty_cycle_target(0);
  // }

  // let's reset this counter, meaning this code is called from main loop
  ui16_main_loop_wdt_cnt_1 = 0;
}
The bit at the end i've commented out - is the part that seems to totally override any pwm setting I set...

How do I do pure pwm control - where the current used is just whatever the pwm cycle needs to run with whatever load applied?

edit: and do you by any chance have any notes or other docs that describe what the motor control variables do - the things that confuse me most are things that are similarly named but are ui8_g_yada or ui_m_yada - what's the m/g mean?

e.g.

Code: Select all

(ui8_m_duty_cycle_target < ui8_g_duty_cycle)
Walk assist uses a fixed PWM value, look at it.

m stands for member variable and g for global variable.
ok, and _p_ is pointer?

i was using walk assist to do pwm control - but on the fw with mpider's code in it I couldn't get the erps up to a decent rate - so I rolled back to learn how to control the original fw so I could compare how things were with the changes.

I might abstract the motor control slightly so the main loop in motor.c just deals with current and pwm - with the logic for walk and other assist types moved to a function above. That would help me understand how to control the motor directly....

But having said that - think i'm done for today... hopefully will get some time this week to take more of a look.

AZUR   100 W

100 W
Posts: 208
Joined: Apr 05 2018 6:52am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by AZUR » Apr 05 2021 4:00pm

Hi,

Does anyone know if the VLCD6 connection cable is the same as VLCD5?

The colors of the image wires, I think are for the VLCD5.

The image has the cable that connects to the controller (6 wires). I think this is the cable that connects to the VLCD5.
Controler 6 wires.jpg
Controler 6 wires.jpg (123.14 KiB) Viewed 383 times
I got this image from Casainho's github.

https://github.com/OpenSourceEBike/TSDZ ... 3-to-TSDZ2

The VLCD6 I have has the cable cut. And the 6 wires in the cable have the same color as the wires in the image.

Thanks

Azur

ferum   100 mW

100 mW
Posts: 44
Joined: Jun 04 2015 5:09am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by ferum » Apr 05 2021 4:12pm

Hi all! A little bit of my creativity.
DSC01887.JPG
DSC01887.JPG (428.15 KiB) Viewed 379 times
DSC01880.JPG
DSC01880.JPG (272.32 KiB) Viewed 379 times
DSC01897.JPG
DSC01897.JPG (190.6 KiB) Viewed 379 times
DSC01907.JPG
DSC01907.JPG (235.67 KiB) Viewed 379 times
DSC01914.JPG
DSC01914.JPG (191.26 KiB) Viewed 379 times
DSC01921.JPG
DSC01921.JPG (241.65 KiB) Viewed 379 times
DSC01927.JPG
DSC01927.JPG (98.08 KiB) Viewed 379 times
DSC01928.JPG
DSC01928.JPG (172.63 KiB) Viewed 379 times
DSC01931.JPG
DSC01931.JPG (78.56 KiB) Viewed 379 times

If you're interested, I'll create a post where there will be more photos.

User avatar
Alfie   100 mW

100 mW
Posts: 46
Joined: Nov 18 2020 6:47am
Location: Yorkshire, UK

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by Alfie » Apr 05 2021 7:20pm

ferum wrote:
Apr 05 2021 4:12pm
Hi all! A little bit of my creativity.
If you're interested, I'll create a post where there will be more photos.
Wow. That is impressive. Please do start a new post. I imagine there will be plenty of questions.
Whyte T129 TSDZ2

tchiseen   10 µW

10 µW
Posts: 5
Joined: Aug 04 2019 6:06am

Re: New "TSDZ2 Torque Sensor Central Motor"

Post by tchiseen » Apr 05 2021 7:43pm

ferum wrote:Hi all! A little bit of my creativity.
DSC01887.JPG
DSC01880.JPG
DSC01897.JPG
DSC01907.JPG
DSC01914.JPG
DSC01921.JPG
DSC01927.JPG
DSC01928.JPG
DSC01931.JPG

If you're interested, I'll create a post where there will be more photos.
So many questions!

I love that there's a belt drive on the non drive side.

I want to see more, or if there's a build process, yeah, very keen.

Great innovation!

Sent from my SM-G991B using Tapatalk


Post Reply