Instrumentation amplifier trouble

I've been trying to interface with the MPX12GP pressure transducer (http://www.digikey.com/product-detail/en/MPX12GP/MPX12GP-ND/951783) to use it as a sort of breath controller. I found out that I needed to use an instrumentation amp to connect to the sensor's V+ and V- output pins in order to read it with an Arduino.

I've successfully used the following DIP instrumentation amp with good results on breadboard: http://www.digikey.com/product-detail/en/INA122PA/INA122PA-ND/300981

However, I am now trying to use the following SMD instrumentation amp and I am only reading a single value (~250) when I read it's output with an Arduino analog pin: http://www.digikey.com/product-detail/en/AD8223ARMZ-R7/AD8223ARMZ-R7CT-ND/1979416

I have quadruple checked my gain resistor calculations to make absolutely sure that both instrumentation amps are set to use the same gain, but the SMD package is just not working.

Can someone please help me determine if I am interfacing with the SMD instrumentation amp correctly, or if maybe the chip is busted somehow? I've attached a schematic for the board I am trying to troubleshoot.

Hello,

you can connect a voltmeter to the output of the amplifier. The value should be according to what your arduino reads. This helps you find software errors :astonished:
You tied the REF pin to GND. So with no differential signal on the inputs your output should be near 0V (in theory). Thus, your output can swing only in one direction. Check the polarity of the input sgnal. Check in the datasheet of the opamp if GND for REF is allowed. When you connect the input pins then your output should be the same as the voltage on the REF pin. When you have a high gain then you amplify also the offset from the input if you have some.

Just some hints, hope this helps

Elektrix

Is this for composing music? There is a reasonably affordable product for this

Just connected a voltmeter to the output of the AD8223, and I'm getting a constant 3.7V with no change when I blow on the sensor.

I can take the same sensor and put it on my breadboard circuit and get a result.

On my breadboard (using DIP INA122), when I have the REF pin floating my Arduino reads a constant value of ~1100 that doesn't change when I use the sensor. When I connect the REF pin to GND, the readings drop down to ~420 and respond very well to both sips and puffs (positive and negative pressure on the sensor).

I'm somewhat confused about what is accounting for such wildly different behavior between these two instrumentation amps.

@ricky7: not specifically. I'm using it as a "sip and puff" interface for asssitive tech contexts. 100 Euros is not really affordable, and that device isn't open source :wink:

Hello zenwebb,

when you look at the datasheets of both opamps you can see that the calculation of the gain resistor is different but I don't think this matters a lot. What I think could be more important is in the datasheet of the AD8223 on page 14: Input voltage range. When your output voltage doesn't change it is likely that the opamp runs to one of the limits internally.

Just a question (as I am not a native english speaker): What comes after quadruple? :cold_sweat: I know double, triple and quadruple...

zenwebb:
I have quadruple checked

Best regards

Elektrix

I have made sure to use different gain resistors to achieve the same gain in both circuits, so no worries there.

The MPX12GP's output has a voltage span of 70mV maximum, but there is a voltage offset on both the - and + outputs of about 2.5V.

I see that the INA122 (DIP package) has a maximum CMRR voltage span of 3.4V (pg. 2), whereas the AD8223 (SMD package) has a maximum CMRR range of only 1.5V (pg. 6). I guess that explains what is going on!

Can someone explain exactly what "CMRR voltage span" means? Is it the maximum absolute value that either the - or + input pins can be, or the maximum algebraic difference between the two pins?

Just a question (as I am not a native english speaker): What comes after quadruple? I know double, triple and quadruple...

Quintuple (5), sextuple (6) and more: Tuple - Wikipedia. Though I'll warn you, in normal conversational speech anything beyond "triple" or "quadruple" is kind of funny to hear. Just say "checked X times" :stuck_out_tongue:

zenwebb:
Can someone explain exactly what "CMRR voltage span" means?

No, I don't. I only know CMRR as a ratio as described in Wikipedia: Common-mode rejection ratio - Wikipedia

zenwebb:
Though I'll warn you, in normal conversational speech anything beyond "triple" or "quadruple" is kind of funny to hear. Just say "checked X times" :stuck_out_tongue:

That's what I thought. Thanks a lot.

Elektrix

If that's a standard resistive bridge device, then the common mode voltage at the amplifier inputs will be half the supply voltage. As you are feeding it with +5V, this will be 2.5V. You can check this by measuring the voltage at the amplifier inputs with a multimeter.

According to the datasheet, the common mode input range of the AD8223 depends on supply voltage and gain (higher gain = lower common mode input voltage). The graphs suggest that with gain = 100 and a single 5V supply, the common mode input voltage limit is more than 3V. So it ought to be OK in your circuit, since gain < 100 @ Rg = 1.3K.

The best suggestions I can make are:

  • Try with lower gain (higher Rg);
  • Try reducing the voltage to the sensor, e.g. use the Arduino 3.3V supply; or just connect a 330 or 470 ohm resistor between the +5V supply and the sensor +ve supply pin;
  • Use the SMD version of the INA122 instead, it's more suitable for that sort of application.

So...it IS supposed to work. You're right, the AD8223 datasheet states that the CMRR input voltage range can be a maximum of (+VS) ?
1.5. Which, for 5V supply should be 3.5V. So why doesn't it work?

I am not technically using an Arduino, but rather an ATMega32u4 running on USB power (5V) - see OP for schematic. It's an integrated board, so I can't easily add a resistor to the power line to the instrumentation amp.

How do you know that the SMD INA122 is more suitable? The AD8223 datasheet says it is good for "Transducer interface", which I thought my sensor was.

The SMD version of the INA122 is pretty expensive, but they do offer a similar instrumentation amp called the INA331 that is much less expensive. Is this suitable? http://www.digikey.com/product-detail/en/INA331IDGKT/296-12203-1-ND/413490

I've found at least three different instrumentation amps in the same family, but I can't figure out the difference between them all (aside from price):

INA122UA ($6.64): http://www.digikey.com/product-detail/en/INA122UA/INA122UA-ND/300982
INA322EA ($3.16): http://www.digikey.com/product-detail/en/INA322EA%2F250/INA322EACT-ND/362229
INA331 ($2.73): http://www.digikey.com/product-detail/en/INA331IDGKT/296-12203-1-ND/413490

Can someone help me identify what is different about these? I see they have slightly different bandwidths, but I don't understand why the price swings so much.

zenwebb:
So...it IS supposed to work. You're right, the AD8223 datasheet states that the CMRR input voltage range can be a maximum of (+VS) ?
1.5. Which, for 5V supply should be 3.5V. So why doesn't it work?

Some suggestions:

  1. Measure the difference in voltage between the two inputs of the amplifier, and multiply by the gain to get the expected output. Does that tally with the actual output?

  2. Try shorting the amplifier inputs together, to see if the output voltage drops to near zero.

  3. Check with a multimeter that you really do have 0V on the ground and REF pins of the amplifier.

  4. Are you certain that your gain set resistor really is 1.3K, not something lower? If it's a standard SMD chip resistor, it should be marked 132. Are you sure it isn't shorted out? Try removing it, that should set the gain to 5.

  5. Maybe you just have a faulty amplifier, or it was damaged during soldering.

zenwebb:
I am not technically using an Arduino, but rather an ATMega32u4 running on USB power (5V) - see OP for schematic. It's an integrated board, so I can't easily add a resistor to the power line to the instrumentation amp.

That's not what I meant, I meant add a resistor in series with the power feed to the transducer, to reduce the common mode voltage. But a common mode voltage of 2.5V should not be a problem for that amplifier anyway.

zenwebb:
How do you know that the SMD INA122 is more suitable? The AD8223 datasheet says it is good for "Transducer interface", which I thought my sensor was.

My comment was based on the design of the AD8223 having an extra PNP input stage so that it can cope with negative inputs. You don't need that in your application, and the PNP input stage reduces the upper limit of the common mode input voltage range. However, the AD8223 should still be suitable, because its common mode input voltage range goes high enough.

zenwebb:
The SMD version of the INA122 is pretty expensive, but they do offer a similar instrumentation amp called the INA331 that is much less expensive. Is this suitable? http://www.digikey.com/product-detail/en/INA331IDGKT/296-12203-1-ND/413490

The INA331 looks suitable to me, although it needs 2 resistors to set the gain rather than just 1.

The plot thickens. After trying your suggestions I am thinking that my AD8223 is bad.

  1. I don't have a voltmeter that is capable of measuring more than one decimal place (no oscope either).

  2. When I short the amplifier inputs together I get no change in the output.

  3. I am able to measure 0V at both the GND and REF pins of the amplifier.

  4. Yep, the resistor is marked 132 and measures ~1.3K on my multimeter. With AND without the resistor in place I read about 160-170, and that doesn't change when I mess with the sensor (even remove it entirely).

  5. Starting to look that way.

While removing the 1.3k resistor from the board to test out your idea I destroyed one of the pads, so there's no going back.

Now I need to decide whether I should assemble another prototype with the AD8223, or redesign the board for the INA331 and order new boards.

I have an electric hot plate - can I retrieve the ATMEGA32u4 easily by heating the board up until the solder is shiny and picking up the chip for the next prototype? Or is it too easy to damage it?

I've attached the PCB design I came up with for the AD8223, in case there is any glaring problems I overlooked.

Does your PCB have a top-layer ground fill that isn't shown? Pins 4 and 5 of the AD8223 don't appear to be connected to anything, along with one side of your decoupling capacitors and the ground pin of the ICSP header. Also one of the pins of the ICSP header appears to be mislaigned.

You can try recovering the atmega32u4, however heating up again twice more might damage it, in which case on your next board you will waste the instrumentation amplifier.

How come you are reading 160-170, when you previously measured the amplifier output at 3.7V? Those figures don't match. Are you certain you are reading the correct analog input in your code? Are you certain that the analog input pin of the 32u4 is connected to the amplifier output?

I recommend that you get yourself a good DMM that can measure small voltages with more precision.

Yes, ground fill on both top and bottom layers.

ICSP header has offset to allow chip to be programmed without having to solder headers in place. It is included in Sparkfun and Adafruit's Eagle libraries.

The instrumentation amp's output is connected to pin PF0 (ADC0), which is analog pin 5 according to this pin out: http://arduino.cc/en/Hacking/PinMapping32u4

And this is the code I was using to read the sensor:

int vals[10];

void setup() {
  pinMode(5, INPUT);
  Serial.begin(9600);
}

void loop() {
  for(int i=0; i<10; i++) {
     int val = analogRead(5);    
     vals[i] = val;
  }
  
  int val;
  for(int i=0; i<10; i++) {
     val += vals[i];
  }
  
  val = val/10;

  Serial.println(val);

}

Want to donate a good DMM to me? :smiley: I'm a student, can't afford to spend much money on equipment.

Your code is wrong, you need to initialize val to 0 like this:

  int val = 0;    // added the "= 0"
  for(int i=0; i<10; i++) {
     val += vals[i];
  }

After correcting your code, I suggest you measure the voltage on pin ADC0 of the chip with your multimeter, while simultaneously taking readings from the ADC. Then see whether the 2 readings agree.

Even a cheap DMM like this http://www.tandyonline.co.uk/digital-lcd-multimeter.html is better than nothing.

Well my board is totally busted now, I need to purchase all new components and assemble another prototype. Too many SMD pads have lifted off the board from too much soldering. I have one PCB left to experiment with.

If the last prototype still doesn't work, I may redesign the board to use the INA331 and order some more boards.

Code still worked - I commented out all of the buffering code and had it take a reading with analogRead and immediately output it to Serial, and got the same result. Variables don't actually have to be declared: http://www.arduino.cc/en/Reference/VariableDeclaration

I didn't say I didn't have a multimeter, I use an Extech 410. It just doesn't have more than one decimal place when measuring voltages ~5V.

zenwebb:
Code still worked - I commented out all of the buffering code and had it take a reading with analogRead and immediately output it to Serial, and got the same result. Variables don't actually have to be declared: http://www.arduino.cc/en/Reference/VariableDeclaration

That page is misleading. Whether "both are correct" depends on (a) whether the variable is being declared at file scope or in a local scope, and (b) whether you are going to use the variable before you assign it. When you declare a local variable and don't initialize it (as you have done) then it has an undefined value. Your code is definitely incorrect by not initializing that local variable. [Global variables get initialized by default, but local variables don't.]