Teensy 3.6 problem reading analog channels 14 to 17

Status
Not open for further replies.

George1

Active member
Hi,

I am developing an instrument and I need to read bunch of analog voltages and I plan to use Teeny 3.6. I need to read 16 analog voltages and I will be using analog channels 0-9 and 12-17. Channels 0-9 and 12-13 work fine but channels 13-17 just read 1-2 counts where they should be reading much higher (analog voltages are applied correctly so that should not be an issue. Simple sample code that illustrates the problem is below so please let me know where I am messing up.

Code:
int ADC_Ports[] = {13, 14, 15, 16, 15, 17};

void setup() {
  Serial.begin(9600);
  analogReadResolution(12);
  //analogReference(EXTERNAL);
  analogReference(DEFAULT);

}

void loop() {
    Serial.print("Start:");
  for (int i = 0; i < 6 ; i++) {

    Serial.print( analogRead(ADC_Ports[i]));
    Serial.print(",");
    delay(50);

  }
  Serial.println("End");

}
 
Use A13, A14, A15, etc. Or the actual pin numbers.

When you use higher than 13 with analogRead, it's ambiguous which pin you want. analogRead(14) actually reads pin 14, which as A1, or the same as analogRead(1).
 
Thanks a lot for such a quick reply and below is image of this board. It is designed to digitize signal from eight temperature and relative humidity and send it wireless using using Xbee module. T_RH_Board.jpg

I used two separate 5V regulators (one for digital device Teensy and XBee and other for all the other analog devices). I also separated analog ground connected to AGND and then also used resistor divider from analog 5V to get 3.3V and supply it to AREF. I tried running ADC with both DEFAULT and EXTERNAL voltage reference and the reading seem to be bit more stable with the DEFAULT instead of EXTERNAL reference which was a bit surprising. I was hoping that external reference would better reflect 5V analog supply changes and result in less noise but may be the input impedance of my resistor divider is too high and I should have used op-amp buffer.

As always thanks for your help,
George
 
Status
Not open for further replies.
Back
Top