Convert 12>0V to 0>12V = OpAmp?

Thread Starter

twaroc

Joined Sep 20, 2007
13
Wondering were to start ...

I have a signal from a fan control head that is 12V when OFF and 0V when 100% ON. Any value between there will vary the speed of the fan.

I would like to convert this signal so it is 0V when OFF and 12V when 100% ON, so I can use a different fan driver that can handle a more powerful fan.

I figured a differential op amp would be a good way to start, as the output voltage would be the difference between the two input voltages. Per the equations if all the resistors are the same value, the overall gain is 1 and thus Vout = V1 - V2. See attached schematic. I bread boarded it (and double checked my inverting and non-inverting terminals were hooked up correctly). Both Inputs are 12V but my output is 3V. I'm using an OP296 with +12V and 0V to the rails.

Can I achieve my desired result using this method? I was also thinking of putting the input signal through inverting opamp and then another summing op amp.

Looking for some advice ... thanks.
 

Attachments

blocco a spirale

Joined Jun 18, 2008
1,546
I'm not sure exactly what the application is but it sounds like your proposed solution may be over complicated. I assume the fan common is at 12V and the output is a PWM signal to 0V?

Can you post a schematic of the fan controller?
 

Thread Starter

twaroc

Joined Sep 20, 2007
13
I wish it was a nice PWM signal - I don't have a schematic and I'm not totally sure how it works, but I attached a schematic of the whole system.

The control head will not function without the old motor driver connected. There seems to be some sort of current sensing between the two signal and feedback wire, and I can't figure out a way to 'fake' the signals back to the control head to make the control head function.

Therefore, I was focusing on the "control" wire (wire that drives the ground of the motor). This is 12V when off, and 0V when on and I wanted to switch it with the op-amp.
 

Attachments

blocco a spirale

Joined Jun 18, 2008
1,546
If there's no schematic and you don't know how it works I'm sure that I won't be able to guess. I don't even know what the actual hardware is or how you arrived at your proposed solution.
 

Thread Starter

twaroc

Joined Sep 20, 2007
13
Hardware is automotive stuff, being transplanted from one car to a hot rod. All the schematics would be intellectual property of the companies that makes them. I don't think there is another way to do this and I described a fair amount of detail into the systems operation.

I have a control signal and I wish to modify it. My question was how to do that with an OpAmp and get some hints about setting it up. Can you help with that aspect? Please do not infer any disrespect, I'm just trying to get a feel if it was possible.
 
Last edited:

SgtWookie

Joined Jul 17, 2007
22,230
Were the 0-12v signal from the fan simply a voltage level, your op amp circuit should work as you expect; ie: with 12v on both inputs, you should have 0v (or very close) output. You might double-check your input offset voltage by grounding the + input and connecting the output to the inverting input. Under those conditions, the output should be < 0.8mV.

The OP296 has very high input impedance. If the fan speed output is current rather than voltage related, your results will not be what you would expect. A signal that is current rather than voltage dependent would be immune to electrical noise, as current in a circuit is constant, whereas voltage is not.

It may be that your fan has a Hall-effect switch in it. As the speed of the fan increases, the Hall-effect switch gives a fixed-time output signal more and more frequently; at the point the fan is operating at full speed, the current source from the controller is pulled to nearly 0v, but at idle the current draw from the sensor is so low that the controller's current output is nearly 12v.

Note that this is merely speculation on my part.
 

Thread Starter

twaroc

Joined Sep 20, 2007
13
SgtWookie I think your speculation might be fact - as the old motor had three wires coming out of it (as shown in my diagram). One was power, one was ground, and the other was that control signal. Would the hall-effect switch be able to drive the fan as you described? I've only heard of hall-effect sensors, which would provide feedback only, no control.

I'm going to rebuild my breadboard circuit again without connecting any of the fan circuitry. With the high input impedance of the OP296, are 1k resistors too small? Should I use 5K or 10K?

Should I attach a weak pull down to the output in order for it to function correctly on the breadboard, or will I get the desired result leaving the output pin floating because of the negative feedback resistor?
 

SgtWookie

Joined Jul 17, 2007
22,230
SgtWookie I think your speculation might be fact - as the old motor had three wires coming out of it (as shown in my diagram). One was power, one was ground, and the other was that control signal. Would the hall-effect switch be able to drive the fan as you described? I've only heard of hall-effect sensors, which would provide feedback only, no control.
I was simply forwarding a theory, a SWAG if you will (Scientific Wild-Arsed Guess). A Hall-effect sensor does not "drive" anything per se; it merely detects the presence/absence/relative field strength of magnetic components, or more accurately, the gauss. Such Hall-effect sensors may be of an on/off type, or a relative strength kind of thing. They are available in myriad configurations, but a very common configuration is power in/Vcc/Vdd, ground, and an open collector or open drain output. A typical capacity of such a unit is around 20mA. If the designers coupled that to a one-shot timer such as a 555, who's output pulsewidth was fixed at a time that was approximately equal to how long it took for the fan to turn 1 complete revolution, and the controller was attempting to charge a capacitor on it's output at a fixed current rate, that would pretty much complete the picture I was attempting to present.
I'm going to rebuild my breadboard circuit again without connecting any of the fan circuitry. With the high input impedance of the OP296, are 1k resistors too small? Should I use 5K or 10K?
Well, first see what kind of output you get with a steady 12v on both inputs (you should get about 0v out), and then a steady 12v on the noninverting input, and 0v on the inverting input (you should get about 12v out). Also check your offset voltage using the procedure I mentioned previously. That will at least confirm that your circuit is working with steady voltages applied.

Should I attach a weak pull down to the output in order for it to function correctly on the breadboard, or will I get the desired result leaving the output pin floating because of the negative feedback resistor?
If the signal output from the fan is an open-collector or open-drain output, you might have odd signal levels present. I don't know offhand. It would help a lot of you had an oscilloscope to look at the signal.

You could insert a low-value resistor (say, 1 Ohm to 10 Ohms) in the line between the controller and the fan signal, and measure the voltage across it. This is much safer than attempting to measure current directly. Measuring current directly often results in blown fuses in the meter (or blown meters :eek: ) Use Ohm's Law to determine the current through the resistor:
I = E/R
So, if you measured 1 volt across a 10 Ohm resistor, you would know that I = 1/10, or 100mA. Beware the possible power dissipation through the resistor. It may get quite warm. If you don't have any other place more reasonable to buy them, Radio Shack carries 1 Ohm 10W and 10 Ohm 10W wirewound resistors in 2-packs for $2. It would be a good idea to put a small capacitor across the resistor to supress any inductive "kick" the resistor might put out if the current is being switched on and off. Otherwise, you may kill either the controller module or the device in the fan.

Basically, if my theory is correct, you should see current flowing from the controller to the fan through the signal line; and the average current should increase with an increase of the speed of the fan.

If I'm correct, you will need a way to replicate the current source that the controller has; and how it's charging a capacitor (or similar) and discharging it through the speed sensor in the fan.

Like I say, I'm merely guessing. Constant current sources are a snap to make. An LM317 with a 120 Ohm resistor between the OUTPUT and ADJUST terminals makes a 10mA (nominal) constant current source.
 

SgtWookie

Joined Jul 17, 2007
22,230
Again addressing the size of resistors that you're using...

In some ways, using lower values of resistance is good; you will get less noise created by the resistors themselves.

But you must keep in mind that your OP296 opamp has a 4mA maximum output.
Since I=E/R, when your Vin on both inputs is 12v, the output attempts to go to 0v. 12/(2 x 1k) = 6mA. Your opamp doesn't have the drive (or current sink) capacity. Guess where it'll get stuck? At somewhere around 4v. You're seeing 3v, which means it's putting out (actually, sinking) more than 4mA current in saturation; 4.5mA.

So, if you increased all of your resistors to 4.7k or 5.1k (standard values) or even 10k, your opamp would then be able to assert 0v on the output. Using the 10k resistors would probably be better, because since you're using a single supply, it will make it much easier for the opamp to sink the output to ground. 14V/20k = 0.7mA. The 14v is when the alternator is charging the battery, which will be your worst-case scenario. 0.7mA is roughly 17.5% of the capacity of your opamp. You won't get a perfect 0v because almost ANY current flow into the output when it's so near the ground rail will cause an offset.

I highly recommend that you use metal film resistors for accuracy, stability over temperature, and low noise. Radio Shack sells an assortment of metal film resistors for about $5.50. It contains five 10k and four 4.7k, as well as a number of other values.

Something else to keep in mind is the severe environment under the hood of a vehicle. Your components must be rated for at least industrial temperatures, or they will rapidly fail.
 
Last edited:

Thread Starter

twaroc

Joined Sep 20, 2007
13
I got it working today. 10k resistors helped, 100k resistors seemed to work better - thank you SgtWookie for the insight.

Besides that my big problem was not one, but TWO bad OP296 chips. I hate it when people put broken things back in the drawer :mad: :mad: Wasted a few hrs on that...

Next step is to scale the output so it's 0 to 5V. I used a simple voltage divider on the output (100k, 150k) which did the trick. I'm assuming I could also feed the output into the second opamp of the 296 and set up a simple non-inverting amplifier with a gain of ~0.4?

I don't think that will work though... I'm using ground (0 V) as my -Vcc reference and I remember reading something about how my opamp is centered around 6 volts, so my scaling would only produce an output voltage between 3V and 9V. If I were to use this approach, I would either need to produce -12V at -Vcc or shift my output down 6V.

Am I making sense? How is that voltage shifting accomplished ... wouldn't I need 2 more opamps (one for scaling, one for shifting.)?
 

SgtWookie

Joined Jul 17, 2007
22,230
I got it working today. 10k resistors helped, 100k resistors seemed to work better - thank you SgtWookie for the insight.
Good to hear you got it working. :)

Besides that my big problem was not one, but TWO bad OP296 chips. I hate it when people put broken things back in the drawer :mad: :mad: Wasted a few hrs on that...
Well, it's quite possible that the 1st one was damaged due to the output being in saturation while you were testing it. While the opamp has some pretty decent specifications, it has a very meager source/sink capability at it's output. Still, 100k is pretty high. While that will keep the load on the output of your opamp light, it will make the circuit more vulnerable to noise, and there will be more noise from the resistors themselves. Metal film construction resistors will be an absolute necessity, at minimum.

Next step is to scale the output so it's 0 to 5V. I used a simple voltage divider on the output (100k, 150k) which did the trick. I'm assuming I could also feed the output into the second opamp of the 296 and set up a simple non-inverting amplifier with a gain of ~0.4?
Minimum gain for an opamp is unity, or 1; maximum is the open-loop gain of the opamp itself. However, you never want to run an opamp in open loop, because the output will always be in saturation.

Rather than using a voltage divider on the output, you could simply increase R3 to 12/5 of it's current value. Since it's 100k now, you could replace it with 240k. You will need to change R1 or decrease the 12v reference to 5v as well; as otherwise the scaling will be thrown off. See the attached simulation. The opamp is not the same as you're using, but it's a very good opamp.

If your absolute limit for the input of the new controller is 5v, you'd better plan for the input voltage of your inverting/scaling opamp to be 14.5 maximum, since during charging of a depleted battery the alternator will be churning out a lot of power. In that case, you'd use 14.5/5, or 290K for R1 & R3
 

Attachments

Thread Starter

twaroc

Joined Sep 20, 2007
13
Yea buddy! Got it working in the vehicle today (before it was on a bench). It actually works really, really well. Thank you for the help SgtWookie it's been a long time since I've played with OpAmps.

I'm sure I blew the first OP296 up by experimenting, the second one I plopped right into the 100k circuit and after much frustration, replaced it with a third one and everything worked fine ... grr.

I have the OP296 operating with 27k's and 10k's (I agree that the 100+k's open the door to noise, especially in a noisy environment like an auto). I also found a LM741 and duplicated the OP296 circuit. Since the LM741 can't do rail-to-rail, I'm using a LM7660 to generate -8V on the -Vcc of the LM741 (I have a +8V regulator powering the LM7660) and it works great too.

My question is, what would be more reliable? I'm thinking the LM741 chip, even though the circuit is more complex, just based on the fact that the OP296 is such a low-power device and I'm going to build this on a RadioShack board so there will be no large ground plane, etc.

I found some data on my fan driver - it's DC input sense is 0-5V with 25mA in max. Input resistance is 8kOhm so I'm running the output of the OpAmp right to the input of that driver, since the input resistance won't draw more than 25mA. Works good, just hope it works for a long, long time.
 

SgtWookie

Joined Jul 17, 2007
22,230
Yea buddy! Got it working in the vehicle today (before it was on a bench). It actually works really, really well. Thank you for the help SgtWookie it's been a long time since I've played with OpAmps.
Good deal :) Glad that the pointers helped out.

I'm sure I blew the first OP296 up by experimenting, the second one I plopped right into the 100k circuit and after much frustration, replaced it with a third one and everything worked fine ... grr.
Well, it's quite possible that whomever was experimenting with the opamps prior to your getting there was using the other half of the IC, and didn't properly make a unity gain amp with a midrange input from the other half. Of course, if you didn't do that with the one you're using, it's other side is probably zapped as well.

To make the opamp unity gain, the output is connected to the inverting input. To ensure that the output is not in saturation, the noninverting input is held at some voltage level that is between the power rails.

I have the OP296 operating with 27k's and 10k's (I agree that the 100+k's open the door to noise, especially in a noisy environment like an auto). I also found a LM741 and duplicated the OP296 circuit. Since the LM741 can't do rail-to-rail, I'm using a LM7660 to generate -8V on the -Vcc of the LM741 (I have a +8V regulator powering the LM7660) and it works great too.
Good idea - that'll make it less stressful on the opamp too, particularly when it's trying to get the output near ground.

My question is, what would be more reliable? I'm thinking the LM741 chip, even though the circuit is more complex, just based on the fact that the OP296 is such a low-power device and I'm going to build this on a RadioShack board so there will be no large ground plane, etc.
That depends upon the temperature rating of the device itself. You need at least industrial temp range (-40°C/+125°C) if you want any kind of reliability out of it. That goes for your LMC7660 too. It looks like the OP296 is rated for that temp range, but as has been batted about, it's pretty wimpy as far as current output..

I found some data on my fan driver - it's DC input sense is 0-5V with 25mA in max. Input resistance is 8kOhm so I'm running the output of the OpAmp right to the input of that driver, since the input resistance won't draw more than 25mA. Works good, just hope it works for a long, long time.
Well, that pretty much kills the idea of using the OP296 ;)

The 741 really is antiquated. Easy to get and cheap, but antiquated. With a 25mA load, it'll be somewhat hard-pressed to keep up.

How about some pictures of the vehicle you're working on? ;)
 

Thread Starter

twaroc

Joined Sep 20, 2007
13
The spec was the max input current allowed is 25 mA. If I used the OP296, I could always put an inline resistor that would limit the current to 4mA. I think I'm going to use the LM741 and current limit it since as you stated keeping the output away from the rails is easier on the device. I'm not to worried on temperature - it's a dune buggy and will not be anywhere near -40 or 125C. Plus, it will be in the cabin.

I have pictures on my other computer. It's the old soap-dish style body on a 69 bug chassis. Trying to swap a GM ECOTEC or Quad4 into that bad boy, which has the added benefit of working A/C :) It's a big W.I.P right now and the old lady ain't too happy with this newest project (engine swap, not the HVAC) because "it doesn't need more power". Women just don't understand :)
 

SgtWookie

Joined Jul 17, 2007
22,230
The Quad 4 was a good motor. If it's rebuilt to W41 specs, you can get 200hp out of it with a tuned exhaust. Zippy! Might want to put a rev limiter on it to keep RPMs below 6500. Otherwise, if something in the driveline breaks (or you break traction) you'll be slinging rods through the crankcase.

Well, 5v across 8k Ohms is 0.625mA - so you really don't need a heck of a lot of output. If the opamp has a spare mA, it'll be more than enough. Wasn't really thinking the 25mA max spec through completely before; that's in case voltages get out of hand (like static electricity for instance). To put 25mA through 8k Ohms would require 200v at the input. :eek: you won't require another current limiting resistor; it should be fine without one.
 
Top