VESC Controller with Torque Sensor (erider)

Joined
Sep 8, 2019
Messages
462
Location
USA, CA, Bay Area
Thinking about trying out a setup with an erider torque senor bottom bracket on a VESC. From what little I've gathered, it would seem you need to get it power (5-15v and a ground) and then plug the torque+speed lines into the RX/TX on the VESC.

- https://github.com/vedderb/bldc/pull/243
- https://www.aliexpress.us/item/2251832843823638.html
- https://github.com/vedderb/bldc/blob/a8c096888898c98759ccc26821c2e467fa19cce7/applications/app_pas.c#L133-L134
- https://github.com/vedderb/bldc/blob/9b11246dd0f1b31f91e2d0f8e0a0f5436092d8d5/hwconf/hw.h#L563-L566

I guess I'll find out, but I figured I'd start a thread for future explorer's to find more information. If anybody has already done this setup, by all means chime in and save me some time :D
 
The VESC firmware actually does not support a torquesensor.
Your links point to the implementation of a simple quadrature PAS.
You would need to do some additional programming to get the usual behaviour

Code:
motor power = factor * human power

means

Code:
motor current = factor * cadence * torque at the cranks / motor speed

I like the linked torquesensor very much, I'm using it with a Lishui controller and the open source firmware :wink:
Good luck with your project!

regards
stancecoke
 
stancecoke said:
The VESC firmware actually does not support a torquesensor.
Your links point to the implementation of a simple quadrature PAS.

Thanks -- that's a good catch which just flew over my head for some reason.

There is somebody in the github thread that specifically calls out using this model sensor though... I wonder if they hooked it up more like a throttle. The sensor seems to output 1.5->3.0v depending on pressure, so maybe they just plugged the torque output into ADC1 as a "throttle". I should ping them about their setup.
 
Depending on the version, the erider output could be used as a throttle input instead, just changing the controlelr throttle input settings to match the erider output range.

If the controller cant' rescale the throttle input on it's own like that, it might require a small MCU (nano, etc) circuit that scales it's voltage to match what the controller expects.

To ensure it only works in the forward direction, you could create a small MCU circuit that takes the cadence signal and creates an ebrake lever signal output from it, such that only when the cadence signal is for the forward direction (for those sensors that distinguish and output different signals for forward vs reverse) does it turn the ebrake off.

If the controller supports regen, then you could use that to turn regen braking on and off by pedalling backwards instead of having to use the ebrake lever (which could be wired in parallel with the above signal).

If it supports variable regen via variable voltage on the ebrake input, you could use the MCU to determine the above direction, and then pass the torque sensor value to the ebrake input. (assuming the torque sensor can read in the reverse direction, or there's enough tension on it to get a useful reading).

Etc.
 
amberwolf said:
If the controller cant' rescale the throttle input on it's own like that, it might require a small MCU (nano, etc) circuit that scales it's voltage to match what the controller expects.

Would the MCU also need to do some normalizing or averaging since it would seem that the voltage output would vary through each rotation depending on crank position?
 
E-HP said:
amberwolf said:
If the controller cant' rescale the throttle input on it's own like that, it might require a small MCU (nano, etc) circuit that scales it's voltage to match what the controller expects.

Would the MCU also need to do some normalizing or averaging since it would seem that the voltage output would vary through each rotation depending on crank position?

Yes, that's definitely one of the settings in how the Cycle Analyst does things. Honestly, might be better, overall, to just run a CA and feed the throttle output back to the VESC.
 
chuyskywalker said:
E-HP said:
amberwolf said:
If the controller cant' rescale the throttle input on it's own like that, it might require a small MCU (nano, etc) circuit that scales it's voltage to match what the controller expects.

Would the MCU also need to do some normalizing or averaging since it would seem that the voltage output would vary through each rotation depending on crank position?

Yes, that's definitely one of the settings in how the Cycle Analyst does things. Honestly, might be better, overall, to just run a CA and feed the throttle output back to the VESC.

If I can get my Flipsky working, that would be the plan for the bike I'm going to assemble for my wife. That's why the subject line caught my attention. I still need to install the Erider on my own bike, but once I get that sorted out, I can spend some time on the Flipsky...and then order the other parts. I saw two posts on different threads here on how to get past the issue I was having, so optimistic that one of those solutions will work.
 
chuyskywalker said:
The bike currently has a 75100 on it that I just updated with jaykup's firmware, soooo ;)

I have this one
https://www.amazon.com/flipsky-Electric-Skateboard-Scooter-Controller/dp/B09J4SV7G5/ref=psdc_11051398011_t1_B0894M3Q4X

It may have been your post that mentioned something about upping one of the voltage level settings to get the identification to work/not fail. One of the things I'll try when I get back to it.
 
E-HP said:
I have this one
https://www.amazon.com/flipsky-Electric-Skateboard-Scooter-Controller/dp/B09J4SV7G5/ref=psdc_11051398011_t1_B0894M3Q4X

It may have been your post that mentioned something about upping one of the voltage level settings to get the identification to work/not fail. One of the things I'll try when I get back to it.

Same exact thing. That will help; also updating the Jay's firmware will also just fix that (along with several other things, critically including that the temp sensor for the mosfets will correctly work)
 
chuyskywalker said:
Same exact thing. That will help; also updating the Jay's firmware will also just fix that (along with several other things, critically including that the temp sensor for the mosfets will correctly work)

:bigthumb:
 
chuyskywalker said:
stancecoke said:
The VESC firmware actually does not support a torquesensor.
Your links point to the implementation of a simple quadrature PAS.

Thanks -- that's a good catch which just flew over my head for some reason.

There is somebody in the github thread that specifically calls out using this model sensor though... I wonder if they hooked it up more like a throttle. The sensor seems to output 1.5->3.0v depending on pressure, so maybe they just plugged the torque output into ADC1 as a "throttle". I should ping them about their setup.

There is a
Code:
case PAS_CTRL_TYPE_TORQUE:
in the release 6 & as well as master branch, looks like it is to handle torque sensor

chuyskywalker said:
E-HP said:
amberwolf said:
If the controller cant' rescale the throttle input on it's own like that, it might require a small MCU (nano, etc) circuit that scales it's voltage to match what the controller expects.

Would the MCU also need to do some normalizing or averaging since it would seem that the voltage output would vary through each rotation depending on crank position?

Yes, that's definitely one of the settings in how the Cycle Analyst does things. Honestly, might be better, overall, to just run a CA and feed the throttle output back to the VESC.

Instead if connecting the torque sensor to throttle, in ADC->Mapping->ADC Voltage mapping option it should be possible to map torque sensor output by varying torque from zero to possible max torque manually and then apply it.

A caveat - I haven't tried both
 
afzal said:
There is a
Code:
case PAS_CTRL_TYPE_TORQUE:
in the release 6 & as well as master branch, looks like it is to handle torque sensor

Digging a bit deeper; that seems to only be enabled when you are using a "luna_m600" which gets that value over CANBus, not directly from any of the pins.

afzal said:
Instead if connecting the torque sensor to throttle, in ADC->Mapping->ADC Voltage mapping option it should be possible to map torque sensor output by varying torque from zero to possible max torque manually and then apply it.

Indeed, the sensor's torque pin specs (on paper) will output 1.5->3.0v for "no pressure" to "max pressure". That's something you can definitely feed directly into ADC1 and map as min->max current output on the motor.

There are, however, a lot of caveats that make having another device (mcu, CA, etc) inline important. For starters, without rotation count (the cadence sensor) you could get motor power while just resting your feet on the pedals at a stop. Maybe torque is also reported in either direction. Probably a few other scenarios would make this an overly basic setup.
 
chuyskywalker said:
afzal said:
There is a
Code:
case PAS_CTRL_TYPE_TORQUE:
in the release 6 & as well as master branch, looks like it is to handle torque sensor

Digging a bit deeper; that seems to only be enabled when you are using a "luna_m600" which gets that value over CANBus, not directly from any of the pins.

Yeah, thanks for letting me know. I didn't look deeper, I noticed it only because the author who added it has removed as part of the same commit, on-off type PAS control added by me, perhaps inadvertently since that was named "PAS_CTRL_TYPE_CONSTANT_TORQUE", and by the time I noticed it was too late.

casainho has recently posted a piece of python code that runs on ESP32 communicating with the VESC to handle torque sensor, translating it into C & stealing ADC input inside the case PAS_CTRL_TYPE_TORQUE is another option
 
Back
Top