Multiple AudioInputAnalog Question

Status
Not open for further replies.

Nolebrain

Member
Hello All,

I've been stuck trying to get multiple Analog inputs to be read by a Teensy 3.6 board. It seems like the hardware does not support reading more than one AnalogInput.

Here is my setup code, hopefully there is something I can change to make this work. Presently, I have 4 different piezoelectric elements being measured and clamped to 1.4 V. I plan on measuring the peak of each signal.

Code:
AudioAnalyzePeak         peak3;          //xy=189,418
AudioAnalyzePeak         peak2;          //xy=190,369
AudioAnalyzePeak         peak1;          //xy=191,320
AudioInputAnalog         adc3(A6);           //xy=192,219
AudioInputAnalog         adc1(A2);           //xy=193,126
AudioInputAnalog         adc2(A3);           //xy=193,174
AudioAnalyzePeak         peak4;          //xy=192,467
AudioInputAnalog         adc4(A7);           //xy=194,265
AudioConnection          patchCord1(adc1, peak1);
AudioConnection          patchCord2(adc1, peak1);
AudioConnection          patchCord3(adc2, peak2);
AudioConnection          patchCord4(adc4, peak4);
AudioControlSGTL5000     sgtl5000_1;     //xy=200,518

When this happens the program crashes and does not run. It works perfectly with a single analog input.

Thanks in advance; Teensy has been stellar for projects so far!

-NB
 
Last edited:
Here is a picture of my audio sketch, it's quite simple but does not work. Is there any possible way to do this with a single Teensy 3.6 board? I would like to avoid using 4 boards for 4 analog signals.

multiple adc peak capture.PNG

Any help is greatly appreciated!
 
I'm not sure, but after looking at the audio library documentation, it is highly probable that the adc objects need to "monopolize" an internal hardware ADC each. Thus, with the Teensy 3.6, you'd be limited to 2 adc objects, one using a pin which will be muxed to the internal h/w ADC0 and one to the internal h/w ADC1.

Thus, for one analog input you'd use one AudioInputAnalog object, for two you'd use one AudioInputAnalogStereo object. But don't forget, these are optimized to act as analog audio inputs with 12/13bit resolution and a high sample rate of 44100kHz which seems to me an absolute overkill for peak detection on piezo signals. This can be done in a ways more efficient way with some handwritten code around the ADC library, using more ADC channels interleaved to the internal h/w ADCs at the same time.
 
Status
Not open for further replies.
Back
Top