Controlling an Electronic Throttle Body using a PID controller

arbartz:
Trust me, I was against the idea of an electronic throttle body from the start (and I'm an EE!), especially because we have a cable operated throttle already. The ME's of the group insisted on using the electronic throttle body because they thought it would be easier than fabricating a throttle position sensor to a normal pedal that we can use to send to the motor controller. This way a commercial throttle pedal will control both the ICE and the motor.

At this point I don't have much of a choice other than to get it to work. If I shouldn't use a PID, then what should I use?

The throttle body doesn't have any control circuitry in it, just direct connection to the motor and two potentiometers that work inversely from each other. The throttle pedal has two potentiometers in it as well, but one of them has an extra resistor in series with it and instead of working inversely the difference of the two signals is supposed to be taken. I can't seem to find any documentation online about the system we have. All I have to go off of is this training manual we have. https://drive.google.com/file/d/0B7_wYqRQ2P5pT3l3RWhYRWpnaTA/edit?usp=sharing

In the manual there are no specific values listed, but a few plots of what the signals should look like and the pins we should use. Unfortunately though, it looks as if the ECU is supposed to do all the calculating. So I basically have to simulate that portion of the ECU with an Arduino.

With all the being said, do you have any suggestions as to how to control this in a better way?

Thank you!

I'm glad to hear you're suspicious of drive-by-wire. That could be one of the worst pieces of technology foisted upon mankind in recent years. :slight_smile:

The throttle body doesn't have any control circuitry in it, just direct connection to the motor and two potentiometers that work inversely from each other

So what you're saying is that you don't have a servo controlling the t-body. That makes a difference, so you want the the PID algo on the Arduino to turn your motor+TPS into a servo. I gotcha now :slight_smile:

PeterH:

jrubins:
PID are fairly slow algorithms by nature, they are designed for systems where there is lots of lag and overshoot, noise, or ripples.

I don't think that's at all accurate. PID is designed for controlling linear dynamic systems. A PID controller can be as fast or as slow as you want, and they are absolutely the right way to control something like a throttle where you want maximum responsiveness and yet avoid oscillations and overshoots.

It's not that it's not accurate per se, it's that it's a gross oversimplification. PID controls are good at controlling the rates of change. Servos use them to go fast to get near position X, then as they get close, they slow down. Once at the desired position they stop. If you manually turn the servo horn, the servo will apply more and more force from the motor to try to hold position.

Given that he isn't using a servo to control the T-body, using PID might make some sense. I'm concerned that running it through the arduino may be too slow, and since there's not really much disturbance or overshoot in a throttle system, may be unnecessary. The throttle just has to go to the position described and stay there, so a 1:1 mapping might be just as good.
Basically, what you are doing is like the Knob sketch except that you need to get the position yourself, reading one or both of your TPS.

I'd start with a simple read one throttle Pot, move the motor, read the TPS pot. Then get more complicated so you are using both throttle pots and both TPS pots. You could even do that with a separate pot, motor, pot to simulate your pedal, throttle, and tps.
Maybe something like this (pseudocode):
newThrottle = analogRead(pedal)
actualThrottle= analogRead(TPS)

if actualThrottle < newThrottle {motor ++}
if actualThrottle > newThrottle {motor --}

Alternatively, you could hack the Throttle Body with a servo instead of a motor,