TSDZ2 - torque sensor excitation

Blacklite

100 W
Joined
Jan 29, 2019
Messages
194
Location
Brisbane
Has anyone played with changing the torque sensor excitation signal parameters on a TSDZ2?

Each of the different OSF's has a different way of dealing with the variability in the sensor response, either mapping it in different ways, or averaging like the really great new algorithm from MSpider. I was playing around though and realised I hadn't seen any tests of changing the sensor excitation signal. All the current OSF's seem to use a 2us pulse in a 20us period. I changed this to a 2.5us pulse in the same period and found a huge difference in response from the sensor - basically doubled the no weight to body weight range of the sensor. What I haven't explored yet is the linearity of the output. Wondering if anyone else has tried changing this value and what they might have found?
 
Blacklite said:
Nobody?

I thought this might be something interesting for those that play with bike software…

I find it very interesting; esp as all my TSDZ2‘s seem to have a low sensitivity / Range (Even after h/w calibration) But I am just a user - not a developer.
Maybe @mspider65 & @mbrusa read this as well and judge it a worthwile parameter to make it adjustable in a future version of their firmwares?

(The only thing I personally did was using a simple Arduino code to feed the coil w/ a 150kHz signal while measuring the coil current to be able to do a Hall-sensor adjustment w/o needing the controller. That worked okish, if I remember correctly. Anyway - hopefully, you find that the linearity is not impacted; then I would guess the interest would rise - because it would give us a sensitivity calibration lever via software!
 
I know this is an old post - but that is interesting, thanks @Blacklite - I'll investigate more!

@endlessolli any chance you could share the circuit you used to read the torque sensor without the controller please if you still have it, I'm in the process of trying to do the same thing
 
I know this is an old post - but that is interesting, thanks @Blacklite - I'll investigate more!

@endlessolli any chance you could share the circuit you used to read the torque sensor without the controller please if you still have it, I'm in the process of trying to do the same thing
This is quite some time ago…. i‘ll have a look tomorrow if I find some notes. What i remember now: The circuit was super simple; i think I directly connected a GPIO and GND to the coil - so it worked with just 5 Volt and I measured the current (-> the torque signal) with a mutimeter. I need to find the code how I generated the 150kHz. This setup was not great, but good enough to adjust the Hall sensor position for good sensitivity.
 
Thanks, that's useful information I assumed you'd used an opamp to increase the voltage, maybe the voltage increase I'm seeing is due to the coil windings perhaps. I had tried a signal generator but it was only 2.5v peak to trough so maybe 5v will be better.
 
Thanks, that's useful information I assumed you'd used an opamp to increase the voltage, maybe the voltage increase I'm seeing is due to the coil windings perhaps. I had tried a signal generator but it was only 2.5v peak to trough so maybe 5v will be better.
So , I found the Arduino code I used to generate the squarewave signal (I copied it from somewhere - unforuneately I don't remember from where, so I can not give credits)
Rename txt to ino.
As I don't have an Oszilloskope, It would be great if you could feedback on the signal when you use it (150kHz? Squarewave?, ....)
Also, here is a german site where @stancecoke checked out the sensor some years ago:
He also seemed to measure around 20Vpp as you did, but only w/o load.
Hope this helps.

PS: I also tried to 'reverse engeneer' the sensors little PCB - see at the bottom of this wiki page:
and this schematic:
 

Attachments

  • 150khz_pin9.txt
    652 bytes · Views: 2
Last edited:
Thanks, much appreciated. Based on what you said yesterday, this morning I hooked up a ESP32C3 to the torque sensor. I generated a 2uS pulse @50kHz (also tried 100, 150) - and I can see the square wave being generated, the torque sensor pulls about the same amount of current c.8.9mA at 50kHz/2uS but the current doesn't change when force is applied. The main difference is that the 5v pulse is square not sawtooth and there's a DC component in the AC signal because it's based at 0 not -2v or whatever.

But if I do the same with the oscilloscope wave generator - and generate what looks almost identical to the wave the controller generates - I don't get any current flow - I assume the oscilloscope has protection to stop sources drawing too much current?

It's really puzzling... I'll read through what you've sent and see if that has any hints

Cheers!
 
As I don't have an Oszilloskope, It would be great if you could feedback on the signal when you use it (150kHz? Squarewave?, ....)

Unfortunately I don't have an arduino based on the right processor for this code - but I looked up the register definitions - looks like it generates a 25% duty cycle - at 150kHz. Sadly if I do the same with my ESP32C3 - I don't get any current deflection... :(

Code:
// RTM_TimerCalc 1.20
// Timer-1 Mode_14_16Bit_Fast_TOP_is_ICR

void setup() {

TCCR1B = 0x18; // 0001 1000, Disable Timer Clock - also WGM13/12 are set
TCCR1A = 0xA2; // 1010 0010, WGM11 set, WGM10 clear, COM1B1 set, COM1A1 set

// WGM Mode is Fast PWM    ICR1    BOTTOM    TOP

// Behaviour of wavegenerator - Clear OC1A/OC1B on Compare Match, set OC1A/OC1B at BOTTOM (non-inverting mode)

ICR1 = 107-1; - This is the Counter TOP
OCR1A = (int) (ICR1 * 0.25); = 106/4 = c.27 // This is the match value
OCR1B = (int) (ICR1 * 0.50); // 50% duty = square wave
TCNT1=0x0;

// At 0, OC1A/B are set (although we only care about A), The timer will count up to 27, then clear OC1A. Then count up to 106 before resetting.
// 16Mhz/107 = 149533Hz at a 25% duty cycle

// UnComment following lines for UNO-NANO Timer-1 Pins
pinMode(9, OUTPUT);  // OC1a
// pinMode(10, OUTPUT); // OC1b

// UnComment following lines for 2560 Timer-1 Pins
// pinMode(11, OUTPUT);  // OC1a
// pinMode(12, OUTPUT);  // OC1b

TCCR1B |= 1; // Prescale=1, Enable Timer Clock

}

void loop() {
  // put your main code here, to run repeatedly:

}

My equivalent code is :

Code:
const int torquesensorpin = D1; 

// setting PWM properties
const int freq = 150000;
const int pwmChannel = 0;
const int resolution = 8;
 
void setup(){
  // configure LED PWM functionalitites
  ledcSetup(pwmChannel, freq, resolution);
 
  // attach the channel to the GPIO to be controlled
  ledcAttachPin(torquesensorpin, pwmChannel);
}
 
void loop(){
 
    ledcWrite(pwmChannel, 25); //Duty cycle

}
 
Unfortunately I don't have an arduino based on the right processor for this code - but I looked up the register definitions - looks like it generates a 25% duty cycle - at 150kHz. Sadly if I do the same with my ESP32C3 - I don't get any current deflection... :(

.....
Thats a shame. But an ESP could be both voltage and current wise marginal.
Maybe it is worth getting an Arduino Nano (v3, not the new 33 one)?
These are ~3$ on ebay, giving you 40mA @ 5V on the GPIOs
 
I'm not sure current is the issue - I can sink 20mA at least if I need to by upping the duty cycle - and no change.... but yes I guess it's worth a punt for <£10... You're absolutely sure you didn't have any additional circuity? :)

I'm really stumped - I can't see why your test would work and mine won't.

I was just knocking up a +/- 3.3v supply to try adding a differential opamp to make the signal properly AC...
 
I am 100% positive - no other circuity. I fed the signal from Arduino in one coil and the other lay on top of it. I measured the current while adjusting the position of the Hall. Although it been a while I remember that it worked quite well.
Are you sure that your sensor works? (I had to do all thst because mine was broken: The Hall sensor pins were partly broken - only visible after removing the black rubber goo. (While removing the black rubber I detroyed one of the capacitors - I replaced it with anotherone of similar dimensions (not knowing the capacity) Still, the sensor works! I guess the circuity is quite forgiving…
 
Ok i'll order a nano and see if that makes any odds. Yes I'm pretty sure the sensor works as I get current changes when using the tsdz2 controller - see the vids in this post

No difference using an AC signal +/- 2v at various frequencies...

Time for a beer and not sit hunched over a soldering iron :)
 
Well.. the nano arrived yesterday, hooked it up, ran the code - and lo and behold - bugger all happened! :cry:

I didn't take any vids - will try to remember later. I got excited initially as when I put the ring coil on top I got a reflected waveform showing on the scope - but on further experimentation that seemed to just be resonance. If I varied the frequency even with the coil separated from the sensor I could still get a 'reflected' waveform - so didn't appear to be something coming back from the circuit in the sensor.

I then went out - but tonight I'm going to reconnect the original board and verify that sensor actually still works. Tbh whilst I was playing with it last night I could actually get the top floating coil to 'sing' if I got the frequency just right - so they might be toast.

I have removed the sensor from the motor case to make it easier to hook up - so that's another possible opportunity for damage..

I did have a thought - since the original board shows a much higher voltage - is combining the output of two GPIO pins to get a 0-10v signal - but I'm not sure if that's going to hurt the nano... I'll do a bit of reading but first I'll test that the sensor actually still works as expected with the proper tsdz2 controller.

I do also wonder about the long-term effect of using an AC signal that isn't centred around 0v - but around Vpeak/2 - so the signal has a +Vpeak/2 DC component. As I'm sure in speakers that's a recipe for heat built up in the voice coil - I don't see why these coils would be any different... anyway something to worry about if I ever get this sodding thing to work :)
 
I am sorry to hear.
I did not worry about the non symmetrical signal - it should be equalized once it is in the secondary spool. And on the primery side, there is nothing but the coil and the Arduino - they should be fine with the asym signal I would think.
I am really confused why this does not work on your setup. If my motors wouldn‘t be on the bikes currently, I would try to redo it to verify
Wrt to 10V from the Nano - I do not understand how to achive this. (As Nano is only 5 V tolerant.)
 
Last edited:
Back
Top