# potentiometer to min/max relay circuit help

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
Hello, hoping to get a bit of help design a circuit to asses complexity and cost. I spent a bit of time searching google etc but may not know the proper keywords to return relevant circuit info. I can't imagine I'm the first person to want to do this.

I current have a throttle position sensor (tps) which is a potentiometer. It takes +5v as input and outputs anywhere from about +0.2v to +4.7v. I'm retrofitting it into a car that uses a more archaic style of tps, grounding toggle switches to indicate two absolute cases, closed and wide open. I would prefer to not hack apart the wiring loom and install custom mounting brackets for two microswitches, instead opting to install a circuit between the tps and ecu.

I'm wondering if there is an easily constructed circuit that will read the potentiometer voltage, and trigger relays at 2 specific voltage values (closed and wide open)?

I understand a comparator circuit can tell me if the tps voltage is above 4.6. then it's at wide open, but how would one construct a comparator circuit in tandem to tell me if the voltage is below 0.3v?

I suppose I could hack apart the potentiometer, insolate/remove the strip and solder in two absolute connection points where the wiper is at min and max....but again I'd rather destroy as little as possible because I would like to use it in the near future.

#### crutschow

Joined Mar 14, 2008
33,352
.................
I understand a comparator circuit can tell me if the tps voltage is above 4.6. then it's at wide open, but how would one construct a comparator circuit in tandem to tell me if the voltage is below 0.3v?
.....................
Easy. Just use two comparators, one with a 0.3V reference going to the plus input and one with a 4.6V reference going to the minus input.
(By plus input I mean that if the voltage is greater on the plus input than the minus input, the respective relay will be turned ON).

If you need a schematic for such a circuit I can generate one.
Is the relay just a standard automotive relay?

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
A schematic would be helpful, I am imagining I would need some sort of resistors? I'll... have to feed the circuit the same +5v as the tps, branch it, lower one line to 0.3V and feed it to + in comparator, lower the other to 4.6V and feed it to - in another comparator, also branch the tps input to the comparators ..then take the output of the comparators... but I'm not clear on exactly what the comparator outputs in terms of voltage to trigger a relay. Does the comparator also take a constant voltage input that it outputs, or does it output its + input? The triggered relays would be any relay that is capable of establishing a ground, as the microswitches in the older automotive setup are simply grounding switches that ground a pin on the ecu.

any help would be appreciated, as I think I sort of get it, but am not very confident in being able to draw up a proper schematic.

Easy. Just use two comparators, one with a 0.3V reference going to the plus input and one with a 4.6V reference going to the minus input.
(By plus input I mean that if the voltage is greater on the plus input than the minus input, the respective relay will be turned ON).

If you need a schematic for such a circuit I can generate one.
Is the relay just a standard automotive relay?

#### crutschow

Joined Mar 14, 2008
33,352
Here is an LTspice simulation of a two comparator circuit.
As can be seen, U1's output goes low when the input is above about 4.7V and U2's goes low when the input is below about 0.3V.

If the pin on the ecu outputs no more than 6mA when grounded, then you can connect the pins directly to the comparators' outputs.

If the pins require more than 6mA, then you will need to add a transistor buffer (I don't see that you need a relay).

R6 and R7 provide a small amount of positive feedback to generate about 50mV of hysteresis and prevent oscillations of the circuit near the trip point.

#### Attachments

• 2.2 KB Views: 4

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
Ok, thanks for that, looks great. I can read it, understand it and probably build it and I trust what you sad concerning its operation. However, I don't understand why some things are there and was hoping you might elaborate for my education?

R1,3,8 - what are those doing?
R4,5 - why am I connecting 5V and those two inline resistors to the comparator outputs?

I would not have thought about adding hysteresis, but I get it, nice

What then is out_hi and out_low in terms of voltage when the comparators conditions are met, ~0.1V? I see according to the graphic, and read that they both go 'low' when they satisfy my 2 specific voltage conditions, do they output nothing if the condition is not met, because it looks like to me they output 5v? I need the out_hi and out_low to somehow, in the end, be grounds to feed as input to two pins on the ecu, hence why I made an assumption that the out_hi and out_low should trigger grounding relays only when their 2 respective voltage conditions are met.

thanks again for your work on this, it's becoming a bit more clear on my end!

#### crutschow

Joined Mar 14, 2008
33,352
R1 and R3 along with R2 form a voltage divider to generate reference voltages of 0.3V and 4.7V for the comparators.

R8 is there for the positive hysteresis feedback. Without R8 any feedback voltage from R7 would be absorbed by V2.

The comparator output is an open NPN transistor collector so R4 and R5 are pullups to generate 5V logic-high when the transistor is off.

The outputs go low when the input conditions are met since you want a grounded signal going to the ecu inputs.
The 5V logic-high otherwise is due to R4 and R5 which should be the same an open relay contact as far as the ecu is concerned. To verify this you can measure the ecu pin voltages when they are open.
Actually you could likely remove R4 and R5 which would simulate open relay contacts when the output transistor is turned off for the logic-high.

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
To verify this you can measure the ecu pin voltages when they are open.
Actually you could likely remove R4 and R5 which would simulate open relay contacts when the output transistor is turned off for the logic-high.
Thanks for explaining all the resistors' function, it's very clear now what each one does.

But maybe I'm not explaining right? The ecu has no voltage. The two ecu pins need to receive a continuity ground when the out_hi and out_lo conditions are met, all other times the pins receive nothing. Normally the ecu sends one ground to two microswitches. When triggered at 'closed throttle' and 'wide open throttle' the respective microswitch is triggered and the ground circuit is complete back to a pin on the ecu. But I've got a 0-5V potentiometer on this throttlebody instead of 2 microswitches, so I need to create a circuit that simulates the two microswitch function.

I think the circuit you provided looks really good at looks like it will identify the 'closed throttle' and 'wide open throttle', I just need to better understand the output of comparators so I can make sure I am sending a ground to the ecu. I'll do a bit more research on comparators and if you wouldn't mind adding a bit more of your excellent knowledge on this I would be much appreciative.

Thanks again for your time on this!

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
R
The comparator output is an open NPN transistor collector so R4 and R5 are pullups to generate 5V logic-high when the transistor is off.
ok, so when input to the comparator is high, "It’s as though the output is simply not connected to anything"
and when the input is low, "current will flow from the collector, through the transistor to ground"

I read that on a site explaining open collectors.

A followup question(s), obviously this is posted in the automotive section, so I'm going to be dealing with 12V input, requiring a step down converter to feed the potentiometer and circuit. Is there a trusted brand? What kind of output amperage should I be looking for? I see little through hole 200mA options all the way up to sealed (LED usage) at 3A or 10A.

#### crutschow

Joined Mar 14, 2008
33,352
That explanation for an open-collector output is correct.

The fixed 5V output LM7805 linear regulator or the adjustable LM317 linear regulator are commonly used to generate 5V from 12V.
Either will supply up to about 1A (a heatsink is needed for currents above about 0.1A).
The current depends upon what circuits you have connected to the 5V. The circuit I posted requires less than 10mA.

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
That explanation for an open-collector output is correct.

The fixed 5V output LM7805 linear regulator or the adjustable LM317 linear regulator are commonly used to generate 5V from 12V.
Either will supply up to about 1A (a heatsink is needed for currents above about 0.1A).
The current depends upon what circuits you have connected to the 5V. The circuit I posted requires less than 10mA.
ok thanks! Two more questions?

I see 100+ LM393s listed at DigiKey, which one do I need for this circuit?

Do I need R4 and R5 considering that I only want no-signal/ground as comparator outputs?

thanks!

#### crutschow

Joined Mar 14, 2008
33,352
All the LM393s operate the same.
The main differences is usually the package.
For your application you likely want a DIP package as they are easiest to solder or mount in a socket.

One other consideration is the operating temperature which depends upon where you live and where in the automobile the circuit will be located.
If it's significantly outside the operating temp range of the LM393, you may want to consider the more expensive LM293 or LM193 which have a higher operating temperature range.

As I noted at the end of Post #6, you likely don't need R4 and R5.
But note that you should measure the current out of the ecu output when grounded to make sure it doesn't exceed the minimum 6mA the LM393 can sink.
To do that simply connect a multimeter set to measure current between the ecu output and ground.

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
Ok, ordered an LM7805 to take the automotive 13V down to 5V. I'll attach it to a nice piece of aluminum and add a little 12v dc fan blowing over the pcboard/heatsink for overkill.

I'll send that 5v 1A to the potentiometer and hope that it actually does register < 0.3V and > 4.7V ..if not, I'll change up the 14.7 to something slightly lower. (and get stuck with shipping charges for 1 resistor for my lack of forethought)

The tps out will feed the circuit that you provided, along with a ground and an additional 5v feed from that 7805

to two LM293Ps with applicable resistors as mentioned in the circuit 1k, 14.7k,100k. I got 1W, 1W and 1/2W resistors respectively just to be on the extreme safe side.

soon as it all comes in I'll assemble it and give it a test to see if the Out_Hi and Out_Lo do in fact give me ground when true and nothing when false.

I also got sockets for the lm293s in case i wire them up wrong i don't want to have to keep applying heat to the pins of the chips. But I still don't follow when you ask me to test the ecu output..the potentiometer is the output, the ecu is only receiving a continuity from ground signal. Since I'm feeding the pot from the lm7805, it should be 1A which is way more than the comparators can sink? What should I do..add heatsinks to the top of the comparators also?

thanks!

All the LM393s operate the same.
The main differences is usually the package.
For your application you likely want a DIP package as they are easiest to solder or mount in a socket.

One other consideration is the operating temperature which depends upon where you live and where in the automobile the circuit will be located.
If it's significantly outside the operating temp range of the LM393, you may want to consider the more expensive LM293 or LM193 which have a higher operating temperature range.

As I noted at the end of Post #6, you likely don't need R4 and R5.
But note that you should measure the current out of the ecu output when grounded to make sure it doesn't exceed the minimum 6mA the LM393 can sink.
To do that simply connect a multimeter set to measure current between the ecu output and ground.

#### crutschow

Joined Mar 14, 2008
33,352
The 1A is the maximum output of the regulator.
The circuits only take the current they require, which is likely much less than an amp.
Note that the piece of aluminum heat sink will need to be isolated from ground since the metal tab on the regulator is electrically connected to one of the pins.

I asked you to measure the ecu current to ground because that is what the comparator output will have to sink.
The ecu pin will likely have some current to ground when it's connected to ground.
You need to know what that is.

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
I asked you to measure the ecu current to ground because that is what the comparator output will have to sink.
The ecu pin will likely have some current to ground when it's connected to ground.
You need to know what that is.
ahh ok, will do. Haven't had experience in measuring ground voltage, always assumed it was 0. I'll power up the ecu soon as my kiddo goes down for a nap and measure. I assume I set it to the lowest voltage measurement and connect one lead to the pin and the other to ground? googling "how to measure current to ground" wasn't helpful.

#### crutschow

Joined Mar 14, 2008
33,352
ahh ok, will do. Haven't had experience in measuring ground voltage, always assumed it was 0. I'll power up the ecu soon as my kiddo goes down for a nap and measure. I assume I set it to the lowest voltage measurement and connect one lead to the pin and the other to ground? googling "how to measure current to ground" wasn't helpful.
You are measuring current to ground not voltage. I assume you know the difference (?).
I stated how to do that in the last sentence of Post #11.

#### Ryan Schuermann 1

Joined Nov 18, 2015
13
You are measuring current to ground not voltage. I assume you know the difference (?).
I stated how to do that in the last sentence of Post #11.
yes, but it's 0mA. Unless I'm doing something wrong? My multimeter is setup correctly, I have my ecu grounded and 12V power is sent to the ecu and it appears to be running properly in a pre-crank scenario. I can't crank or run, no oil yet... It's sending out ground to pin 2 of the throttle body harness plug..and actually it sends ground whether the ecu is on or not. I connected my multimeter to pin 2, and then to pin 1 to simulate the idle microswitch being engaged, read: 0mA, and then I tried pin 3 which would be the wide open throttle microswitch engaged, read: 0mA. ...what the ecu does with those grounds, I have no idea besides what it physically causes to happen. It may not even be part of a circuit, it may trigger a relay, I have no idea.

So, there seems to be no current being sent to or from my throttlebody.

#### crutschow

Joined Mar 14, 2008
33,352
What current range was the meter set to?

#### strantor

Joined Oct 3, 2010
6,743
@Ryan Schuermann 1 :
I think you are misunderstanding the way the ECU reads a ground...
But maybe I'm not explaining right? The ecu has no voltage. The two ecu pins need to receive a continuity ground when the out_hi and out_lo conditions are met, all other times the pins receive nothing. Normally the ecu sends one ground to two microswitches. When triggered at 'closed throttle' and 'wide open throttle' the respective microswitch is triggered and the ground circuit is complete back to a pin on the ecu.
and therefore ordering parts you don't need...
Ok, ordered an LM7805 to take the automotive 13V down to 5V. [...] I'll send that 5v 1A to the potentiometer and hope that it actually does register < 0.3V and > 4.7V
[...]
The tps out will feed the circuit that you provided, along with a ground and an additional 5v feed from that 7805

to two LM293Ps with applicable resistors as mentioned in the circuit 1k, 14.7k,100k. I got 1W, 1W and 1/2W resistors respectively just to be on the extreme safe side.
"The ecu has no voltage. The two ecu pins need to receive a continuity ground"
- How do you think that the ECU "receives a continuity to ground?"
The answer is that it does have a voltage. That's the only way it can work.

The comparator output is an open NPN transistor collector so R4 and R5 are pullups to generate 5V logic-high when the transistor is off.

The outputs go low when the input conditions are met since you want a grounded signal going to the ecu inputs.
The 5V logic-high otherwise is due to R4 and R5 which should be the same an open relay contact as far as the ecu is concerned. To verify this you can measure the ecu pin voltages when they are open.
Actually you could likely remove R4 and R5 which would simulate open relay contacts when the output transistor is turned off for the logic-high.
"you can measure the ecu pin voltages when they are open."

The graphic below illustrates the way that the ECU input is likely configured, in order to detect a "grounded" condition. There is likely an internal pullup resistor to an internal 5V rail (or 12V rail, or other V rail).

What then is out_hi and out_low in terms of voltage when the comparators conditions are met, ~0.1V? I see according to the graphic, and read that they both go 'low' when they satisfy my 2 specific voltage conditions, do they output nothing if the condition is not met, because it looks like to me they output 5v? I need the out_hi and out_low to somehow, in the end, be grounds to feed as input to two pins on the ecu, hence why I made an assumption that the out_hi and out_low should trigger grounding relays only when their 2 respective voltage conditions are met.
As I noted at the end of Post #6, you likely don't need R4 and R5.
You can replace the switch in the graphic with a transistor or a comparator (a comparator has an internal transistor)...

The way crutschow drew it, he put in external pullup resistors, which are redundant and unneeded. He was trying to illustrate a point but I think you took it the wrong way.

You don't need the external pullup resistors or the 5V rail. Your comparator circuit doesn't need to operate at 5v. It can operate at 12V (13.8V/whatever). the 5V is supplied by the ECU. You don't need a regulator or anything to sense the position of the pot and provide two sinking outputs.