Controller recommendations for torque sensor and regen braking

dennisg

100 µW
Joined
Feb 3, 2025
Messages
9
Location
Germany
Hi, I'm working on an old cargo bike that I want to add a rear hub motor to. I have an old Crystalyte 406 motor laying around that I want to use for now and two 36V batteries I'd like to repurpose. The bike will be parked on a hill, so pretty much every ride will start with 15 minutes of riding downhill. That's why I'm really interested in regenerative braking. But I'd also really like to include a bottom bracket with a torque sensor, so I've been searching for controllers the past few days but didn't find an ideal solution yet.
As far as I can see I could go with a Lishui controller that are available with torque sensor support but don't really support regen braking. I also found sabvoton controllers that support regen braking but don't have torque sensor support, so I'd have to use something like METOP.
Are there any other options? I'm open to experimental solutions like using custom firmwares but navigating all the options is really confusing when just getting into it.
 
pretty much every ride will start with 15 minutes of riding downhill
Keep in mind that you might not be able to use regenerative braking on a full battery - and even when it works, it becomes waste heat. A lot of controllers (I think KTs are pretty prominent) don't really handle braking when the battery is full very well.
 
As far as I can see I could go with a Lishui controller that are available with torque sensor support but don't really support regen braking.
Of course they are supporting regen breaking. That's only a matter of the firmware.
But you are right, the combination of torquesensor support and regen breaking is quite special. You could go with a Cycle Analyst + Phaserunner controller, it has both options.
You could use a VESC or a Lishui also, but both need an adapted firmware, that has to be flashed to the controller.
And of course @bananu7 is right, you have to make sure, that the controller stops regen before the voltage gets too high and the BMS cuts the battery from the controller due to overvoltage, this would cause magic smoke in the controller for sure🔥
EBiCS for Lishui controllers has the overvoltage protection implemented.

regards
stancecoke
 
Last edited:
Has anyone experimented with routing regen braking to a dump load resistor to get the benefit of the braking without worrying about over charging?
 
You could use a VESC or a Lishui also, but both need an adapted firmware, that has to be flashed to the controller.
And of course @bananu7 is right, you have to make sure, that the controller stops regen before the voltage gets too high and the BMS cuts the battery from the controller due to overvoltage, this would cause magic smoke in the controller for sure🔥
EBiCS for Lishui controllers has the overvoltage protection implemented.
So could I for example use this controller and one of their torque sensors and enable regen using your EBiCS firmware?
 
DIY torque sensors in my experience are fragile, fiddly to install, and fussy to tune. I liked the idea of them, but after implementing them I don't want one... ever. Even cadence sensing PAS is more annoyance than benefit, in my opinion. There is a simplicity, precision, and certainty to throttle-only that I believe suits a bicycle. Pedals for leg power and throttle for motor power. Why overcomplicate something whose whole game is doing more with less?
 
DIY torque sensors in my experience are fragile
That's not my experience, modern ERider T15/T17 are now reliable.
A bike with simple PAS levels has no natural bicycle feeling, it gives a moped feeling.
All prebuild manufacturers like Bosch, Yamaha, Panasonic,... are using torquesensors. Even cheap Chinese bikes from Himiway, Radrunner... have them nowadays ;)
My favourite solution is the cassette integrated Kclamber sensor. No wiring to the bottom bracket needed, you can keep your Hollowtec system, if you use a battery integrated controller, just one cable from the battery to the motor is needed (y)

regards
stancecoke
 
Last edited:
Has anyone experimented with routing regen braking to a dump load resistor to get the benefit of the braking without worrying about over charging?

Someone here has done that wiht wire wrapped around hteir frame to dump the heat into. Don't recall if they used it with a variable regen controller or only on/off regen.

For on/off controllers, there's an option to regulate the regen using a brushed controller and a siwtching contactor between battery input of main controller and dump load; I don't recall if it's been tested.


The bike will be parked on a hill, so pretty much every ride will start with 15 minutes of riding downhill. That's why I'm really interested in regenerative braking. But I'd also really like to include a bottom bracket with a torque sensor, so I've been searching for controllers the past few days but didn't find an ideal solution yet.

Are there any other options? I'm open to experimental solutions like using custom firmwares but navigating all the options is really confusing when just getting into it.
One option for assorted PAS type control of a non PAS controller that only has a throttle input is the Cycle Analyst v3. If that's the only thing you're using it for, it's proably not worht the expense, if you have controller options that allow both regen and pas. But if you are going to use enough of it's fucntions (power monitoring, throttle managment, etc). it's useful.

I don't even use the torquepas it has, and easily control the speed of the SB Cruiser trike just with a cadence sensor, no "assist levels" I just get full control over the system simply via pedaling. A torque sensor would give me easeir-start-from-stop capability, but for my purposes it's not needed.


The Phaserunner controllers (wiht configurable variable regen) these days are supposed to have an option for direct PAS control, and if you need a display for them you can use their smart cable to connect ot any of a number of common ebike displays.

Ther'es probably other options that i didnd't list above and that aren't already listed in this thread by you or other posters. :)
 
Covering this part separately cuz the other post was already long.
Hi, I'm working on an old cargo bike that I want to add a rear hub motor to. I have an old Crystalyte 406 motor laying around that I want to use for now and two 36V batteries I'd like to repurpose.
How heavy is the bike plus you plus the worst-case cargo you have to carry back up?

How steep is the hill? And how long? Any winds?

What speed do you ahve to maintain going back up?

What speed does the motor normally spin at for 36v when on flat ground? (or unloaded offground)?

You can take all that data to the simulator at ebikes.ca to find out how much power it takes to do what you want, so you can answer some of the questions below:


Since you have a hill that has to go back up at the end of the ride, can that motor handle the power required to do that, for the total system/rider weight, for the minimum of 15 minutes it takes (probably longer going up than down), without overheating?

Can the batteries handle the current required to do it?

Do the batteries have the capacity to power you all the way back up that hill, after having ridden around? because you can't actually use any of the regenned capacity from the initial hill descent (see below).

The bike will be parked on a hill, so pretty much every ride will start with 15 minutes of riding downhill.

Covering this part separately cuz the other post was already long.

If you regen downhill at the start of every ride, you will need to setup your charging system to never charge to full, and always leave out more capacity than you will regenerate on the downhill.

If you start with a full battery, or nearly full, then at some point during the regen, your system will fill the battery, and the bms will turn off. When that happens, the load is removed from the regenned voltage, the voltage inside the controller will spike, probably well beyond what it's designed for, and it will probably blow up the FETs and the voltage regulator, perhaps the MCU or other parts. If the voltage regulator is a simple linear type, it may fail shorted, and pass the excessive voltage thru to the whole set of low voltage devices connected to the controller (PAS, throttle, motor halls, etc). If there's a display powered from the controller's battery voltage, it'll also be damaged by the spike.


So, the options are to not use a BMS (not safe, especially if you are regenning down a hill when it's already full), or to charge to less than full by *more* than the worst-case amoutn of regen you could get, so that it will *never* have a chance of the above situation.


EDITED 2-16-25 to clarify scenario:

If the BMS is a common-port type, that will mean the controller has nowhere to dump this current now, and it becomes a voltage that builds up (not like static electricity) very fast and can quickly exceed the voltage the controller FETs and other parts can handle, destroying them.

If the BMS is a separate-port type, then it can't stop the regen current, and the cells will begin overcharging. How serious this problem is depends on the length of time the regen goes on, and the amount of current flow there is. If it's a very low current, less than 50mA, it's likely that the BMS balancing shunts (if it is a balancing type) will handle it. Above that (whatever the shunts can do) the cells will charge.

If there is no BMS, the cells are "all" that is at risk, as those will still overcharge, but there's nothing to disconnect the controller from the battery and cause the voltage spike.
 
Last edited:
Also, don't forget that regen on most controllers is only on/off at whatever strength that controller supports. Most do not have variable / proportional regen, so you have no real control over any braking done via regen, and it is much harder on the motor axles and your frame.

You'll need to make sure you have good torque arms on both axle ends, or pinching dropouts on the frame, etc. Even so, enough shock force repeated enough times can shear your axles right off, so if the controller you have along with the battery cells' internal resistances allows for high regen currents, on/off regen could be a problem.

Variable regen lets you fade in and out of braking, so there's no shock loads on the axle/etc. Also lets you adjust the braking force as you ride, with whatever control mechanism you use.

There are brake handles that have variable outputs (I think some of the Xiaomi scooter handles do this), or you can make one by using a regular cable brake lever and a cable operated throttle (thats what I have), or use a thumb or twist throttle, etc.
 
Thanks for your detailed reply.
Covering this part separately cuz the other post was already long.

How heavy is the bike plus you plus the worst-case cargo you have to carry back up?

How steep is the hill? And how long? Any winds?

What speed do you ahve to maintain going back up?

What speed does the motor normally spin at for 36v when on flat ground? (or unloaded offground)?

Since you have a hill that has to go back up at the end of the ride, can that motor handle the power required to do that, for the total system/rider weight, for the minimum of 15 minutes it takes (probably longer going up than down), without overheating?

Can the batteries handle the current required to do it?

Do the batteries have the capacity to power you all the way back up that hill, after having ridden around? because you can't actually use any of the regenned capacity from the initial hill descent (see below).
I think the bike must weigh at least 30kg and usual cargo is 20-30kg max, but I'm not sure what I want to use it for yet. I have another cargo bike with similar weight that I equipped with a Bafang mid motor and a 48V battery with 18Ah I think and it handles the uphill fine even when loaded. I couldn't get the battery empty yet even when riding over 200km including multiple uphills, so I think the two 36V batteries should handle that fine.
If you regen downhill at the start of every ride, you will need to setup your charging system to never charge to full, and always leave out more capacity than you will regenerate on the downhill.

If you start with a full battery, or nearly full, then at some point during the regen, your system will fill the battery, and the bms will turn off. When that happens, the load is removed from the regenned voltage, the voltage inside the controller will spike, probably well beyond what it's designed for, and it will probably blow up the FETs and the voltage regulator, perhaps the MCU or other parts. If the voltage regulator is a simple linear type, it may fail shorted, and pass the excessive voltage thru to the whole set of low voltage devices connected to the controller (PAS, throttle, motor halls, etc). If there's a display powered from the controller's battery voltage, it'll also be damaged by the spike.


So, the options are to not use a BMS (not safe, especially if you are regenning down a hill when it's already full), or to charge to less than full by *more* than the worst-case amoutn of regen you could get, so that it will *never* have a chance of the above situation.
That makes sense and is really good to know. Is it possible to build another protection circuit for the battery that can redirect power to some resistor or another battery? I have some other batteries laying around, maybe I could add one of them as a backup and just use that one as the target for recuperation
Also, don't forget that regen on most controllers is only on/off at whatever strength that controller supports. Most do not have variable / proportional regen, so you have no real control over any braking done via regen, and it is much harder on the motor axles and your frame.

You'll need to make sure you have good torque arms on both axle ends, or pinching dropouts on the frame, etc. Even so, enough shock force repeated enough times can shear your axles right off, so if the controller you have along with the battery cells' internal resistances allows for high regen currents, on/off regen could be a problem.

Variable regen lets you fade in and out of braking, so there's no shock loads on the axle/etc. Also lets you adjust the braking force as you ride, with whatever control mechanism you use.

There are brake handles that have variable outputs (I think some of the Xiaomi scooter handles do this), or you can make one by using a regular cable brake lever and a cable operated throttle (thats what I have), or use a thumb or twist throttle, etc.
I would prefer to use variable regen and @stancecoke mentioned his firmware could support this. The bike has two wheels in the front and I wanted to add two hydraulic disc brakes. I planned to control them with independent levers but I want to control the motor brake independently. Are you aware of any brake levers that just output a signal without moving any cable or hydraulic? I thought about using a thumb throttle but I don't want to have to hold it all the time.

I will think about how to get some torque arms for axle. I'll need to add a derailleur hanger aswell so it would be best to combine the two.
 
Yes. You can trigger a constant regen current by the simple switch of the break lever, or use a thumb throttle or linear break lever for variable regen current.

regards
stancecoke
That sounds great. Do you know if this specific controller is flashable? I read that it only works with specific model numbers. Also since you mentioned that it supports overvoltage protection, could it disable the motor brake before the BMS shuts off if I determined the exact value when it does?

What exactly do you mean by linear brake lever? Just a lever for mechanical brakes that outputs a variable signal?
 
For the e-brake signal, there are two decent options:
a) in-line pressure sensors for your hydraulic brakes - if you want total of two levers
b) cable electronic throttle plus a bicycle cable lever - if you want three
 
could it disable the motor brake before the BMS shuts off if I determined the exact value when it does?
Yes this threshold can be set by the user. But you have to be aware, that the controller can't control the current, if the BEMF voltage is higher than the battery voltage. Then the regent current flows through the body diodes of the MOSFETs to the battery uncontrolled.


What exactly do you mean by linear brake lever?
There are break levers that have an analogue voltage output like a thumb throttle. You can get them as a spare part for the Xiaomi M365 scooter for example.
If you have hydraulic brakes, you could use a pressure sensor, as @bananu7 already recommended.

regards
stancecoke
 
I'll add my experience doing regen. The bike has a Grin baserunner controller.
When regen is too much for the state of the battery charge the controller stops all power in and out.
 
Yes, the PR/BR seem to be effective at limiting the regen voltage per whatever settings you've chosen...however--if you ever had the case of a battery filling up or disconnecting it's BMS from the controller *during* regen, do you know that it would be able to shutdown the regen process *before* the voltage spike that blows it up?

Another potential problem is that even if you aren't using regen, if you spin the motor fast enough it still generates a voltage higher than the battery, and then charges the battery, whether or not the controller is doing any regen--it simply acts as a 3phase rectifier. Even if you power off the controller via it's keyswitch line it will still happen. If this process continues to when the battery fills up, and BMS shuts down, it will have the same results to the controller as if intentional regen was doing it. The controller cannot do anything about this process as it isn't causing it. :(
 
I think the bike must weigh at least 30kg and usual cargo is 20-30kg max, but I'm not sure what I want to use it for yet. I have another cargo bike with similar weight that I equipped with a Bafang mid motor and a 48V battery with 18Ah I think and it handles the uphill fine even when loaded. I couldn't get the battery empty yet even when riding over 200km including multiple uphills, so I think the two 36V batteries should handle that fine.

If you don't know what the current required is, or what they can supply, you would be safer not assuming that they will just work. ;)

Depending on conditions, speed, motor winding, gearing, etc, for each of the two different types of drive systems, a middrive is probably going to take less current / power to do the same high-load job, assuming you're shifted into the correct gear for that job just like you would for pedalling to do it instead. It may be a LOT less power, if the hubmotor is wound to reach a much higher speed than you're going under that load, and the middrive is all correctly setup/geared for taht speed at that load.

I highly recommend chekcing out the ebikes.ca motor simulator so you can see what your proposed setup will require, to make sure you get teh right parts to do that job, and that hte parts you already have that you want to use can do it, so you don't potentially damage them or overstress them.



That makes sense and is really good to know. Is it possible to build another protection circuit for the battery that can redirect power to some resistor or another battery? I have some other batteries laying around, maybe I could add one of them as a backup and just use that one as the target for recuperation
You can, but you have to switch in the low-charge-state one before switching out the near-full one, and they will be at different voltages, so the switch system has to handle not only the regulated current from the regen, but the *un*regulated current from the higher voltage battery discharging into the lower voltage one, and both their BMSes also have ot handle that.

You can't block that current with diodes because that also blocks the regen current.

If you want to avoid that, you have to switch out the near-full one before switching in the low one, and that leaves some amount of time that the controller is not connected to anything, and that's when there's no load on the regen current, so the voltage instead spikes up, which is the whole reason to try not to disconnect the battery. ;)

You might be able to switch fast enough, but you might not. The only way to find out for sure is to test it, and any non-pass of the test is likely to damage or destroy the controller FETs at minimum. :( A good engineer could probably calculate everything out as long as they had the properties of all the parts of the circuits, motor, wiring, controller design, etc., but that's way more math than I can even imagine. :oops:



I would prefer to use variable regen and @stancecoke mentioned his firmware could support this. The bike has two wheels in the front and I wanted to add two hydraulic disc brakes. I planned to control them with independent levers but I want to control the motor brake independently. Are you aware of any brake levers that just output a signal without moving any cable or hydraulic? I thought about using a thumb throttle but I don't want to have to hold it all the time.
The one I mentioned for Xiaomi scooters is variable output. But it would be an extra brake lever, on top of your hydraulic levers.

You could add a load cell to the hydraulic lever in a way that lets it feel the force across the lever as you just barely begin to pull it, and feeds taht into an amplifier that gives you the right voltage range for your regen input.

Instead of a load cell, you could use a resistive strip like those on some MIDI controllers, where the resistance decreases the further away from the "open" end of the strip you touch/press it, and translate that into a voltage for the regen input. This would require moving your fingers along the brake lever length to activate at different amounts.


There's other ways to do it too, such as a pressure transducer int he hyrdaulinc line, and use one sensitive enough to fully activate the regen before it begins activating the hydraulics.
 
I highly recommend chekcing out the ebikes.ca motor simulator so you can see what your proposed setup will require, to make sure you get teh right parts to do that job, and that hte parts you already have that you want to use can do it, so you don't potentially damage them or overstress them.
I'll try to come up with some values for the simulator.
You can, but you have to switch in the low-charge-state one before switching out the near-full one, and they will be at different voltages, so the switch system has to handle not only the regulated current from the regen, but the *un*regulated current from the higher voltage battery discharging into the lower voltage one, and both their BMSes also have ot handle that.

You can't block that current with diodes because that also blocks the regen current.

If you want to avoid that, you have to switch out the near-full one before switching in the low one, and that leaves some amount of time that the controller is not connected to anything, and that's when there's no load on the regen current, so the voltage instead spikes up, which is the whole reason to try not to disconnect the battery. ;)

You might be able to switch fast enough, but you might not. The only way to find out for sure is to test it, and any non-pass of the test is likely to damage or destroy the controller FETs at minimum. :( A good engineer could probably calculate everything out as long as they had the properties of all the parts of the circuits, motor, wiring, controller design, etc., but that's way more math than I can even imagine. :oops:
I think I'll get to bike running at first and worry about regen later. But as you mentioned even if I don't actively use it, I can still encounter this problem when the motor is turning too fast?
The one I mentioned for Xiaomi scooters is variable output. But it would be an extra brake lever, on top of your hydraulic levers.

You could add a load cell to the hydraulic lever in a way that lets it feel the force across the lever as you just barely begin to pull it, and feeds taht into an amplifier that gives you the right voltage range for your regen input.

Instead of a load cell, you could use a resistive strip like those on some MIDI controllers, where the resistance decreases the further away from the "open" end of the strip you touch/press it, and translate that into a voltage for the regen input. This would require moving your fingers along the brake lever length to activate at different amounts.


There's other ways to do it too, such as a pressure transducer int he hyrdaulinc line, and use one sensitive enough to fully activate the regen before it begins activating the hydraulics.
You mentioned a cable operated throttle, but I only found people who were trying to build them. Are there actually some available or is there one that's easy to build? I think a frictionless thumb shifter would be great
 
But as you mentioned even if I don't actively use it, I can still encounter this problem when the motor is turning too fast?
Yes, if the motor spins fast enough to go above the fastest speed the controller/battery can drive it at, it will have backemf bemf that exceeds the votlage the controller can send it, which means it now feeds bakc thru the controller fets to the battery and is limited by the battery voltage/resistance that loads it down; if the battery disconnects then ti's just in the controller and gets higher and higher with no load on it.

You mentioned a cable operated throttle, but I only found people who were trying to build them. Are there actually some available or is there one that's easy to build? I think a frictionless thumb shifter would be great

cable oeprated throttles are easy to find. i link the ones i bought in several threads i've posted in, some in the last few months, also in my sb cruiser and cloudwalker cargo bike threads, and in my how to build a variable regen brake lever thread. others have used similar ones.

you can use anything you like to do the cable pulling; throttle handle or thumb type, brake lever, contraption of your own invention, etc. ;)

As previously noted some Xiaomi scooters have a lever with an analog output, nothing else needed. so youc an buy them separately. there are posts about them here on es as well. ebikes.ca may even sell them or ones like them.
 
I forgot this distinction when I brought up the downhill regen / full battery problem:

If the BMS is a common-port type, that will mean the controller has nowhere to dump this current now, and it becomes a voltage that builds up (not like static electricity) very fast and can quickly exceed the voltage the controller FETs and other parts can handle, destroying them.

If the BMS is a separate-port type, then it can't stop the regen current, and the cells will begin overcharging. How serious this problem is depends on the length of time the regen goes on, and the amount of current flow there is. If it's a very low current, less than 50mA, it's likely that the BMS balancing shunts (if it is a balancing type) will handle it. Above that (whatever the shunts can do) the cells will charge.

If there is no BMS, the cells are "all" that is at risk, as those will still overcharge, but there's nothing to disconnect the controller from the battery and cause the voltage spike.

(it's also edited into the post above about it for easier searching)


Also this thread discusses some alternate load dump scenarios
 
Last edited:
cable oeprated throttles are easy to find. i link the ones i bought in several threads i've posted in, some in the last few months, also in my sb cruiser and cloudwalker cargo bike threads, and in my how to build a variable regen brake lever thread. others have used similar ones.
I finally found this eletric motorcycle throttle you were talking about, it looks very promising.
I forgot this distinction when I brought up the downhill regen / full battery problem:

If the BMS is a common-port type, that will mean the controller has nowhere to dump this current now, and it becomes a voltage that builds up (not like static electricity) very fast and can quickly exceed the voltage the controller FETs and other parts can handle, destroying them.

If the BMS is a separate-port type, then it can't stop the regen current, and the cells will begin overcharging. How serious this problem is depends on the length of time the regen goes on, and the amount of current flow there is. If it's a very low current, less than 50mA, it's likely that the BMS balancing shunts (if it is a balancing type) will handle it. Above that (whatever the shunts can do) the cells will charge.
I'm not sure what it is, I'd need to open the battery for that. They're from older specialized bikes where you can't charge the batteries in frame but only when removed, but I'm not sure if it uses other contacts on the bottom.
 
Yes. You can trigger a constant regen current by the simple switch of the break lever, or use a thumb throttle or linear break lever for variable regen current.

regards
stancecoke
Can you use the same connectors on the controller for variable regen or do I need to use another pin that supports analogue inputs? I want to use a thumb throttle for acceleration aswell
 
I finally found this eletric motorcycle throttle you were talking about, it looks very promising.

The ones I've got are much better and more controllable than any of hte grip or thumb types I'v eused.

Keep in mind that they're probably not all identical, so some are likely better htan others.

I'm not sure what it is, I'd need to open the battery for that. They're from older specialized bikes where you can't charge the batteries in frame but only when removed, but I'm not sure if it uses other contacts on the bottom.
Generally, if it has the same contacts for charging as discharging, it should have a common-port BMS.

But having separate contacts on the case doesn't necessarily mean it's separate ports, as they can be wired to the same pads on the BMS itself. :)

As long as the BMS has only one pair of pads to connect to the outside world with, it should be a common port. That's usually C- (to charger and controller) and B- (to cells).

If it has 3, P- (to contorller) C- (to charger) and B- (to cells) it's a separate port type.
 
@stancecoke are the controller input pins freely remappable when using your firmware? I'm trying to choose a model of the 12FET controller and some are available with throttle inputs, others have brake lever inputs. Could these also be used for analogue inputs or do you need to use other pins for that?
I want to connect a torque sensor, a thumb throttle for acceleration and a throttle for variable regen if possible.
 
Back
Top