Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations GregLocock on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help for 12V->5V opamp buffer for A/D

Status
Not open for further replies.

Chancy99

Computer
May 13, 2002
104
Hi All -

Please take a quick look at if you get a chance ...

I'm building a datalogger for in-car use, and am stuck at the A/D input design stage. I don't know analog/opamps :(

Basically, I need an opamp buffer for each input channel that will take a signal that can range from 0-14V and map it to the A/D input range of 0-5V.

It should have high input impedance so as not to load down the signal being monitored, and have low output impedance to allow the A/D to sample nice and quickly.

What little I know about opamps leads me to believe I can use a 14k resistor for RI and a 5k for Rf to get a less-than-unity gain to do that mapping. Is that right ?

Help ...

Thanks -

Dean.
 
Replies continue below

Recommended for you

A very important piece of info is missing : How many of this
do you need ? One or more ?

The more information you can give the more we can help .

<nbucska@pcperipherals.com>
 
melone:

Thanks for all the help. Heh, this isn't for ToyCo as a customer, this is for our enthusiasts group. Originally it was a much smaller project, just for myself and a couple of friends. It has since grown somewhat, with pretty high interest from the MKIV community, as well as others from the Honda and DSM crowds.

and
As such, the only information we have is what's available in the main service manuals. Needless to say, that's enough for a service tech to determine if a sensor/line is good or not, but not enough to log with :(

How many do I need ? The AVR Mega128 micro I'm using has 8 channels of A/D. 8 is not quite enough, so we're muxing 16 inputs. Although it would be nice to have complete control over all 16 channels, that's not absolutely necessary ...

We can put the dividers/buffers/etc after the 2->1 mux switches. So every *pair* of channels would be selectable for 0-5V or 0-14V or 9-14V.

I tend to agree that the 9-14V signals are probably the HI part of a HI/LO setup. But that's just for the Toyota Supra case. DSM or Honda or whatever may be different. Dammit, can't handle every single potential case out there, not without lots of DigiPots or something. Maybe Version II ...

So I think I'll go with simple resistor voltage dividers with a shorting jumper across the top one to allow 0-5V signals. Given that the addition of the opamps isn't that arduous, I think I'll also design a daughterboard with them in place, just in case, or as an option.

The A/D section will be a daughterboard, so it will be relatively easy to replace.

Dean.
 
In this case the component cost is not critical. I suggest:

Use a laptop as controller, use the printer port for interface. Divide the input. by 3 ( 100k/50K . Select the channel with an analog multiplexer to a common ADC.
Select a more accurate ADC to compensate for the division.

Put on the inputs a known appr. 10 V, and measure the attenuation, store them and use them as a channel-chanel cal. factor.

<nbucska@pcperipherals.com>
 
melone's idea of using a zener to get the offset on a 9-14v signal is a good one. It allows you to keep the source loading low. BTW, it is possible to wire a transistor as a variable zener if you want an accurate offset.

Have you already decided on the controller and getting the results to the display, or are you sorting out the A/D inputs first?

Using a micro with in-built A/D conversion on several ports would save the MUXing and give fast conversion, and also allow a serial link to the PC for display.
 
Hi Guys -

Not sure I understand about the zener. You're talking about putting a zener diode in series with the input signal being measured to get a voltage drop, or having that feed into the divider ? How would that offset the 9-14V signal down to near 0-5V ?

Gah, I don't know enough analog like this. Reading and learning here ...

The controller is an Atmel AVR Mega128. Actually, this has been a thread for a while on the AVRFreaks site. Check out the latest revision at :


The first post there has a schematic attachment, and there's a later revision about 1/2way down as well (Datalogger-sch-M128d.pdf). That only has the inputs going directly into the A/D of the micro, no divider/buffer. Once I finish up the schematic changes to add in the divider/buffering, I'll start a &quot;part7&quot; thread with the new schematic for comments.

This is what I'm planning on at the moment, if I don't go down the zener path. This will allow the use of an opamp if desired, or just a resistor voltage divider.

+5Vref O 100K 180K
0——/\/\/\/———0————/\/\/\/————0
GND O | |
| _____ | 0-5V
O————O A O———O | | \ | output
| jumper | 0——|- \ | to A/D
| | | >————0———/\/\/\/—0
0——O——/\/\/\/———0—————|+ / 1K |
9_14v 180K | |_____/ |
input | RAIL TO RAIL |
100K | OPAMP jumper |
GND O——/\/\/\/——O—————————————————————0 B 0————O

1) When NOT using an opamp, only two jumpers are used. The bottom one B is always in place, and passes the output of the divider to the output point. The middle one A is used to handle a 0-5V input signal, effectively bypassing the divider. For a 0-14V input, jumper A is removed, and you get the normal 0-14V -> 0-5V divide-down.

2) With an opamp, both jumper A and B are removed. The 3-pin jumper at the top is used to select the input signal range to produce a 0-5V output :

+5V-middle = 9-14V
GND-middle = 0-5V
none/open = 0-14V

So the same pcb can handle both the simple divider setup as well as provide for nice opamp buffering. Now, can you tell me more about the zener ?

Thanks -

Dean.
 
Bleah. That asciiart got all chewed up. Cut-n-paste it into Notepad and it looks OK.

Dean.
 
Place the zener before your voltage divider network.
 
melone:

OK, so input to zener diode to top of divider. Middle of divider to A/D input. What specific charateristics for the zener ?

Dean.
 
I wonder why you chose a complex micro with 8 x 10bit A/D, when a micro like the SGS-Thomson ST62 series would give you 12 x 8bit channels without MUXing, and with a conversion time of 80microsecs. 8bits would give better than 0.04% resolution - good enough for your purposes, bearing in mind your sensors would probably not have an accuracy better than that.
 
Valid question. I like the AVR architecture, basically. It's clean, simple, fast and efficient. Tools are free or cheap. In opposition, I loathe the PIC with its' paged memory and non-vectored ints.

To be honest, I don't know the ST6/7 series at all.

Dang it, too much to learn, too little time.

Dean.
 
Fair enough. I agree on the PIC. It's primitive.
 
Heh, OK. If you would like to see more information on the project, check out :


That has two pdf's - the mainboard and the analog interface board. Already made a change to the analog one - Ron pointed out that the DG333a mux switches could only handle rail-to-rail inputs. That is, 0-5V, and sending a 12V signal through them would probably let out the magic smoke.

So the top leg of the voltage divider had to be moved in front of the mux switches. I'll be posting a new schematic set tonight I think with those changes.

Any comments etc are welcome.

Dean.
 
Interesting. I just ran across this Tip/Technique from &quot;Test & Measurement World&quot; Feb 15 1999


or


They show the opamp in *front* of the voltage divider network. The premise here is to allow one to use very low value resistors, with comparitively lower errors in tolerance, hence more accuracy.

What do you think ?

Dean.
 
I really don't think that you need to concern yourself with minimizing your error due to circuit tolerence. Once again, I design engine controllers for a living, and if the signal was that darn sensitive, the auto manufacturer would use a differential signal configuration.

I applaud your effort in striving to achieve the most accurate circuit, but I really believe you are shooting yourself in the foot with all of these front end opamps. What happens when a 35-70V inductive spike hits the opamp? My only advice is to keep your circuits as simple as possible, and if you don't absolutely need it, don't put it in! Extra components, especially active ones, cause your reliability to decrease. It sounds like you want a robust circuit that will be around for a while. Why would you want to jeopordize it with extra components?

Also, the low value resistors probably are a very good idea for the simple fact that they will offer no current protection.

Good luck and keep us posted.
 
melone:

Dang it, you keep making me THINK. It hurts :)

If it's something simple to do, like 1% components and a slight moving around of connections, to gain accuracy, then why not ? Heh, thanks for the kudos on effort.

My basic idea is to keep things isolated. It's a lot cheaper to replace a $0.86 opamp chip than a microcontroller if it does get hit with a huge inductive spike. Desoldering a 14-pin DIP (or pulling it from a socket) is way easier than desoldering a TQFP-64 micro ... By the way, what's a good way to protect against spikes like that ?

Given that the micro needs a 10k or less output impedance from the signal, how much current can we steal from a typical sensor signal to drive the ADC ? Would it affect the ECU ?

The analog interface is a daughterboard - one DB25 for input signals, and machine-pin sockets to plug into the mainboard. Aside from that, the board is completely replaceable with a new design, etc. How would you do that part of it ? Accuracy and protection for the ECU and the datalogger being criteria ...

Dean.
 
After spending many weeks trying to guarentee signal intergrity while connecting additional &quot;things&quot; to my module, I have found that IC's tend to have input capacitances of around 10-30pF. Hopefully, this will not hurt your ECU from operating properly, but I can definitely say from experience, that if your signals operate faster than 1 MHz, your will start severly modifying your signals.

You are right, replacing a 14 pin IC is much simplier than replacing a micro, but a resistor is even easier! If you are concerned about inductive signals, place good capacitors (0.10u & 0.010u ceramic), a pull-down (10K) to disapate energy, and clampling zener with a resistor in the base.

Good Luck and keep us posted!
 
melone:

Well, you know the basics of what we're trying to do here. Simple datalogger, pulling most but not all, the signals from the sensors lines going to/from the factory ECU. Some will be from other systems, either factory or aftermarket. Things we want to monitor include :

rpm
speed
throttle position
boost pressure
intake air temp
intercooler outlet temp
under-hood temp
inline and lateral G's (ADXL202 G-sensor)
fuel pressure
fuel pump high/low pressure switch
timing advance/retard
knock sensor (on/off probably)
MAF signal
modified MAF signal (from fuel computer if there)
ECU A/F ratio
injector duty cycle
front O2 sensor
rear O2 sensor
wideband O2 sensor (if there)
exhaust temp
wheelspin indicator

Maybe more :)

I don't believe any of the signals will be high high freq ones. From the manuals, it appears that there are several variations on the signals.

* 0-5V or some subset within
* 0-14V or some subset within, EG. 9-14V
* 0-5V pulse train
* 0-14V pulse train (actually one was spec'd at 7-14V pulse I think)

Although they're all important signals, probably the two critical ones are the MAF and boost-pressure inputs. Hmm, injector duty output is probably another ... Screw those up and things melt/break/do-bad-things. I've seen the results of a bad injector lead causing the injector to intermittently run low, producing a very lean condition in one cylinder. Blew the piston, rod and one of the exhaust valves - ugly. Hence my paranoia about modifying the signal in the act of measuring it.

Given that, and the 10k max input impedance to the A/D section of the micro, how would you design the analog input to the A/D ?

This isn't for a million unit production run, so pennies don't count. This is for us Supra geeks primarily, and others afterwards. There appears to be enough interest to warrant looking into a potential production run, but the numbers will probably be just too low that the setup/tooling will just be too dang $$$. So either we build them, or perhaps a kit.

Heh, then again, who knows. It may be the next Elmo, though I kind of doubt it :)

Dean.
 
Your idea of using a front-end op-amp will work, but it will be more complicated than it needs to be. I am just trying to make the circuit simple, robust, and cheap.

BTW, your knock sensor, should be going at a very high frequency and the data integrity is very important. I can tell you the on Ford products, the Knock Sensor is differential.

How do you plan on acquiring these sigals? Obviously your ECU takes in these values, are you just going to poll the ECU micro?

Good luck and keep us posted!!!
 
The complexity is a balance against paranoia :) Since the analog interface is a daughterboard, I have flexibility to make it anything I want, from a simple resistor voltage divider all the way to a programmable gain and offset buffering opamp setup.

For these first couple of prototypes I'm going to try the simpler ones, just plain divider, and basic opamp buffered. Anything built after prototype will be a single board setup with as much SMD as I can. Right now a lot of stuff is thru-hole just to ease construction.

Toyota has two knock sensor inputs. The signal format appears to be a deep dark secret - no-one seems to know it, or they aren't telling. In the service manual, the sensors appear as a resistive element, one side to GND, the other to the ECU. In the ECU, the interface symbol is an RC filter - one capacitor and one resistor coming off the signal input.

The other side of those components isn't marked, but it isn't GND. Other sensor inputs use other symbols, NPN transistor and resistor with emitter to GND, or two resistors, one to GND, one just hanging, etc.

Heh, that's part of what we might find here, what the knock signals might look like. Initially, I would think just noting presense or not would be a good start.

The ECU doesn't provide any output for collection at all. Not mine (94, pre OBD-II) nor my buddy's 97 OBD-II. Well, OBD-II does provide output, but not nearly fast enough for tuning purposes. So we will be tapping right into the sensor lines as they feed into the ECU. We could use a Fields harness which provides a 6&quot; wire loom to go inline with the connectors to the ECU, but that's $175 ... Just for the blasted two connectors and LOTS of bits of 6&quot; wire ...

There's some of the paranoia - we're stealing the signals right from the ECU's mouth. Move along there, nothing to see, nobody here but us electrons, nothing to see.

The 3 temp sensors are all on their own. Simple 2n3904 transitors as the remote element at the end of shielded twisted pair.

Having the analog interface off the main board will also allow a higher resolution set of off-chip A/D chips to be used too.

Hmm, here's a question. How important do you think it will be for this to live in a die-cast aluminum box ? Or, how bad will living in a plastic box be ?

It's interesting to see you (melone) and buzz41 with the two different philosophies for this. I don't think either is wrong - both are right. I very much appreciate the time and attention you guys have all given here. This is the best way to learn, listening to you all help solve problems.

Dean.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor