Current Controller for RC ESCs

rhitee05

10 kW
Joined
Apr 7, 2009
Messages
841
Location
Upstate SC
As promised in the "Sacrificial Current Limiter" thread, here's a new thread to discuss the idea further.

Miles said:
I'm a bit surprised that no one has yet followed the example set by RonZ and produced a phase current limiter for RC ESCs, using one of the Allegro sensors, to act via the servo tester control.

It took a little thinking to figure out the best way to accomplish this with nothing but a few op-amps, but I figured it out. The idea here is to make a simple but effective all-analog circuit. So, there will be no fancy features you could do with a uP, but it should be dead-simple and reliable. The original idea was simple to sense and limit current, but it's not much harder to go ahead and implement throttle-based control. And since I'm already doing the throttle and this is intended for an ESC, I figured I might as well include the servo tester function as well. The result will be a box which takes the throttle input, measures phase current, and commands the ESC accordingly.

Here's the basic concept:

This box will act as an add-on to a standard RC ESC. Two Allegro hall-effect current sensors will measure current on two of the motor phase wires (the third is not needed). I will use the bi-directional sensors and not the unidirectional one that RonZ used. By measuring positive and negative current on two of three phases, we know all phase currents in all commutation states. This avoids the zero-speed issues RonZ had.

The tricky part was signal conditioning for the hall-sensors. The bidirectional sensors use Vcc/2 as the zero-current point, so 2.5V here. Voltages lower than 2.5A indicate negative currents, voltages higher indicate positive currents. The sensors are scaled so that 0.5-4.5V is the full range. The circuit I designed basically acts as a full-wave rectifier, except that it has to take the 2.5V offset into account, and then does basically a max() function. The conditioned signal is max(abs(Ia), abs(Ib)). I can avoid worrying about phase C altogether since these controllers only do block commutation - for a sinusoidal controller I'd have to do a little more math to calculate Ic and include it in the max() function.

The output of the signal conditioning is the magnitude of the phase current. Using the throttle input and a difference amplifier it then calculates the error signal. We have to provide adjustments here for throttle offset and max current command. The error signal is used to drive the servo tester which generates a pulse train for the ESC. Two more adjustments here set the min and max pulse widths to get full throttle range. I will also provide a hard current limit adjustment, which will cut in to the control loop and force the throttle down if the control overshoots.

I have a concept together for all this and most of it has been verified in SPICE. I just need to spend a bit of time putting a finished schematic together that I can post later.

A few questions:
- How fast can most ESCs accept the servo pulses? I set up the 555 right now to put out pulses at about 50 Hz which is pretty standard, but I'd like to make it faster to improve the loop response time. How fast can I go? 200 Hz? 250 Hz?

- Any other simple feature requests? My inclination is to keep it basic, but some functionality could be added if people think it'd be useful. Some quick thoughts I had for things that could be done:
- "Turbo" button which increases throttle gain while held
- Could provide 0-5V throttle output for interface to e-bike controllers
- Blinky LED indicators for various things
- ???
 
Miles said:
For ESCs that have reverse capability, would it be feasible to transfer the control of that to a switch?

I assume it wouldn't be difficult. How is the reverse triggered? Is there a separate control line from the PWM servo signal?
 
Ref: http://www.rcgroups.com/forums/showpost.php?p=15965163&postcount=9

"If you have a forward / reverse ESC then when the pulse width is 1.5ms wide the ESC will interpret that as off. As the pulse width is reduced to 1ms it treats that as one direction (say reverse), getting faster in reverse as the signal reduces in width - treating 1ms as full throttle in that direction. as the pulse width increases back up to 1.5ms it reduces in speed until the pulse width is 1.5ms again. Then as pulse width is increased to 2ms it treats that as accelerating to full throttle in the other direction."
 
Hmmm, that's more difficult but still should be possible. I see where you probably want this for the various forward/reverse gearbox ideas.

My main concern is it would make the servo tester adjustment very twitchy. It's relatively easy to adjust it so the pulse is a little less than 1 ms for zero and a little more than 2 ms for full throttle. You've got some leeway since you can put it a little past those limits, guarantee zero/full throttle, and still not have noticeable deadbands in the response. It would be a lot more touchy to calibrate zero to be exactly 1.5 ms, all the more so since the timing might drift a little with temp, time, etc. I'm just using a 555 and R-C network to set the timing, and a pot would be used to adjust the midpoint.
 
After a few more minutes of pondering, I'm a little less concerned. I think the closed-loop current control would probably compensate for the midpoint being off slightly.
 
Maybe on the reversing ESCs there is a small zone either side of 1.5ms that corresponds to "off"? I know they usually have a pause setting which acts before the change of direction. I don't know if that would be a problem?
 
That would be helpful, if the ESC has a small dead-zone at zero.

I do think it will be okay with the control loop provided two things:
- The loop can hold zero current. This means I have to pay careful attention to offset voltages and saturation, but should be okay. With the 200A sensors, the scale is 10 mV/A so it needs close attention.
- I have to be careful about what happens when the switch is flipped. You don't want to flip the switch and have the ESC blip to full throttle before the loop catches up. Although that could have comical results. :wink:

I also need to make sure I still allow for forward-only ESCs. I can probably work out a way with one or two jumpers, or you just populate one set of components.
 
My inclination is to keep it basic

A very basic unit would be very inexpensive for the parts, and some quick and dirty beta testing might give you some useful data. It may end up really needing the more sophisticated version to work properly, but...you may even be surprised at how well a basic unit performs?
 
Miles said:
Would there be an advantage in using the ACS756 sensor, if you didn't need over 100 amps?

Probably not. There might be a slight advantage in price - the 758 is about $7, but even the low-current SMT versions are still mostly around $5, so the 756 might be like $6.50, but I don't think anyone running an RC bike is worried about $1 or so. I did consider using one of the cheaper low-current versions - you can set up a current divider whereby the sensor can measure currents several times its rating - but that also didn't seem worth the trouble to save a few bucks.

However, the 758 comes in 4 flavors with +-50/100/150/200A full-scale readings. It's all the same sensor, but the slope is changed internally so it maintains the same full-scale output range (from 40 mV/A to 10 mV/A). That would give better accuracy for the lower-current bikes. The lower slope of the high-current versions just makes it more of a challenge since it's easy to get a little bit of saturation, but even 50 mV of error puts me 5A off! The closed-loop setup should tolerate some error okay, but the less error the better.

spinningmagnets said:
A very basic unit would be very inexpensive for the parts, and some quick and dirty beta testing might give you some useful data. It may end up really needing the more sophisticated version to work properly, but...you may even be surprised at how well a basic unit performs?

I think a basic unit could perform quite well. It would definitely need some beta testing, especially in the control loop parameters. Simple is good, especially when you're only working with op amps and a handful of R's and C's. However, some functions could be surprisingly easy to implement. For example, a "turbo" button could be done simply by shorting out a resistor, which would increase the gain of the throttle slightly.

It wouldn't surprise me too much if the two Allegro sensors ended up being 50% of the cost of the box (excluding PCB)! Op amps, resistors, and caps are all dirt cheap.
 
Put me up for one(if you want to sell them)

This is badly needed, I don't think sensorless start up problems is any near the problems made by twitchy throttle and high power bikes. It would be like a dream come true for alot of the people having a high power bike. Strange that no one have asked more about it before.

Thank you for taking the time to make this.
 
rhitee05 said:
- Any other simple feature requests? My inclination is to keep it basic, but some functionality could be added if people think it'd be useful. Some quick thoughts I had for things that could be done:
- "Turbo" button which increases throttle gain while held
- Could provide 0-5V throttle output for interface to e-bike controllers
- Blinky LED indicators for various things
- ???

This would be fantastic for my friction drive project, but two extras are needed for it:
1) adjustable throttle response rate. This allows you to hit full throttle, but the electronics will slowly ramp it up to full, and also on the down. This is used to smooth the engagement of the mechanical system.
2) minimum speed threshold. this takes in a wheel sensor input, and zeros the throttle unless a minimum speed is met.

For high power setups people may be interested in (1), but (2) is particular to friction drives assists. If they were easy to implement it would mean I didn't need to continue with my uC based version I am working on.

- Adrian
 
adrian_sm said:
This would be fantastic for my friction drive project, but two extras are needed for it:
1) adjustable throttle response rate. This allows you to hit full throttle, but the electronics will slowly ramp it up to full, and also on the down. This is used to smooth the engagement of the mechanical system.
2) minimum speed threshold. this takes in a wheel sensor input, and zeros the throttle unless a minimum speed is met.

1) shouldn't be difficult, and is something I had considered doing already. It doesn't take much more than a diode in the right place to provide different ramp speeds for up and down. I assume in most instances people would want a slow ramp-up but faster ramp-down.

2) would be a little more difficult. I could think of a couple ways it could probably be done, but I hope you understand it won't be on top of my to-do list. :) If we go to the trouble of providing a wheel speed input, that raises the possibility of proper cruise control, but now I'm getting well ahead of myself. I need to get something simple working before I get too ambitious.
 
I agree. Get the core functions rock solid.

As for the ramp rate. I believe most people will want no ramp control. Only those with over powered systems to tame, or friction drives will want anything between them and immediate response. So default to no ramp control would be best.
 
Here's a little teaser just to let you all know that I'm still working. After a couple of iterations, I've found a version of the signal conditioning circuit that I'm happy with so far. It can handle full-scale current signals without saturating and behaves well near zero current. It looks good in SPICE but I'll have to break out the breadboard to be sure. This circuit acts more or less as a rectifier for the current signals, where the output is max( abs(Ia), abs(Ib) ) over a range of 2.5V (zero) to 4.5V (full-scale).

SigCond Demo.png

The green and blue traces are the hypothetical current sensor inputs. Here they're sinusoids 120-deg apart and different amplitudes, which is not realistic but a useful test case. Light blue is the 2.5V zero level and red is the conditioned output.
 
I would love to test one of these for you. I would also like to stock these for resale if they work is well as I assume they will.

This would cure many of the little glitches related to RC setups. I had a conversation with someone on this forum about phaze-current limiting just this morning.........

Matt
 
Miles said:
Thanks Eric. :D

Phase current limiting; current based throttle and reverse switching. Awesome!


Agreed.

I'm pumped for this Eric! This will put RC controllers back on the table for many people.
 
recumpence said:
I would love to test one of these for you. I would also like to stock these for resale if they work is well as I assume they will.

+1 Ditto... please put me down for one, i have ditched my Infineon in favour of a HV160 so any help
keeping it alive and well would be hugely appreciated :)

KiM
 
Hey all, thanks for the interest and vote of confidence. Matt, appreciate the offer and will probably take you up on that when the time comes. Nice to know there won't be an issue finding a beta tester willing to beat the hell out of it!

My plan for now is to start really simple and then add features. Mark I will be just the current limiting functions, no current-based throttle or control loop yet. I think I'll also include the servo tester circuit, which is really simple. Would it be useful to people to include a 5V supply in the box? It wouldn't be hard to put a little converter inside which would supply power to the box and to the throttle, which would get rid of the need for a separate BEC. So long as people don't need it to supply power to anything else, the supply would be easy to design since the current is so low. The servo tester and 5V supply would make this pretty much a one-stop box that goes between the throttle and ESC.

For the current limit, I'm thinking about a two-level design. The first would be fast-acting, designed to immediately pull the throttle to zero. The idea is this would prevent the sort of quick ESC exploding events you're all so fond of. The second limit would use a filter to act on the long-term average current, over a period of a second or more. This limit would be set to a lower level and be mostly aimed at keeping heating under control. I would also make this limit have a more progressive action, so it just throttles back instead of zeroing the throttle out. What do you all think of this approach? The limits would obviously be adjustable, and I might be able to provide some adjustment on the time scale of the average limit (at the least, adjustable by replacing a resistor).

Do you guys have any idea what sort of phase currents you're seeing in these powerful setups? For example, I assume the Phoenix HV160 refers to a 160A battery current limit, which would imply that the peak phase currents could be several times that. If I need to accommodate phase currents greater than the 200A the largest Allegro sensor can handle, it will change the design approach somewhat. It's doable, I would just need to implement a current divider rather than measuring directly.

Once I get the basics ironed out, then I'll work on implementing the current-controlled throttle. After that I'll move on to the more niche features, like ramping control, forward/reverse, speed interlocks, and so forth.
 
rhitee05 said:
Would it be useful to people to include a 5V supply in the box?

Prolly the only input of any value ill have for this thread it will be waaaaay above my head. But a big HELL YES for a 5v power supply, be very handy indeed if it was "all in one" unit ;)

You have no idea how i look forward to this working and becoming available for purchase lol

Best of luck with the project :)

KiM

p.s i have recorded 280amp output with my HV160 dunno if thats of any help too you? I know Matt.S has done considerably more too.
 
Back
Top