Teensy LC analog pins crosstalk

Status
Not open for further replies.
Hi there,

I am working on a piezo/midi project with a Teensy LC. I use several analog inputs (all 12 on the LC). Everything is working fine, except that two inputs interfere with each other: A10 and A8. After looking all over for shorts in my input circuit, I noticed that the problem happens with the Teensy alone. Hooked a pot to pin A10 and read both pins. As expected I get some noise on pin A8 which is open, but it also follows the pot on pin A10 (please see attached video and code). Is my Teensy damaged or am I missing something? If this is capacitive coupling on the i/o, how do I fix it?

Thanks in advance. Any help will be much appreciated.

Code:
void setup()
{
  Serial.begin(115200);
}

void loop() 
{
  Serial.print("0 1023 ");
  int input10 = analogRead(A10);
  int input8 = analogRead(A8);
  Serial.print(input10);
  Serial.print(" ");
  Serial.println(input8);
}

 
Connect all your analog pins to a low impedance source - don't leave them floating.

Ok, yes, but this is not about floating. That's the whole point. In the original circuit all analog pins were connect to piezos through a diode protection circuit and a load to drive just like recommended here in the forum. And they all work, even these two pins, except that they are also reading eachother. The reason I was reading the disconnected pin is to show that it is doing something that is not random at all. It is shadowing the signal from a connected pin, at a voltage level that maintains the same offset from the original signal. And this happens when all pins are connected as well.

Here is another sample run with pin A8 pulled to ground with a 10K resistor.
It just does the same thing without the noise...

A8-pulled-down.jpg

 
Hi,

I am really sorry for that.
Just fixed it.
Should open directly now.

No problem at all & thanks !! I thought that if I took a look at the video, I might be able to add something constructive, but I'm coming up empty-handed at this point. On my latest TeensyMIDIPolySynth project where I read multiple pots, I was doing so thru 74HC4067 16:1 MUXs, so definitely not the same conditions as in your environment.

Mark J Culross
KD5RXT
 
10K isn't low impedance. But if 1K to ground and your simple program above doesn't cause an analog input to reliably read about zero, then I don't know.
 
is a8 a default analog in?

i have only used a10 and a11 TLC and have used this declaration:
const int readPin = A10;
const int readPin2 = A11;

and then this setup:
pinMode(A10, INPUT);
pinMode(A11, INPUT);
adc->adc0->setAveraging(1);
adc->adc0->setResolution(12);
adc->adc0->setConversionSpeed(ADC_CONVERSION_SPEED::VERY_HIGH_SPEED);
adc->adc0->setSamplingSpeed(ADC_SAMPLING_SPEED::VERY_HIGH_SPEED);

and then this code:
value1 = adc->analogRead(readPin);
value2 = adc->analogRead(readPin2);

i have never tested to see how much of that is needed and how much would just default to these
or similar values - nor have i ever used a8 - but i have tested for crosstalk on a10 and a11 and
with full scale on one the cross talk on the other is ALWAYS less than 1 lsb (with low source
impedance on both at all times)

you could try this code on a10 a11 and then on your two pins with low z on inputs and if still
crosstalk maybe one or both of your inputs has been damaged by esd ?

i had to change the syntax slightly when i moved up to td1.52 from 1.48,
adc->adc0->setResolution(12); used to be adc->setResolution(12,ADC_0); etc etc
because the library changed a little. (only the set lines changed)
 
Last edited:
10K isn't low impedance. But if 1K to ground and your simple program above doesn't cause an analog input to reliably read about zero, then I don't know.

Changed to 1K. Got similar result with less voltage on A8, but it still moves in synch with the pot on A10.
I also tried reading several other open pins. They all obviously get quite a bit of noise and are a little bit affected by the pot, but nothing like A8.

Guess I am going to try a new teensy and see if it works correctly.
 
I'm surprised to see it track a DC voltage like that but if there is no connection to A8 then even the tiniest parasitic current could charge the pin.

I suspect your original problem was in the wiring and not with the Teensy.

You cannot infer anything is wrong with pin A8 if you are reading it without a connection to anything.

(Anyone qualified able to confirm?)
 
I had a similar problem with an NXP LPC1754. The Teensy analog system is probably the same.
In between the analog MUX and the ADC is a sample and hold circuit. This circuit IS a capacitor. So each time you switch the MUX from on signal to another, then you couple the old level to the new signal. Over time the S/H will approach the new signal level, but theoretically never get there. The time required to charge is dependent on the driver impedance, so jonr is correct in recommending a low impedance driver.

Some other things that may help are:
1. Putting a capacitor from the input to ground. This will help supply the current surge during the sample period. Be aware this also acts as a low pass filter, so take it easy on the value.
2. Tie another analog input to a low impedance, constant voltage source such as ground. Read this source before each sample. This will ensure a consistent starting point in the S/H circuit.
3. Increase the S/H sample period. The more time it has to charge, the closer it will approach the actual input voltage.

I hope these suggestions help.
 
oddson - i agree

carlosemello - you used the word "piezo" - at a glance it might seem that you can just hook the output of a piezo
sensor (high C high Z) to a mux/atod but that is problematic for several reasons including those already mentioned
by Tommyburger and others. if your input sensors are truly piezo, i think you will be well served by a low parts count
(because you need so many) buffer or charge amplifier for each sensor. at some point it might be more practical to
go with a low Z sensor if such can be had - or are you speaking of a piezo microphone? some have a buffer built in.

did the new TLC do any better?
 
Last edited:
oddson - i agree

carlosemello - you used the word "piezo" - at a glance it might seem that you can just hook the output of a piezo
sensor (high C high Z) to a mux/atod but that is problematic for several reasons including those already mentioned
by Tommyburger and others. if your input sensors are truly piezo, i think you will be well served by a low parts count
(because you need so many) buffer or charge amplifier for each sensor. at some point it might be more practical to
go with a low Z sensor if such can be had - or are you speaking of a piezo microphone? some have a buffer built in.

did the new TLC do any better?

Thanks Everybody for your interest and responses.

Let me clarify the situation a little further:

My project is a percussion style keyboard (like a xylophone), so it is similar to a drum machine, except I want to be able to have a wide dynamic range, from very soft to very loud sounds, and I intend to play it with something like a very soft mallet because I am using very light wood plates over the piezos. My original problem was getting unwanted hits between pins A10 and A8. Whenever I hit A10 I got a hit in A8 as well, and vice-versa. What I find strange is that I only have this problem with these two pins. The other 10 pins work seamlessly and are hooked up exactly the same way.

DSC_0860_web.jpg

This is the circuit I am using on all TLC's 12 analog pins (14-25), with different resistor values.
The picture is not mine. Got it from another post in the Forum (couldn't find the link, sorry).
But my circuit is just like that on all 12 pins.

I only used the example with a single pot to show that the problem was occurring even outside of my circuit. With that setup, if I use the pot on A10 and read all the other open pins, I get the expected random output except from pin A8, which follows A10! How can that be? That's what is bugging me...
 
did the new TLC do any better?

Actually Yes. Just finished testing. I see no interference between any keys now, which is great! (guess my Teensy must have been defective after all). However I feel like I still need to learn a lot more be able to work with this.

One thing, for example, is not clear to me: The pinout charts for other Teensy cards show an AGND pin next to Vcc. The LC chart however shows only GND on that pin. Does that mean that the LC doesn't have a separate analog ground? I found a lot discussion about the AGND pin but nothing on the LC.

Thanks again for all your generous help!
 
Status
Not open for further replies.
Back
Top