OP Amp as signal conditioner HELP
DRMorrison
Posts: 81
A SOLUTION WAS FOUND FOR THIS SIGNAL CONDITIONER THREAD; page 2
The desire:
I need to input my vehicle's VSS (vehicle speed signal) into my Propeller, count the pulses, and then start a method once the pulse count
goes below some minimum value relating to 10 MPH. This is, on my car, about 400Hz.
The testing:
I found the VSS and put my oscilloscope to it and found that the signal is: 3.8V pp with a 1.4V offset above zero. Max output is 5.2V
I then put it through an opto isolator for two reasons. 1) Isolation 2) Remove the pesky offset. I wrote a small test program to count pulses and
display them on an LCD, along with the calculated MPH--a beeper goes off when the speed drops below my set point.
This worked. Sort of. The ECU didn't like my loading the VSS with the opto and gave me a fault code of P0500, which is a VSS Fault. Duh!
Other than that, the Propeller saw the signal and counted the pulses perfectly.
The code:
I'm using one of the counters to detect NEG edges of the VSS for one second to get pulse frequency. Dividing this by 45 gives me MPH, in my case.
This gets output to a LCD for test purposes--it's not the final circuit. I'm using a Demo board run from a 9V battery.
The return to the drawing board:
Round 2. I built up a voltage follower using a 741 op amp in single supply mode, powered by 5V. This doesn't work due to the fact it's a follower,
and is following the input. It does, however; have the high input impedance I need to prevent the VSS from becoming loaded down and giving the MIL.
The MIL (Malfunction Indicator Light) never came on, but no pulses were counted by the Propeller. My Fluke handheld was able to count the frequency
and not cause a fault code to appear. So, I know it can be done. I also had both devices connected with no MIL.
More testing:
At the bench I found that the input to the Propeller is: 3.4V pp, with a 1.4V offset, just like the VSS. The maximum doesn't go to 5V probably
because of the output voltage offset spec of the op amp. I suspect, and testing at the bench verifies, that the low min. of 1.4V coming into the Propeller
is not enough to give a logic low consistently. When I drop the min. voltage of the signal with my Func. Gen. it works flawlessly and is very stable.
The question:
How do I maintain the high input impedance of an op amp, yet get rid of the offset at the output of the op amp? Does a zener somehow
play a role in all of this?
Thank you for any help/advice.
The desire:
I need to input my vehicle's VSS (vehicle speed signal) into my Propeller, count the pulses, and then start a method once the pulse count
goes below some minimum value relating to 10 MPH. This is, on my car, about 400Hz.
The testing:
I found the VSS and put my oscilloscope to it and found that the signal is: 3.8V pp with a 1.4V offset above zero. Max output is 5.2V
I then put it through an opto isolator for two reasons. 1) Isolation 2) Remove the pesky offset. I wrote a small test program to count pulses and
display them on an LCD, along with the calculated MPH--a beeper goes off when the speed drops below my set point.
This worked. Sort of. The ECU didn't like my loading the VSS with the opto and gave me a fault code of P0500, which is a VSS Fault. Duh!
Other than that, the Propeller saw the signal and counted the pulses perfectly.
The code:
I'm using one of the counters to detect NEG edges of the VSS for one second to get pulse frequency. Dividing this by 45 gives me MPH, in my case.
This gets output to a LCD for test purposes--it's not the final circuit. I'm using a Demo board run from a 9V battery.
The return to the drawing board:
Round 2. I built up a voltage follower using a 741 op amp in single supply mode, powered by 5V. This doesn't work due to the fact it's a follower,
and is following the input. It does, however; have the high input impedance I need to prevent the VSS from becoming loaded down and giving the MIL.
The MIL (Malfunction Indicator Light) never came on, but no pulses were counted by the Propeller. My Fluke handheld was able to count the frequency
and not cause a fault code to appear. So, I know it can be done. I also had both devices connected with no MIL.
More testing:
At the bench I found that the input to the Propeller is: 3.4V pp, with a 1.4V offset, just like the VSS. The maximum doesn't go to 5V probably
because of the output voltage offset spec of the op amp. I suspect, and testing at the bench verifies, that the low min. of 1.4V coming into the Propeller
is not enough to give a logic low consistently. When I drop the min. voltage of the signal with my Func. Gen. it works flawlessly and is very stable.
The question:
How do I maintain the high input impedance of an op amp, yet get rid of the offset at the output of the op amp? Does a zener somehow
play a role in all of this?
Thank you for any help/advice.
Comments
741 opamp? can you still get them? Just run the signal into a darlington which has at least 1.2V Vbe threshold anyway and you can use a fairly high value base resistor of 100K of so and connect a pullup of around 1K to VDD, This should have the desired effect. If the transistor still turns on with 1.4V then just add a diode in series with the base to drop that down another 0.6V. Alternatively you can use a normal NPN with a red LED and a series resistor of around 10K-33K in it's base but use a 3K3 in the collector.
Standard NPN connections:
signal
+LED
10K
B(NPN)
VDD
3K3
C(NPN)
> Prop
I had a few 741's laying about.
The LED route didn't work, as I mentioned using the Opto isolator. I used about 10k also, but this was still enough to drag the VSS down and cause a fault code.
Well the darlington will be fine with 100K base resistance or more, perhaps even 1M, so I would just load up the line first with 100K or more to see what it's happy with but certainly the darlington approach is simple plus you can just make your own darlington by cascading two NPNs emitter follower fashion.
Thanks for the reply.
I will try that tomorrow, and I suspect that it will work. Since attaching the DMM had no effect, and it states 10M Ohm input impedance.
OR
I could suggest using the "Difference Amplifier" configuration, with the inverting signal being a 1.4V signal (which you could get from the 3.3 Volt line and divide with resistors).
Then the amplification is made to match up to another 3.3 Volts (for the Prop signal) - or it seems that leaving it in unity will be O.K. The Prop can handle the 5.2V if there is a big resistor to limit the current. (See their Application Notes...)
(If I didn't explain it well enough, maybe look up "Difference Amplifier"; or even just a "subtractor" configuration in this case (if you supply the 1.4 volts.))
Here, the Voltage going to the "-" of the Op-Amp could be the 1.4 Volts, the full signal going into the "+" of the Op-Amp. The resistors are all of the same value. It will yield a unity gain of the difference between the two; it will have high impedance for your auto signal; it will vary from 0 to 3.8V (or so) and can go to the Prop with a resistor.
The overall offset and 5.2V going to the Propeller is not the problem; it is in achieving a logical low or zero when the offset is 1.4 Volts.
Yes, no logical low is the problem. The count gets out of synch even with a known/steady signal supplied from the waveform gen. I will look into the Diff. Amp configuration.
Well, it's not quite as simple as that. The signal coming form the ECU, the VSS, is sensitive to loading and will cause the dreaded P0500 fault code. I feel that the op amp will give me the high input impedance
I need to prevent that, but perhaps not. I will try the suggestion that you gave first thing tomorrow.
Thanks again.
741 is designd for +/-15V supplies, barely works at +/-5V, doesn't function on simgle supply at 5V
Discard them!! Get some NE5534A's for low noise audio (still need large supply voltage) and get some
of rail-to-rail low voltage devices for general use. Thermocouple and instrumentation amps are also worth
stocking up on.
There is a big difference between 10K and 1M and there is no way that the tacho circuit could be affected by 100K loading because then it would be so sensitve to any noise and capacitance etc. Take my word for it, I'm someone who uses opamps and an opamp, esp the 741 is the wrong way to go. Just get that darlington and you will see.
However, time and time and time again, I see the complex solution being taken when a sure and simple solution is rebuffed, and then more problems arise because of poor understanding. At least it keeps the forum active.
Some days I do have an itch to do something analog... sometimes I even bake bagels, or consider knitting socks. And I do have an awful lot of electronic junk around that is of no use. May I send you my 100 megaohm resistors? The are just plain embarrassing to have in my junk
Peter J is pretty savy.
You don't really need much to clean up the signal. And for digital stuff, the comparitors, like an LM339 will make a nice square wave out of junk. They also work up to 36V input, and can be handy since they are open-collector .. the output behaves nicely on a 3.3v Propeller i/o.
LM339 found here ===> http://www.ti.com/lit/ds/symlink/lm339-n.pdf
As you can see, there are lots of ways to do this. But the general goal is to keep the part count low and the build simple.
The optical isolation is a good idea. Maybe not the best as you can pretty much trust a plain old transistor or a darlington stage to suffer damage if a big transient or reveral polarity comes through.
Best wishes.
BTW, I could be that you have coincidentally acquired a ground fault along the way.
Disconnect your work and see if the problem goes away or remains. Are you tapping in at the coil, or did you tap in at the hall effect sensor? I suppose there could be an amplifier stage between the two in some situations. I'd tap in at the coil wire to avoid the ground fault.
It certainly seems like the ECU is providing you a raw signal from the Hall Effect sensor... maybe for scope analysis. The pulse to the coil will be strong and have the same info.
While a normal transistor can provide a gain of about 50x, a darlington can provide something of about 1000x. It eliminates all the fiddling with an IC package and having 6 or 8 pins to wire; you go down to just 3 leads to hook up.
I just wanted to set aside all my kidding in my previous posting and welcome you to the forums.
The main thing is you should be able to get a good stable solution that doesn't intefer with your car's ECU.
Nothing wrong with digging up old parts and experimenting with them. It is just that OPamps have improved greatly and the newer ones are easier to use. Even then, the OPamp will replicate all the noise in the signal faithfully, whereas a comparator will remove the noise that might issue false pulses.
Resistor networks in the megaohm region tend to cause a lot of trouble at logic voltage levels... the amount of current that is driving logic is so low that noise can easily overwhelm the stability of the logic signal.
The signal i'm working on is the VSS (Vehicle Speed Signal). It comes from the Hall Effects switch mounted at the transmission. It is a very nice square wave as it goes into the
ECU. As mentioned above in the intro to this problem, the only problem is the 1.4V offset above ground that the signal has. AND that it is sensitive to loading--the opto isolator did
not work. Well, actually it did, but the ECU did not like it and gave a fault; P0500 = VSS System Fault. The speedometer worked during that test, but the MIL was set, so that option
is out.
The input to the opto, the IR LED, was too much of a load. And when I increased the input resistance with a larger resistor, the output all but disappeared. My Fluke set to Hz saw
the signal, and did not set the MIL. The specifications state 10M input impedance for the Fluke with 10pF cap.
I truly am trying to keep parts count down, for this is a small part of the entire circuit--that is always my goal. Also, if I've something around that will work, why not use it. If it works!
I'm going to try the darlington approach today, if that doesn't work, I'll try the op amp as a comparator. That will give a nice square wave output that will hit the bottom rail nicely and
give me the needed logic low. And running it off of 5V should give around 3.4V at the top.
@Peter,
The signal is not the tachometer, it's the Vehicle Speed Signal. It is a very clean square wave that peaks at 5.2V, and rides 1.4V above the Neg. rail. Giving 3.8V pp. The signal
itself doesn't seem overly sensitive itself, I think that it's the ECU that is having the issues, then setting the MIL (Malfunction Indication Lamp).
I will test your Darlington set up today. If not, I think that a window comparator may be the way to go. 1 op amp and a pot should do it.
Also, the VSS signal ranges from zero to about 6kHz. 6kHz equates to 133 MPH.
Thanks
Read the PDF for the LM339 that I provided. And Google "OPamp versus Comparator" to get a good presentation of why the OPamp just isn't right.
Actually, some comparator may also be too highly responsive and be more trouble. So I suggested an old standard one. Peter J knows far more than myself, but you sometimes have to slow him down to get him to explain.
I have never owned a car with an ECU and my own approach was geared toward what I though was a Tachometer project. I think that several of us are not realizing that you are actually trying to get a Speedometer project working.
The comparator should be able to allow you to zero in on the offset as well. I guess a zener diode and a resistor would provide a stable offset for the comparator.
It can easily be powered from automotive 12V, which is really a peak of 14.4V if you find that necessary. Or a lowly 3.3volts if required.
The reality is that you would have to fool any OPamp into performing as a comparator and that just adds a lot of fiddle-fuddle.
+++++++++
About the darlington.
I am interested to see how well this works.
First, it can have a gain of 1000x. But my experience for good audio preamps linearity with OPamps, that would require two stages of OPamps.
Second, I am not sure how you are going to remove the 1.4V offset. I guess I should read this whole thead again to see what I missed. In theory, the darling should drop 1.4V from a 5V power, but in many cases it will be more like 2.0V if saturation occurs.
square output. That would get input to the Propeller as my signal. And it doesn't matter if it is inverted, I'm merely counting pulses per second to achieve Hz. Once this Hz goes below a set value,
then the Prop will do something.
But if the Base to Emitter voltage drop is around .7V, then it probably won't work. This would be like the LED in the Opto.
Daniel
Just to help clarify a previous point.
:blank:
But we do have PNP and NPN choices to contend with. And then there is the issue of high side switching, versus low side switching --- only one of these will rightly include the voltage drop. A perfect 1.4V is unlikely. It could be higher or lower in reality. Read the PDF for the Darlington you are using and their will be voltage drop info under saturated ON.
It certainly is worth a try. A 3.0V pulse is more than enough to trigger the Propeller.
The BC517 Darlington seems to work out to 1.4V drop for low loads.
http://www.fairchildsemi.com/ds/BC/BC517.pdf
Yes, but it does need to go down to zero. The 1.4V offset seems to be enough, just enough, to prevent the Prop from seeing a logic low. I have the counter set to check for Neg Edges, and
when I JUST drop the offset voltage--using the Func. Gen., the Prop works fine. So, it's just on the cusp of working.
NOTE: I'm using my waveform generator to mimic the VSS. This allows me to fiddle-fuddle ;-)
Having looked at the Darlington data sheet, it seems that perhaps the VSS is going through something similar, hence the 1.4V offset. That would make sense considering the signal originated
from a Hall Effects connected at the transmission. Makes perfect sense. The ECU must be happy with a signal that it expects, but coughs when it is out, even a little.
Daniel
This screen shot shows both the input and output wave forms that I'm dealing with. The top is the input to the op amp, the VSS simulated on my waveform generator. Notice the 1.4V offset above zero, center line
marked 1> with 2V/div for both channels. Channel 2's cursors show the 1.36V offset with a max of 3.76V. The max is really nice, but it's that low that is causing all of the trouble.
The code for this little test routine is: This shows the output that the Prop sees with the signal shown on channel 2 above. The input and output of the two signals is a constant 500Hz.
When I change the input signal, which changes the output also, reducing its low end to near zero, about 820mV, things work great. Channel 2 in the pic below shows the reduction in its low end. Notice
that the top end doesn't change, it's still near its original value. I ultimately need to condition VSS, without altering it, to look at a minimum like the channel 2 waveform shown below. Having that go right
to zero would be even greater.
And what the Prop sees and displays on the LCD.
I'm currently testing some op amp configurations with no luck. I'm about to try the Darlington approach, but I don't think that it will work due to the voltage drop that will occur form the base to emitter,
adding yet more offset.
Back to the bench!
Daniel
I love your quote, by the way; hilarious.
I found this in that PDF:
Looks promising. As long as the conditions are the same.
Daniel
I used that circuit years ago with a BS2p. It worked great on a 1985 camaro. That is why I kept the application note.
-Phil
I can get either inverted or non-inverted, whichever I like. But, I don't like it. Too many components, even though the two ops are in the same package--LM358N. Also, an odd
thing happens when I remove the input to either op amp, the other amp gets that offset previously mentioned.
But I will try the diode/resistor set up. I actually tried using a diode, but I didn't think to add the resistor. Makes perfect sense now that you mention it.
Onward and forward...
Could you use a simple voltage divider consisting of two 100k resistors to drop the level to 0.7 to 2.4 volts? That should get you consistent low and high values. If not 100k resistors then maybe 250k?
Sandy
Thanks to everyone for their input and ideas.
This works great both at the bench, and on the road. The vehicle's ECU is happy--no fault codes. It also matches the speedo of the car exactly. It has a digital speedo, so no guessing at an analog pointer.
Here is the circuit:
LM358N OP Amp, using one of two on chip.
The pot is a 100k trimmed to the halfway point; so I'll use fixed on the PCB.
Here is the o'scope, waveform Gen. and LCD outputs. The VSS shown is not the standard
use, but rather it is my input signal from the vehicle (Vehicle Speed Signal).
Thanks again to everyone. Daniel
This is assuming, of course, that you're no longer using the optoisolator -- I just wasn't sure.
-Phil
You're correct, I should use a series resistor; considering the voltage is 3.7V, and will in the final circuit. I am not using the Opto; it loaded the VSS too much and gave me the fault code and set the MIL.
I'll check the amp draw into the Propeller from the Op Amp just to be safe.
Any suggestions on using perhaps a better Op Amp? Or does using it in this way not much matter which Op amp I use?
Does anyone know how to mark this thread as SOLVED?
Thanks a million, Daniel
To mark a thread as solved, just go back and edit the original post.
-Phil
I guess you are not going to explore actually using a comparator. Best wishes.