Maker Pro
Maker Pro

differential input buffer for PIC

neilw

Oct 26, 2012
15
Joined
Oct 26, 2012
Messages
15
I have an automotive application using a PIC microcontroller, and need some suggestions regarding analogue inputs....

I need to measure the throttle position sensor voltage, but I can't connect the PIC ground to the engine ECU ground (they aren't the same). I need a unity gain differential input amp that can measure the voltage between the ECU signal and sensor ground pins, but the output must be relative to the PIC ground. The buffer must run from the same single-rail 5v supply as the PIC and have a rail to rail output.

Does anyone have any suggestions for a suitable chip, preferably one that is currently used in automotive applications.

TIA.
 

CDRIVE

Hauling 10' pipe on a Trek Shift3
May 8, 2012
4,960
Joined
May 8, 2012
Messages
4,960
Have you considered an OptoIsolator?

Chris
 

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Why aren't the grounds the same? And why can't they be the same?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Look for a rail-to-rail instrumentation amplifier like INA326, LT1789, AD623 or similar.
Consider connecting the different grounds by a resistor in the range 1 - 10 MegOhm. No OpAMp likes completely floating inputs.

Or use a linear optocoupler. A standard optocoupler will not be suitable.

Harald
 

neilw

Oct 26, 2012
15
Joined
Oct 26, 2012
Messages
15
Look for a rail-to-rail instrumentation amplifier like INA326, LT1789, AD623 or similar.
Consider connecting the different grounds by a resistor in the range 1 - 10 MegOhm. No OpAMp likes completely floating inputs.

Or use a linear optocoupler. A standard optocoupler will not be suitable.

Harald

Many thanks Harald, the AD623 looks the easiest to use, and appears to require no external components to provide a gain of 1. It looks like I can connect the ref pin to the PIC ground, but would you still recommend connecting the engine ECU signal ground to the PIC ground using a high value resistor?
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
I recommend to at least provide said resistor from ECU GND to PIC GND. You can always leave it out later if it causes trouble. But if you have not made a provision for this resistor, you'll have a hard time fixing it into your design at a later time.

Also a note on the inputs of the instrumentation amplifier: Provide a resistor from each input to PIC GND. You can use a rather high value here too. The input bias currents of the amplifier need a path to GND. Otherwise the floating inputs can easily reach the limit of the common mode range and the OpAmp will no longer work as expected. Here is an application note on that issue.

Harald
 

neilw

Oct 26, 2012
15
Joined
Oct 26, 2012
Messages
15
Am I over-simplifying things, or is this all I need? I don't need to measure the input voltage with any particular precision, but is it worth putting low-pass filters on the inputs?

This input is an addition to an existing PCB with a full ground plane. Up to now, I've been connecting the throttle position signal ground to my ground (battery ground) and some ECU's definitely don't like it, and ground loops are introducing errors into both devices :(
 

Attachments

  • differential_input.jpg
    differential_input.jpg
    52.9 KB · Views: 201

CocaCola

Apr 7, 2012
3,635
Joined
Apr 7, 2012
Messages
3,635
Up to now, I've been connecting the throttle position signal ground to my ground (battery ground) and some ECU's definitely don't like it, and ground loops are introducing errors into both devices :(

Is the throttle position sensor's ground isolated? Or is it common with the rest of the vehicle? If it's common with the rest of the vehicle as I suspect it is, just remote chassis ground your devices battery to make the grounds common, don't ground at the TPS itself or in the immediate vicinity where there is a higher chance of a ground loop... Since all components in the car share a common ground the ECU is designed to filter noise on the ground just like any car electronics since it's far from a perfect ground... The TPS is just a variable resistor, it's shouldn't be that hard to pull a reading off it...
 

neilw

Oct 26, 2012
15
Joined
Oct 26, 2012
Messages
15
Is the throttle position sensor's ground isolated? Or is it common with the rest of the vehicle?

It's most definitely not the same as battery/chassis ground - that's why I've been having problems. I've been connecting to numerous types of ECU, some OEM and some aftermarket. Most OEM and some aftermarket ECU's immediately throw up sensor errors if you connect their signal grounds to battery ground.

Other than for eliminating noise issues caused by high ground return currents from the ignition amps & injectors, I think they have isolated sensor grounds so that they have more robust error detection. I may be wrong, so I stand to be corrected...
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Your diagram looks o.k. A low pass filter at the input definitely won't hurt.
 

neilw

Oct 26, 2012
15
Joined
Oct 26, 2012
Messages
15
Well, I've now built and tested the circuit, and for the most part it works fine. However, there are a couple of strange things that I can't understand...

First of all, the AN623 is supposed to provide a rail to rail output, but the most I can get out of it is 4.85v with a 5v supply. Configured to provide a gain of 1, the output exactly tracks the differential input up to 4.85v, but thereafter the output is clipped at this level.

The second odd thing is what happens on the occasions when I don't require the differential input. Occasionally I will be measuring an input relative to PIC ground & 5v using a potentiometer. When I connect the -ve input of the amplifier to PIC ground and feed the potentiometer output into the +ve input, the output then clips at 4.3v despite there being a full 5v across the 2 inputs. Once again, the output tracks the input up to the point where it clips.

Am I missing something here?
 

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
Without looking at the datasheet (I am on a very slow connection) I would check to see if my load on the output was too large.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
Have a look at figure 20 of the datasheet. The output doesn't reach 5V.

Also table 8 on page 20 shows a max. output swing of +-2.4V for Vcc=5V (when Vref=2.5V is used). In your case Vref=0V, so the output swing is 0V...4.8V, exactly as you measured.

This is acommon issue with "rail-to-rail" amplifiers. Often this means only a voltage to within a few tens or hundreds millvolts of the supply voltage.

Another issue may be the load, as Steve noted. On page 19 under "output buffering" a minimum load of 10kOhm is stated, otherwise an additional buffer is recommended.
 

neilw

Oct 26, 2012
15
Joined
Oct 26, 2012
Messages
15
Thanks for the help guys - it didn't make it any easier that I had an incomplete datasheet that stopped at page 16!

Anyway, the solution was simple - I happen to have a 10v supply on the original PCB that I could use for the amp. Now I get the full 5v swing on the output, either with differential or single-ended input. However, one thing I had to do was put a capacitor across the differential inputs to stop noise when it was left open-circuit. It now works a treat :)
 
Top