Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 3 of 3

Thread: How to set different voltage references for ADC0 and ADC1?

  1. #1
    Junior Member
    Join Date
    Jun 2018
    Posts
    2

    How to set different voltage references for ADC0 and ADC1?

    Hi! I am using a Teensy 3.2 by itself, without the audio board, and I am working on a guitar pedal. I am using the Audio Library GUI tool.

    The default behavior of the Audio Library GUI is to use the Teensy's internal 1.2V reference. I am OK with that for my guitar signal. However, I don't see a way to send 1.2V to any pots, and I think the preferred approach would be to send them the 3.3V supply voltage anyway.

    From this thread (second post) I can see which of the two ADCs control which analog input pins.

    It seems to me the ideal solution would be to set one ADC to use the internal 1.2V reference and use that for the guitar, and the other ADC to the 3.3V reference and use that for the pots. However I have no idea how to do this. Here is my code:

    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    AudioInputAnalog adc1(A4); // Note: A4 is on ADC0
    AudioFilterStateVariable filter1;
    AudioOutputAnalog dac1;
    AudioConnection patchCord1(adc1, 0, filter1, 0);
    AudioConnection patchCord2(filter1, 0, dac1, 0);
    
    void setup() {
      AudioMemory(12);
      pinMode(A15, INPUT); // For reading the pot. Note this is on ADC1 and the guitar input is on ADC0.
      // How to set voltage reference to Vcc for ADC1 only???
    }
    
    void loop() {
      // analogRead() should be OK here because A15 is on a different ADC than the guitar input
      filter1.frequency(analogRead(A15); // Set frequency based on the pot
    }
    As far as I know there is only the function
    Code:
    analogReference()
    but this changes the setting for both ADCs.

  2. #2
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    6,375
    Searching found this thread: forum.pjrc.com Voltage-reference-question

  3. #3
    Junior Member
    Join Date
    Jun 2018
    Posts
    2
    Well that's just embarrassing. I tried searching, but must have missed it due to the ambiguous title.

    Thanks!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •