Home made pedelec/pedal torque sensor

Perbear

Finding my (electric) wheels
Mar 15, 2009
6
0
Shimano has hub gear with built-in torque sensor

Shimano's upcoming pedelec parts include a hub with 8 gears internally plus torque sensor. It is likely they use some kind of fieldbus. That requires a MCU adapter board. But Shimano parts have historically been of good quality so such hacker MCU boards are likely to appear soon.

Imagine Shimano system with a Magic Pie...
 

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
I guess with the new EPACS regs, torque sensors are going to come to the fore!
I've been experimenting along two different lines with this. Ill take some photos soon.
1. Chain tension using a resistive force sensor:
https://shop.pimoroni.com/products/force-sensing-resistor-0-5-circle?utm_medium=cpc&utm_source=googlepla&variant=385715030&gclid=CPXP9fDklcsCFUrlwgodXlUCWg

Which is much easier to interface than traditional load cells. It's just coupled to a roller sitting beneath the chain.

2. Chain stretch. I've got two inductive pickups:
http://www.ebay.co.uk/itm/New-Inductive-Proximity-Sensor-Detection-Switches-NPN-4mm-DC6-36V-LJ12A3-4-Z-BX-/291459968518?hash=item43dc5e2e06:g:XHAAAOSwpDdVTw8g

One on either end of the chain. They are aligned such as to measure the passing of the rollers in the chain links. Connected to an Arduino, it measures the phase difference between the two sensors. The phase is proportional to torque - and the frequency to pedal speed.

The chain elongates by about 0.5mm over 0.5m giving a phase difference of 166uS. My measurement resolution is 0.06uS - giving 2500 counts. So the resolution of the extension is high enough resolution to be useful.

This is probably the most promising - though the software needs more tinkering!

Food for thought!
 
  • Like
Reactions: trex

trex

Esteemed Pedelecer
May 15, 2011
7,703
2,671
very interesting solution. I assume you remove the chain bouncing up and down in software.
 

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
very interesting solution. I assume you remove the chain bouncing up and down in software.
Kind of! You either get a valid reading or an out of range reading. Ignore the out of range ones and use the in range to calculate a moving time average. (I'm actually using a Sav Golay https://en.wikipedia.org/wiki/Savitzky–Golay_filter filter on the readings which gives better dynamic response than a moving time average and lends itself to this quite well).

Si
 

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
I had another idea today!
What about measuring the resonant frequency of the frame - or an element of it? Using a piezo element attached to the frame, fed with a frequency sweep over the range of potential resonances then a second one listening. The amplitude will peak at the resonance of the frame. Actually, you just use one piezo and measure the drive current which will change at resonance.

I guess the problem might be smoothing out potholes / ripples in the surface and the stress resulting from cornering?

Si
 

trex

Esteemed Pedelecer
May 15, 2011
7,703
2,671
I think the objective of the torque sensor is to simulate what the rider would have done if he had had access to a thumb throttle. The reason is that the output of the throttle is slow moving but selected at a level that gives just the right amount of assist. All the methods I have seen don't give better results than a simulated torque controller, like the one on the Oxygen MTB. They give the correct output vs the pedaling force but their brain is not as flexible as the rider's brain, ie they don't reflect the rider's physical ability (for example they hit the maximum output too soon like on the Xofo TS motor) or the road (for example the gear that the rider has selected). The second issue is to give the rider a smooth fast start, not easy to program. I think one would need to integrate a gear indicator, a PAS, a pedal force sensor and a selectable rider profile to replace a simple thumb throttle.
 
Last edited:

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
Trex - you're not wrong!
My current build is single speed which reduces the complexity a bit.

My approach to the smooth fast start is, when the controller starts, measure the reading on the torque sensor and take that as zero. Set a variable for the max torque seen so far a little above that.

The motor power is set by how far along the line the current measured torque is between zero and the maximum.

If the measured torque is higher than the max value, the max is reset to the current. Every cycle of the program, the max is decreased a little.

It means that when you first press on the pedals, you have near 100% motor output (subject to an acceleration ramp). This gives pretty good acceleration.

As you pedal, it tracks the pedal torque. If you stop, at the lights for example, the max value decreases close to the min - and you get the same boost starting again.

I also have a gain control which sets the max power the motor will deliver which you adjust for the amount of assistance required.

Si
 

anotherkiwi

Esteemed Pedelecer
Jan 26, 2015
7,845
5,785
The European Union
I don't have a white lab coat! :rolleyes: (I envy your technical expertise Si)

But since last June I learnt a lot about riding a pedelec and building in the right components and have my method for smooth starting and general good riding experience:

1. always use the right gear (yes even with a hub motor this is important) I have learnt to change down in time which is very important and use the correct gear when cruising along.
2. this means having the right gearing on the bike - I understand your initial concerns about my build now d8veh! :) I have moved from a 42 front cog to 48 and my next build will be at least 50.
3. use the correct assistance level - if you are going to power away from a red light in level 5 prepare yourself for the 450 W!
4. have the right controller and PAS - since I changed to a 12 magnet disk there is a light year of difference in smooth operation. If you are using a 6 magnet disk with a square wave controller of course PAS is going to be cr@ppy! The above 450 W and associated torque kick in after a quarter turn of the crank. I have yet to be beaten from the lights to 10 km/h by a car, by a motorbike yes. Acceleration is not off/on but smooth and regular up to the aforementioned 10 km/h.

I believe you when you say that a torque sensor is more natural, I understand the physics, but I don't have the extra cash to go down that road myself. I will have to arrange a road test at the LBS to see for myself. A day he is in a good mood because he knows I am not a potential client for a factory built bike.
 

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
Once I have something decent, my plan is to publish it open-source on Instructables.com
Then, you can build your own! (and more importantly, tweak the software until it's right for you - you might have to put your white coat on briefly!)
 
  • Like
Reactions: anotherkiwi

trex

Esteemed Pedelecer
May 15, 2011
7,703
2,671
I am a fan of torque sensor bike for a long time but unless there is a better solution than the Bosch bikes, I can't see the point of re-inventing the wheel. The Xofo TS motor comes close, but d8veh made the remark back in 2013 when he tried the woosh TS bike, the sensor hits the max too easily on hills.

http://www.pedelecs.co.uk/forum/threads/who-wants-to-review-a-woosh-ts.16210/#post-199032

I also like the simulated torque controller on the Oxygen MTB a lot, very natural delivery of power, quite like the Bosch on some roads. I don't think the average rider cares that much for a torque sensor unless it's thrown in the kit for free.
Simon's approach on using the chain stretch is excellent. However, the challenges are enormous. The maximum chain strech is about 1 in a thousand, he needs to get 1,000 units of measure out of that, so it's one in a million. He's got to throw out all spurious readings that the road and the bike throw at the sensor. He's got to find out the speed of the bike to make sure that he does not apply 100% current when the guy taps on the pedals and is besides a car about to turn left. Good luck.
 

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
Thing is - Bosch and all the others have re-invented the wheel and potentially come up with something better. I may not, but the only way to find out is to try it!

Whether it's a giant corporation or Fred in a Shed, it's the people prepared to experiment that move technology forward. All the corporations ultimately started as Fred (or Robert) in his shed!

Si
 
  • Like
Reactions: trex

trex

Esteemed Pedelecer
May 15, 2011
7,703
2,671
I had another idea today!
What about measuring the resonant frequency of the frame - or an element of it? Using a piezo element attached to the frame, fed with a frequency sweep over the range of potential resonances then a second one listening. The amplitude will peak at the resonance of the frame. Actually, you just use one piezo and measure the drive current which will change at resonance.

I guess the problem might be smoothing out potholes / ripples in the surface and the stress resulting from cornering?

Si
the resonance changes from frame to frame and because of stationary waves, the peak and its harmonics will vary with the location of the pickup. I thought your original scheme with the chain roller may be worth exploring further because you can build the PAS into the roller, kill two birds with one stone. If you can design the roller so it's easier to fit, then it's a bonus. Most of the Chinese PAS discs are so poorly designed, a chain roller is likely an improvement.
 
  • Like
Reactions: anotherkiwi

Simon Rafferty

Pedelecer
Feb 26, 2016
39
19
56
Horsham
The chain roller is what I'll use first - just to get it working. I've experimented with the chain stretch sensor on a test rig - and it shows some promise. Because the resolution is just down to timing rather than an analog measurement, the very small amount of stretch is very measurable.

The only (big) hurdle is how to cope with multi ratio setups as the chain and thus the sensors have to move side to side. On mine, it's single speed - so not a big problem.

Chain slap isn't a problem if you mount the sensors close to the sprockets.

I like this as it doesn't add any moving parts.

With all three (including the resonance idea) they need on the fly calibration. The code for the chain roller sets 'zero' on power up and max as the highest value it's seen so far. This in practice works pretty well. I can't see why the same approach wouldn't work for either of the other two. It means it doesn't care what sort of sensors you use, or where you put them.

Another quickie with the chain roller - you can see ripples as the chain links move over the roller. They are small, but measurable. Thus without any additional hardware, you have a cadence sensor too! The software is a bit more tricky as you have to calculate derivatives to extract the ripples. But I have a plan!