Connect with us

differential input buffer for PIC

Discussion in 'General Electronics Discussion' started by neilw, Oct 26, 2012.

  1. neilw

    neilw

    15
    0
    Oct 26, 2012
    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.
     
  2. CDRIVE

    CDRIVE Hauling 10' pipe on a Trek Shift3

    4,960
    648
    May 8, 2012
    Have you considered an OptoIsolator?

    Chris
     
  3. CocaCola

    CocaCola

    3,635
    4
    Apr 7, 2012
    Why aren't the grounds the same? And why can't they be the same?
     
  4. Harald Kapp

    Harald Kapp Moderator Moderator

    9,129
    1,842
    Nov 17, 2011
    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
     
  5. neilw

    neilw

    15
    0
    Oct 26, 2012
    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?
     
  6. Harald Kapp

    Harald Kapp Moderator Moderator

    9,129
    1,842
    Nov 17, 2011
    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
     
  7. neilw

    neilw

    15
    0
    Oct 26, 2012
    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 :(
     

    Attached Files:

  8. CocaCola

    CocaCola

    3,635
    4
    Apr 7, 2012
    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...
     
  9. neilw

    neilw

    15
    0
    Oct 26, 2012
    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...
     
  10. Harald Kapp

    Harald Kapp Moderator Moderator

    9,129
    1,842
    Nov 17, 2011
    Your diagram looks o.k. A low pass filter at the input definitely won't hurt.
     
  11. neilw

    neilw

    15
    0
    Oct 26, 2012
    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?
     
  12. (*steve*)

    (*steve*) ¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd Moderator

    25,174
    2,689
    Jan 21, 2010
    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.
     
  13. Harald Kapp

    Harald Kapp Moderator Moderator

    9,129
    1,842
    Nov 17, 2011
    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.
     
  14. neilw

    neilw

    15
    0
    Oct 26, 2012
    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 :)
     
Ask a Question
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.
Electronics Point Logo
Continue to site
Quote of the day

-