Go Down

Topic: DC Signal Offset When Connecting to Arduino Analog Input Pin (Read 1 time) previous topic - next topic

jlake0589

Hello,

I am using an Arduino to take measurements of an amplified signal from a pressure transducer.

I've attached a picture with my circuit schematic. I'm using an instrumentation amplifier set with a gain of roughly 600 (Texas Instruments INA122P) to amplify the signal to a level that the Arduino can handle (somewhere between 1 and 4 V for my ranges of pressure measurements).

When taking measurements with a multimeter (before connecting the output of the amplifier to the Arduino analog input pin), the sensor behaves well and the outputs are in line with the input pressure.

However, I am seeing some strange behavior in my circuit when I attach the output from the amplifier to the Arduino analog input pin, causing a large voltage offset to show up there. I am wondering whether there needs to be some sort of buffer added to isolate the circuits, or if there is something more fundamental that is causing my circuit to not work correctly.

Is there a better way to connect the amplified signal to analog pins to avoid any sorts of these offsets?

In case it helps, here is the code I'm using to read analog pin A0 every second and print to my computer.

Code: [Select]
#include "Timer.h"

Timer t;

void setup()
{
  Serial.begin(9600);
  t.every(1000, takeReading);
}

void loop()
{
  t.update();
}

void takeReading()
{
  String SensorSignal = String(analogRead(0)*5.0/1024.0);
  String MillisTime = String(millis());
  String Output = String(SensorSignal + ", " + MillisTime);
  Serial.println(Output);
}


Any advice or comments are greatly appreciated!

Thanks,
Jack


HarryDay

One thing I notice from your schematic is that the Instrumentation Amplifier has an output range of 0...10V, whereas the analog inputs on the Arduino expect NO MORE than 0...5V, EVER. 

So, maybe, just a simple resistor divider to half the value might do the job. Or try playing with a 10k potmeter between amp out and analog in.

MarkT

Sounds like you fried the A0 input completely, and now it doesn't work.  Add a 10k series resistor and
try A1??
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dlloyd

With a gain of 600, the circuit will be very sensitive to load. A0 adds a "spike" in loading when a sample is taken. A 10K series resistor is a great idea. Also try adding a 0.1µF cap from A0 to GND and take double readings so that the first reading (which could be invalid) is overwritten.

MarkT

With a gain of 600, the circuit will be very sensitive to load. A0 adds a "spike" in loading when a sample is taken. A 10K series resistor is a great idea. Also try adding a 0.1µF cap from A0 to GND and take double readings so that the first reading (which could be invalid) is overwritten.
No, this is a faulty analysis.  The amplifier has a very low output impedance even at a gain of 600, since
the open-loop gain is far far more than that, and will not notice the tiny
capacitive load caused by changing the analog multiplexer setting at all.  No need for any duplicate
readings in this circumstance (other than for noise averaging).

You very definitely do need to protect the pin from damage from the 10V output of the amplifier, that's
likely to fry the analog pin very fast.

The capacitor is a good idea as it will do a lot of noise-filtering for you.

I note the datasheet shows it has much less current sourcing ability than sinking ability, so using a
voltage divider to bring 10V output down to 5V isn't as trivial as you might think, and its losing gain
anyway.

Just have a 10k resistor in series with the output to protect the Arduino, and some capacitance on the
analog pin for low pass filtering.
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]

dlloyd

Uhm ... faulty wording. Should be "with this amplifier".

I don't believe it has low output impedance.



The 3mA stated for source current is for a complete short circuit.
The capacitive load drive is only 1nF.

HarryDay

1. The TI has an output voltage swing of 0..10V in your schematic.

2. The Arduino ADC requires 0..5V on the input.

3. The TI amp can easily drive a 10k load, from the specs.

4. The input impedance of the ADC is 100M or so. Found that buried somewhere in the datasheet (see url below - look for Analog Input Resistance).

5. Atmel suggests the ADC be driven with an impedance <10k for optimum performance. No resistors for protection are required, as far as I can see.

Given points 1 and 2, you absolutely must add a level shifter. I'd say a voltage divider made up of two 10k resistors would get the job done nicely. If you want to stick a capacitor across the ADC input, fine, but I'd be happy to try without. A cap there may have a noticeable effect on ADC conversion time.

Final note: use shielded instrumentation cable between the TI and the Arduino, just to keep the noise out.

One more final note: Let's hope you didn't blow the ADC input!

Link to datasheet: http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf

dlloyd

Figure 23-8 on page 212 shows ADC input impedance varies from 1K to 100K and has 14pF load connected to 2.5V (in this case). The TI amp can easily sink a 10k load, but is quite weak in sourcing a load. Its like an open drain output with 1.667K pullup. Yes, this is within 10K as recommended by Atmel.

Might need to use a lower R value divider to keep within the 10K spec, but its more important to protect the input from overvoltage. I think the internal protection would have saved the A0 input, but we haven't heard from the OP.

HarryDay

I've seen that picture and I have a different take on it

The input impedance 1...100k shown in it is a preferred output impedance of whatever is driving the input.  The ADC input itself is 100M.  The 14pF (S/H stands for sample/hold, which makes it internal to the ADC) you see is actually the input capacitance of the ADC itself.

The input impedance "requirement" or "preference" has to do with input settling times to get ADC going. The higher, the longer conversion takes. 10k or less is recommended.

"The ADC is optimized for analog signals with an output impedance of approximately 10 k or less." That's what it says, just above that picture.

My suggestion of 2*10k as a voltage divider will do the job. In addition it will prevent overvoltage being applied to the ADC inputs.

I haven't read anything about internal protection against overloading the AGC input, but it might be there.

jlake0589

Hi Everyone,

Thank you all for your awesome advice. The community here is really amazing. I've attached an updated schematic which I think makes the updates you all suggested (I highlighted what I added in yellow).

Please let me know if I'm misunderstanding anything though.

To your points:

One thing I notice from your schematic is that the Instrumentation Amplifier has an output range of 0...10V, whereas the analog inputs on the Arduino expect NO MORE than 0...5V, EVER. 
@HarryDay, thanks for the reply! I did not even think of being >5V as a problem. I've probably had up to 8V being output while testing it, so it likely damaged the input. I can try another input pin as @MartT suggested, or I can try another Arduino to make sure that damaged components is not the issue.

A 10K series resistor is a great idea. Also try adding a 0.1µF cap from A0 to GND and take double readings so that the first reading (which could be invalid) is overwritten.
@dlloyd, thanks for the advice for adding the cap. I'll do that for sure.

Sounds like you fried the A0 input completely, and now it doesn't work.  Add a 10k series resistor and
try A1??
@MarkT, thank you for the advice! I'll check using pin A1 (or maybe a different Arduino) after adding the 10K resistor you suggested above as well and see if the readings are more stable.

My goal is to measure the output voltage from the amplifier. So in this setup attached, I would just need to double the voltage reading on the Arduino's analog pin to get a good approximation of that level?

Thanks to you all for the help,
Jack

HarryDay

By putting the 1uF cap there you have effectively added a lo-pass filter with a bandwidth of around 30Hz.

Is that really what you want?

jlake0589

@HarryDay, thanks for the note. I actually only have 1 uF capacitors (or larger) available currently, so that is what I have to work with for the time being.

I'm not very familiar with setting these sorts of systems up, but do you think including that will have negative effects for measuring DC signal? I'm only concerned with a DC input at the moment. Let me know if you think a different value would be better to avoid issues.

I will try this setup out tonight and let you know how it works out.

Thanks!
Jack

HarryDay

I would advise you don't add complexity (i.e. components) unless you really need them.

Just start with the voltage divider of 2 x 10k. Then increase your sampling rate to, say, 100 times per sec (10ms) and look at the output in Arduino IDE Scope (Ctrl-SHift-L). How? You should either know or figure it out from the examples.

If results are not too noisy, leave it at that. If they are, add a cap (not an electrolyte) of 100nF, just to start with.

If results are still too noisy you need to consider the quality of your wiring and ground.

Of course the first place to look for noise would be your setup with the TI amp.

It is also really easy to add a noise filter in software, btw.

jlake0589

Hi all, so I got around to trying the updated setup with a new Arduino board and it solved my problem. This was definitely due to damaging the analog input pin on the original Arduino when it was not protected.

Thanks again for your the help.

HarryDay

Good!

Did you try any of the other analog inputs? Did they all die?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy