Fechter's current based throttle

Are there any objections to a resistive current sense method like this: Falstad Viewer ?

Clipboard03.png


The "AC Source" is to simulate the pwm from a throttle assembly, it has to be manually set to a duty cycle to show the input cap smoothing the signal to a DC value for controlling current to the load.
 
Not sure I understand what you're trying to do there. A 1 ohm resistor is only going to handle a small current.
The PWM will be filtered into a nearly DC signal so the pass transistor will be running linear. Normally you want the pass transistor running in the switching mode.
 
Yes, the PWM is meant to be filtered into a DC signal for the op-amp to compare with the voltage drop across the 1-ohm resistor so it can adjust the base currents according to the throttle setting. Is it acceptable to have the transistor running in linear mode if it's doing so at the desired current level?

The reason I bring up the resistive current sensing is that hall sensors have a non-linear response curve, which I recall in an earlier post had caused some issues (has this been resolved in the most recent schematic?)
 
The Allegro hall effect current sensors are very linear but have a much larger signal than a resistor shunt and are zeroed at 1/2 the supply voltage. They are good for high current where a shunt resistor would need to be very large.

If your circuit is intended to run a tiny 1A motor, then it may be fine to run linear. Just do the power dissipation calculation to see how much heat will be coming off the transistor. For a typical bike motor, it would go up in a puff of smoke pretty fast.
 
fechter said:
The Allegro hall effect current sensors are very linear but have a much larger signal than a resistor shunt and are zeroed at 1/2 the supply voltage. They are good for high current where a shunt resistor would need to be very large.

If your circuit is intended to run a tiny 1A motor, then it may be fine to run linear. Just do the power dissipation calculation to see how much heat will be coming off the transistor. For a typical bike motor, it would go up in a puff of smoke pretty fast.

You can get unipolar sensors as well as bipolar , the bipolar are zero'ed at 1/2 the supply voltage, uni are zero'ed at near 0v for better resolution.
 
I was very surprised to see an opamp with no DC negative feedback in Fechter's circuit. Do you guys realize that the output of such a circuit will be in fact digital? :) So the controller will be only seeing zero throttle or full throttle, nothing in between.
 
Folken said:
I was very surprised to see an opamp with no DC negative feedback in Fechter's circuit. Do you guys realize that the output of such a circuit will be in fact digital? :) So the controller will be only seeing zero throttle or full throttle, nothing in between.

That would be true if it was a comparator. The op amp is looking at extremely small voltage differences (microvolts) so behaves somewhat linearly in the range where it operates. Negative feedback comes from the current dropping from the throttle signal being reduced. It's a longer loop, but that's how it works. In some cases I've tried adding a negative feedback resistor to lower the gain when oscillations were an issue. Probably not a bad thing but too much and it starts acting like a normal throttle again.
 
If the current feedback was immediate, the circuit would really sense microvolts. However, in the real world, because the total delay in the system is huge, this scenario seems unlikely to me.
I'm looking for a valid solution to the oscillations problem. The circuit I use is somewhat similar, but instead of an ebike controller I just use a combination of an RC ESC and a servo tester. I tried adding some capacitance to the output of the circuit, but it does not stop the oscillations. It only introduces more delay into the system, so it oscillates at a lower frequency. I only managed to stop the oscillations after I connected a "servo speed limiter" between the servo tester and the ESC. But I'm only seeing this as a temporary solution.
 
I tried making a RC version before. There's a thread on it somewhere.
I had the same issue with excessive latency in the control loop. With an analog controller/motor loop, it works well, but with the RC servo input there is a huge delay in response. I tried making a PID control loop with analog parts. This sort of worked but was very difficult to dial in.

One approach would be to use something like an Audrino with software that would accommodate the delay. I'm no good a writing code, so would look for an analog solution. PID loop code is out there.

A possible analog solution would be to have a slew rate limiter on the output of the op amp such that it could quickly respond to over current, but would slowly respond to under current so you could hopefully avoid an oscillation condition.

Here's one from way back I designed for John Tetz. You'll see a feedback resistor and capacitor making a PI loop. Picking the right resistor and capacitor will depend on a bunch of things and will need tuning.
Tetz current limiter 3.jpg
 
Fechter's circuit worked out of the box for a regular e-bike controller and is around 85% perfect .. I changed the opamp and messed with the feedback loop to tune for my tastes and for me it was then 95% perfect but it was very hard to tune for my needs and parameters did change if used on a different e-bike controller. I since went digital and used a arduino the thread ( parts and basic code ) is here http://endless-sphere.com/forums/viewtopic.php?f=2&t=61004 this code is old and have changed a fair bit since that posting but it do work .. maybe 95% perfect .. but its so much easier to play around to tune to different controllers ( even ESC's )

EDIT: the nice thing about using a arduino is that you dont need to use a servo tester as the arduino also replace that :D .
 
Wow, Fechter, so this circuit is yours as well! This is exactly what I'm currently using (except some values are customized). I googled it on a recumbents website couple weeks ago.

It's amazing how people with similar goals come to almost identical solutions. I'm already experimenting with Arduino Nano V3 (Atmega328) and Allegro Hall sensor. The only difference is that I've chosen an 8x2 LCD:

As you can see, I'm currently past the "hello world" stage, however, being a HW engineer, I'm not very comfortable with coding SW. So, huge thanks to Gwhy! for the link to that thread with the code! By the way, Gwhy, can you share your latest code please? Or at least summarize what changes to the original code were required?
 
the code in that thread is not to far off.. I changed it a little , so the gain value decreases as the setpoint ( difference between the actual current and set current ) gets closer together , its just a couple of extra lines of code. I don't really want to put up the full code that I am using as its is do not only do current and phase limiting :wink: I posted up all the key points so hopefully others will come up with other solutions rather than just copying what I already have. I will help you through PM's If you need it .

Edit:
The code that I'm currently using is 99.9% perfect for my controller/motor and riding style .. but may not be to everyone's liking , the plan was hopefully others will come up with different ways of doing it.. like in a big mixing pot and maybe something can come out of it that will be 100% for everyone.
 
Gwhy!, that's OK, my code will be quite different anyway. I'll be using button throttle and selecting the current limits by double/triple/etc click-and-hold. Maybe include a PID loop (thanks Fechter for the idea!). And I'm planning on displaying watts/volts/Amp-hours/motor run time on the LCD. Your code is a good starting point. If Adrian publishes his CommuterBooster code, I'll probably panic when I see it because it must be so much more complicated than yours. :lol:

PS. I'm not sure why some people are measuring phase current (motor current) as well? Isn't measuring battery current enough?
 
Folken said:
Gwhy!, that's OK, my code will be quite different anyway. I'll be using button throttle and selecting the current limits by double/triple/etc click-and-hold. Maybe include a PID loop (thanks Fechter for the idea!). And I'm planning on displaying watts/volts/Amp-hours/motor run time on the LCD. Your code is a good starting point. If Adrian publishes his CommuterBooster code, I'll probably panic when I see it because it must be so much more complicated than yours. :lol:

PS. I'm not sure why some people are measuring phase current (motor current) as well? Isn't measuring battery current enough?

if you are not making a hot rod bike then it is best to measure the phase current , but the problem is that phase current can get very very high and this then becomes a problem on what to use to measure them, so one solution is to measure the battery current and calculate/approx what the phase current will be ( it can be many times bigger than battery current ) this is what my code does. It very much depends on what you want out of the interface. When I made a analog interface ( fetcher's circuit ) i was only using the battery current which worked well but i needed a little bit more control over current at low throttle inputs ( this is where the very high phase current happen ) . I dont know if you found it but there is also a PID library for the arduino that takes a lot of the hard work out of coding your own pid controller , its ok and do work but I found it quite difficult to tune the pid for my needs so I abandoned the pid control whet a different route..

Edit:
If you do make some code that works then please document it in the http://endless-sphere.com/forums/viewtopic.php?f=2&t=61004&p=911697#p911697 thread as it would be nice to try and keep it all in one place for others.
 
I was actually planning to do a power-limited system, not just a current-limited one. Obviously, there is not much of a difference between measuring current and voltage and then calculating the power before or after ESC/ebike controller, as they are efficient enough. So what is the goal of measuring/limiting phase current exactly? Is it to limit the torque at low speeds? Or a kind of soft-start?
 
The torque a motor makes is directly proportional to the phase current. If you control based on phase current, motor torque will be constant for a given throttle setting over a wide range of speed. This gives a nice 'feel' to the throttle response.

Measuring battery current will keep the power constant for a given throttle setting. This means the torque will be higher at low speeds and less at higher speeds. You still have a nice soft start if you don't open the throttle too much. In practice, it feels quite similar to the phase current approach.
 
Allright, it finally makes perfect sense! I guess, for a thumb/twist throttle and a big battery, limiting the phase current will make for a better throttle feel. In my application, however, the button throttle will turn the whole thing on or off. If I choose to preset a certain phase current, the power will go up and up as I increase the speed, because obviously power = torque x speed. I would actually prefer the opposite: when speed increases, torque drops - this will happen when power is limited. Moreover, my current analogue circuit also drops power when I reach certain speeds, which helps saving the battery (and I only have a 67Wh battery at the moment). This happens because I had no opamp with full rail-to-rail output available, so the maximum voltage that servo tester receives is below the maximum possible voltage. This is a drawback that proved to be a useful feature. :lol:
 
Finally, my first ever C code works! No more messing with servo tester, servo speed limiter, current shunt, etc.
And I get Watts, Volts, AmpHours and Amps readings in realtime right on my handlebars.
PID was not required, everything works fine as is with no oscillations.
I’ve published the code in Gwhy!’s thread:
http://endless-sphere.com/forums/viewtopic.php?f=2&t=61004&p=999375#p999375

I’ll post some pictures in the CommuterBooster thread:
http://www.endless-sphere.com/forums/viewtopic.php?f=28&t=22187&p=996437#p996437
 
What current sensor are you using?

Great that it doesn't oscillate. Do you know if the code is using a proportional control? (sorry, I can't tell by looking at the code).
 
acs756sca-050b

The control is definitely proportional: depending on the current readings, the output pulse width varies continuously within its set limits.
 
Has anyone tested/implemented Fechter's 3rd Current Mode Throttle adapter circuit with filtering that he posted on page 8 of this thread?

I need something to smooth out the throttle response on the ZEV 7100 LR because it acts more like an on/off switch than a throttle at the moment and this seems to be the quickest and easiest fix.
 
Back
Top