noise on A0 when using audio shield

Status
Not open for further replies.

emmanuel63

Well-known member
Hello,

I notice a strange problem.
I have attached a pot to A0. When reading my pot output value, I have noticed there is a lot of noise (+/- 10). When my pot is connected on other analog inputs, I have no noise (I mean no more than +/-1). This happens only when audio shield is active. When it is disable, the is no noise.
Emmanuel

noise on A0 :
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

//// GUItool: begin automatically generated code
AudioSynthWaveform       waveform1;      //xy=434,340
AudioOutputI2S           i2s1;           //xy=699.1111450195312,337.888916015625
AudioConnection          patchCord1(waveform1, 0, i2s1, 0);
AudioControlSGTL5000     sgtl5000_1;     //xy=159.04762649536133,90.31746006011963
//// GUItool: end automatically generated code


void setup() {
  sgtl5000_1.enable(); 
  sgtl5000_1.volume(0.2);  
  AudioMemory(8);          
}


void loop() {
  int pot0 = analogRead(A0);
  Serial.println(pot0);
  delay(5);
}

no noise on A0
Code:
//#include <Audio.h>
//#include <Wire.h>
//#include <SPI.h>
//#include <SD.h>
//#include <SerialFlash.h>
//
////// GUItool: begin automatically generated code
//AudioSynthWaveform       waveform1;      //xy=434,340
//AudioOutputI2S           i2s1;           //xy=699.1111450195312,337.888916015625
//AudioConnection          patchCord1(waveform1, 0, i2s1, 0);
//AudioControlSGTL5000     sgtl5000_1;     //xy=159.04762649536133,90.31746006011963
////// GUItool: end automatically generated code


void setup() {
//  sgtl5000_1.enable(); 
//  sgtl5000_1.volume(0.2);  
//  AudioMemory(8);          
}


void loop() {
  int pot0 = analogRead(A0);
  Serial.println(pot0);
  delay(5);
}
 
Hello Emmanuel,
on which Teensy Model does this happen? Teensy 4?
And which Teensyduino version are you using?
 
Last edited:
Hello,

Sorry I omitted these informations.
I did this test on Teensy 3.5. I use teensyduino 1.54 beta 5.

I noticed that in general that enabling the audio shield tends to add some noise on the power supply. The 0V and 3.3V flickers when audio shield is enable. Same remark for the analog inputs : enabling the audio shield adds some noise when reading analog values. I have the same issue when powering teensy from batteries. It is not very bad though...
 
I tried this on a T3.5, but without the audio shield connected.
The noise is subjectively the same in this case. So it might actually be the hardware - and not a software bug in a lib, as I first thought (but I do not definitively rule it out yet).


You can try adding a 100nF capacitor and / or a lower resistance potentiometer.
 
The Rev C audio shield transmits I2S data on pin 13, which is right next to pin A0/14. Maybe the digital rising/falling edges are coupling? Using a lower resistance pot and capacitor should help. If you're not going to use the audio shield for an input signal, you might also try cutting off pin 13.
 
Thank you for you suggestions.

Yes I think pin 13 and A0 /14 are coupling.
I am going to cut pin 13 and see.
 
What i usually do for clean pot readings is:
1. Proper supply decoupling. All pots and AVREF are decoupled with an LC filter 10uH + 1u.
2. 100n filter caps placed close to the analog inputs for each pot wiper.
3. Increase AnalogAveraging param, but at the cost of response time.
4. Use extra software filtering, simple lowpass filter or a dedicated library as the https://github.com/dxinteractive/ResponsiveAnalogRead.
 
Hello,

I have done more testing about analog inputs noise issue.
First of all, filtering with caps + code solve the problem. But still, I would really like to know what's going wrong when audio shield is hooked.

To summarize :
- no noise on analog inputs when audio shield is either physically disconnected or disable in Setup.
- noise on some analog inputs (not all) when audio shield is hooked and enable in Setup. A0 and A10 especially get very noisy when doing simple pot readings.

I could repeat this behaviour on the 3 T3.6 I have. I try different power source (including batteries) with no success.

Emmanuel
 
Impedance matters. The lower the resistor value, the less susceptible to interference. A capacitor gives low impedance, but only at high frequencies. Just looked over this thread again and still didn't see what value pot was actually used. Was that ever mentioned?
 
Status
Not open for further replies.
Back
Top