Go Down

Topic: Mutliplexing sensors into single Analog pin (Read 622 times) previous topic - next topic

Rocky_arduino

Hello!
I've made a circuit to multiplex stain gage signals into a single analog pin on a Teensy 3.6

All the channels multiplex correctly.  The multiplexer feeds into an instrumentation amplifier.  When reading from a channel every 5ms, it works great!

woo!

However, I may have had an oversight in the design.  I was hoping to multiplex through these strain gages VERY quickly.  Let's say for example, 10 strain gages at 1000hz. 

The problem I am running into is that if I change channels too fast (~faster than 5ms per channel), then the values become the same, or at least start to meld into each other. 

Is there anything I can do about this?  Or is my only alternative to use an external ADC, possibly multiple ADC's to capture everything I want at a fast enough rate..?
It honestly might require a large re-design, but I was just wondering if I am correct in assuming that there's nothing more I can do about the fact that I am saturating the analog pin by trying to read too many different signals, all on the same pin, too fast.

If you need more information, I am happy to provide!

Grumpy_Mike

Quote
I've made a circuit to multiplex stain gage signals into a single analog pin
So how about sharing it with us?

Quote
The problem I am running into is that if I change channels too fast (~faster than 5ms per channel), then the values become the same, or at least start to meld into each other.
That is because the sample and hold capacitor is not getting enough time to charge up fully.
Solutions are:-
1) Reduce the impedance of the signal by using an amplifier before the multiplexer. That will mean an amplifier on each sensor.
2) Take two readings of each gauge but only use the second one.
3) Take two readings of each gauge with a delay between them and only use the second one.

 

Rocky_arduino

#2
May 31, 2019, 07:20 pm Last Edit: May 31, 2019, 07:29 pm by Rocky_arduino
Hey Grumpy Mike,
Here's an image of the circuit


Ignore the V_ref voltage divider, it's actually connected to ground but I was just playing with things. (which is a whole other problem/topic in itself.  It really would be better off as a dual supply)

I agree with your solutions.  I've tried #2 and that did help me go from 10ms down to 5ms or 4ms.  I'll try #3 next to at least improve things a little bit more.

It does seem that in the end I will need to go with solution #1.

And that's okay!  This project has been a good learning experience so far.  Thank you for the guidance!


Grumpy_Mike

Thanks for posting that. The thing I don't understand is why the output of the amplifier goes through an 8 way switch and then it appears to loop back round the the beginning of the multiplexer.

Or if In_1 is a different pin to in_1, then why is the switch there in the first place?

Rocky_arduino

#4
Jun 03, 2019, 07:32 pm Last Edit: Jun 06, 2019, 09:22 pm by Rocky_arduino
In hindsight, I don't know why I chose those net-names for the 8-way switch.  It's pretty confusing.  Nonetheless, there are 3 different 'in_#''s.

In_1-
In_1+
IN_1

The first two represent input-channel_1-positive, and negative.
The IN_1 represents the input to different analog pins.  If anything it should be called OUT_1

The reason is that this is supposed to be a "shield" of sorts that can read 16 inputs/16 strain gages.
Then you could stack another shield on top, and read an additional 16 strain gages.
Each shield feeds into a separate analog pin by changing which switch is ON.

If you're curious,
Quote
for (int i=1; i<=shields; i++){
    Serial.println(shieldStrings[i-1]);
    for (int j=1; j<=channels; j++){
      // set the channel to read the signal from
      setChannel(j);
      int value = analogRead(shieldBuffer[i-1]);
      delay(4);
      value = analogRead(shieldBuffer[i-1]);
      Serial.print(value); Serial.print(" ");
    }
    Serial.println();   
  }
}
Basically,
For every shield
->For every channel
-->analogRead();

That cuts my sample rate down by /128 if I set the variables to 8 shields and 16 channels.
Given the speeds of the Teensy 3.6 sample rates, I should potentially be able to hit the ball-park of my sample speed goal but I think I'm hosed by not having dedicated amplifiers for every channel.
Reading 1 single channel works great and I can get over 100kHz beautifully, but once I try reading 2 channels, anything about ~250Hz introduces so much cross-talk that they meld together entirely.
If that's the correct way to use that term in this case.

edit: Technically I can't read a single channel at 100kHz truthfully to what is happening in the real-world based on my next post in this thread

Grumpy_Mike

Are the unused channels grounded? I find that helps reduce cross talk.

Rocky_arduino

#6
Jun 06, 2019, 08:01 pm Last Edit: Jun 06, 2019, 08:12 pm by Rocky_arduino
In case anyone stumbles into this thread in the future...

In the end I decided that the input impedance wasn't too high for the speeds I was after (however, it would be smart to buffer the input anyway). Based on T=RC calculations.
The problem was in my instrumentation amplifier.  It had a settle time in the 1's of milliseconds.  This was something I was unaware of.  The fix is to get a high-speed instrumentation amplifier.  For example, the INA110 that has a FET input and settle times in the 1's of microseconds.

good luck!

Grumpy_Mike

#7
Jun 06, 2019, 08:35 pm Last Edit: Jun 06, 2019, 08:35 pm by Grumpy_Mike
Thanks for wrapping that up. I wish others did this more. Have a Karma point.  :)  

Go Up