dac in on propshield with teensy 3.2

Status
Not open for further replies.
Prop shield sound tests

Here are some tests that I have used in the past.

Here are some sound samples that I converted to RAW format. The sounds originally came from Adafruit for one of their Halloween builds. You will need these for PropSound2:

Here are my current config and library files (you will need Meissner_Config for PropSound2):

Here are 3 tests:

The tests are:
  • PropSound: This test originally came from Paul, and I modified it to take input from the USB serial console to raise/lower the sine wave;
  • PropSound2: This test just plays a bunch of pre-recorded sounds from memory (it needs the libraries in the first 2 zip files);
  • Talkie_Clock: This is a test originally from Peter Knight to have a voice say a time. I think this was posted when the prop shield beta was being performed.
]

I tend to use this speaker for connecting to the Prop shield:
 

Attachments

  • 2018-02-18-teensy-audio.zip
    580.9 KB · Views: 94
  • 2018-02-18-teensy-meissner.zip
    93 KB · Views: 95
  • 2018-02-18-teensy-prop.zip
    10.5 KB · Views: 91
Here are some tests that I have used in the past.

Here are some sound samples that I converted to RAW format. The sounds originally came from Adafruit for one of their Halloween builds. You will need these for PropSound2:

Here are my current config and library files (you will need Meissner_Config for PropSound2):

Here are 3 tests:

The tests are:
  • PropSound: This test originally came from Paul, and I modified it to take input from the USB serial console to raise/lower the sine wave;
  • PropSound2: This test just plays a bunch of pre-recorded sounds from memory (it needs the libraries in the first 2 zip files);
  • Talkie_Clock: This is a test originally from Peter Knight to have a voice say a time. I think this was posted when the prop shield beta was being performed.
]

I tend to use this speaker for connecting to the Prop shield:

Unless I misunderstand you, they are all dac out tests. i have that working, I need dac in.
 
Kinda, but they are seperate inputs are they not? I'm focussing on using the dac in on the propshield.

DAC is an output not an input. There is no DAC on the propshield. Connect T3.2 DAC/A14 to AudioIn on propshield to have T3.2 generate sounds/sinewave out DAC to AudioIn ... to speaker on propshield. See schematic https://www.pjrc.com/store/prop_shield.html

if you have propshield mounted on top of T3.2, the DAC and AudioIn pin/holes are right above each other.

Here is simple sketch to generate sine wave on T3.2 DAC, hook DAC to propshield AudioIn and listen to tone on propshield speaker.

Code:
float phase = 0.0;
float twopi = 3.14159 * 2;
elapsedMicros usec = 0;

void setup() {
  analogWriteResolution(12);
}

void loop() {
  float val = sinf(phase) * 2048.0 + 2048.0;
  analogWrite(A14, (int)val);
  phase = phase + 0.02;
  if (phase >= twopi) phase = 0;
  while (usec < 500) ; // wait
  usec = usec - 500;
}

Don't forget digitalWrite(5,HIGH); to enable amp on propshield.

or use the Audio library to drive DAC
Code:
// prop shield need pin 5
// start monitor to hear sound,  hit key to increase freq
#include <Audio.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine   sine1;          //xy=180,469
AudioOutputAnalog        dac1;           //xy=380,468
AudioConnection          patchCord1(sine1, dac1);
// GUItool: end automatically generated code

int freq = 1100;

void setup() {
	Serial.begin(9600);
	while (!Serial);
	Serial.println("Setting up");
  //dac1.analogReference(EXTERNAL);   // louder, default is 1.2v INTERNAL
	pinMode(5, OUTPUT);
	digitalWrite(5, 1);//Enable Amplifier.
	AudioMemory(12);
	sine1.amplitude(1.0);
	sine1.frequency(1000);
	Serial.println("Send Serial Char to increase freq");
}

void loop()
{
	if (Serial.available()) {
		Serial.read();
		sine1.frequency(freq);
		Serial.println(freq);
		freq += 100;
	}
}
 
Last edited:
DAC is an output not an input. There is no DAC on the propshield. Connect T3.2 DAC/A14 to AudioIn on propshield to have T3.2 generate sounds/sinewave out DAC to AudioIn ... to speaker on propshield. See schematic https://www.pjrc.com/store/prop_shield.html

if you have propshield mounted on top of T3.2, the DAC and AudioIn pin/holes are right above each other.

Here is simple sketch to generate sine wave on T3.2 DAC, hook DAC to propshield AudioIn and listen to tone on propshield speaker.

Code:
float phase = 0.0;
float twopi = 3.14159 * 2;
elapsedMicros usec = 0;

void setup() {
  analogWriteResolution(12);
}

void loop() {
  float val = sinf(phase) * 2048.0 + 2048.0;
  analogWrite(A14, (int)val);
  phase = phase + 0.02;
  if (phase >= twopi) phase = 0;
  while (usec < 500) ; // wait
  usec = usec - 500;
}

Don't forget digitalWrite(5,HIGH); to enable amp on propshield.

or use the Audio library to drive DAC
Code:
// prop shield need pin 5
// start monitor to hear sound,  hit key to increase freq
#include <Audio.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioSynthWaveformSine   sine1;          //xy=180,469
AudioOutputAnalog        dac1;           //xy=380,468
AudioConnection          patchCord1(sine1, dac1);
// GUItool: end automatically generated code

int freq = 1100;

void setup() {
	Serial.begin(9600);
	while (!Serial);
	Serial.println("Setting up");
  //dac1.analogReference(EXTERNAL);   // louder, default is 1.2v INTERNAL
	pinMode(5, OUTPUT);
	digitalWrite(5, 1);//Enable Amplifier.
	AudioMemory(12);
	sine1.amplitude(1.0);
	sine1.frequency(1000);
	Serial.println("Send Serial Char to increase freq");
}

void loop()
{
	if (Serial.available()) {
		Serial.read();
		sine1.frequency(freq);
		Serial.println(freq);
		freq += 100;
	}
}

Thanks, I have no problem getting audio out, with or without the audio shield.

There is a pin confusingly marked dac in on the prop shield, are you telling me that this is just badly labelled. Is there no way to get audio IN to teensy?
 
Might also be worth mentioning DAC stands for "Digital to Analog Converter", which necessarily means analog output.

For analog input, you want ADC for "Analog to Digital Converter". ;)

And yeah, we should probably look at revising the labeling on the prop shield for future batches. Any feedback about what would have been clearer?
 
Might also be worth mentioning DAC stands for "Digital to Analog Converter", which necessarily means analog output.

For analog input, you want ADC for "Analog to Digital Converter". ;)

And yeah, we should probably look at revising the labeling on the prop shield for future batches. Any feedback about what would have been clearer?

That is indeed why I found the label confusing.

After looking at your schematic, perhaps just Amp In might be easier to understand.
 
Looking at the schematic of the prop shield where the so called DAC pin signal goes to the input of an audio amplifier IC, and seen that the pin is physically located to connect almost automatically to the DAC output of the Teensy 3.2, I can‘t see any ambiguity or confusion...
 
Looking at the schematic of the prop shield where the so called DAC pin signal goes to the input of an audio amplifier IC, and seen that the pin is physically located to connect almost automatically to the DAC output of the Teensy 3.2, I can‘t see any ambiguity or confusion...

The schematic is not ambiguous. The label DAC IN confused me, and still does I'm sorry to say.
 
Status
Not open for further replies.
Back
Top