how to connect audio shield with a teensy 4.1

bonjour, merci pour votre attention.
J'aimerais savoir comment connecter mon audio shield au teensy 4.1 afin d'écouter un son pour ensuite faire d'autre réglages, mais dans un premier temps un simple son monotone. Le but de ce montage étant de créer un saxophone silencieux d'où la présence d'un capteur de pression et un bouton poussoir.
Pour l'instant le montage n'est pas propre, c'était juste pour vérifier l'état de fonctionnement des composants, l'idéal serait avec une breadboard. Mais donc comment connecter de manière temporaire l'audio shield ?
Merci de votre temps
cordialement
Clément V



unnamed.jpg
 
Bonjour MarkzP, merci pour votre réponse, je vais tâcher d'appliquer vos conseils, mais savez-vous comment produire un son dans un casque audio et comment brancher concrètement l'audio bouclier au teensy ( quelle broche à quelle broche etc... ) ?
 
Pour le branchement, il faut simplement aligner les broches - il ya une correspondance directe entre le Audio Board rev D et le Teensy 4.x
Concrètement, pour générer un son, seules les broches suivantes sont requises:
  • GND
  • 3.3V
  • 21 (BCLK)
  • 23 (MCLK)
  • 7 (DO)
  • 20 (LRCLK)
Il faut limiter au minimum la longueur des branchements, surtout MCLK.

Pour ce qui est de produire un son, l'idéal est de suivre le tutoriel: https://www.pjrc.com/teensy/td_libs_Audio.html
Il y a des exemples disponibles tels que: Part_1_02_Hardware_Test.ino

Bonne chance avec ton projet!

Marc
 
Bonjour, j’ai essayé ce qu’elle dit dans le tuto( hardware test), mais je pense que mon montage ne marche pas…

IMG_2555.jpeg

Si quelqu’un sait ce qui ne va pas, je suis preneur
Cordialement
Clément
 
Difficile à voir de cet angle seulement, main est-ce que le Audio Board est soudé au Teensy? S'il est simplement mis entre le Teensy et le protoboard, les branchements ne suffiront pas

Aussi, ça aiderait de voir le code utilisé dans le tuto

Marc
 
Bonjour, j’ai essayé ce qu’elle dit dans le tuto( hardware test), mais je pense que mon montage ne marche pas…

View attachment 38187
Si quelqu’un sait ce qui ne va pas, je suis preneur
Cordialement
Clément
TRANSLATION (using translate.google.com):

Hello, I tried what she says in the tutorial (hardware test), but I think my setup doesn't work...

[ embedded image ]

If anyone knows what's wrong, I'd love to hear it.Sincerely,Clément
 
Difficile à voir de cet angle seulement, main est-ce que le Audio Board est soudé au Teensy? S'il est simplement mis entre le Teensy et le protoboard, les branchements ne suffiront pas

Aussi, ça aiderait de voir le code utilisé dans le tuto

Marc

TRANSLATION (using translate.google.com):

It's hard to see from this angle alone, but is the Audio Board soldered to the Teensy? If it's simply placed between the Teensy and the protoboard, the connections won't be sufficient.

Also, it would help to see the code used in the tutorial.

Marc
 
Bonjour,
Voici le code que j’ai téléversé,
Et oui j’ai simplement emboîté l’audio shield au teensy 4.1
// Advanced Microcontroller-based Audio Workshop
//
// http://www.pjrc.com/store/audio_tutorial_kit.html
// https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
//
// Part 1-2: Test Hardware
//
// Simple beeping is pre-loaded on the Teensy, so
// it will create sound and print info to the serial
// monitor when plugged into a PC.
//
// This program is supposed to be pre-loaded before
// the workshop, so Teensy+Audio will beep when
// plugged in.

#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>
#include <Bounce.h>

AudioSynthWaveform waveform1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(waveform1, 0, i2s1, 0);
AudioConnection patchCord2(waveform1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;

Bounce button0 = Bounce(0, 15);
Bounce button1 = Bounce(1, 15);
Bounce button2 = Bounce(2, 15);

int count=1;
int a1history=0, a2history=0, a3history=0;

void setup() {
AudioMemory(10);
pinMode(0, INPUT_PULLUP);
pinMode(1, INPUT_PULLUP);
pinMode(2, INPUT_PULLUP);
Serial.begin(115200);
sgtl5000_1.enable();
sgtl5000_1.volume(0.3);
waveform1.begin(WAVEFORM_SINE);
delay(1000);
button0.update();
button1.update();
button2.update();
a1history = analogRead(A1);
a2history = analogRead(A2);
a3history = analogRead(A3);
}




void loop() {
Serial.print("Beep #");
Serial.println(count);
count = count + 1;
waveform1.frequency(440);
waveform1.amplitude(0.9);
wait(250);
waveform1.amplitude(0);
wait(1750);
}

void wait(unsigned int milliseconds)
{
elapsedMillis msec=0;

while (msec <= milliseconds) {
button0.update();
button1.update();
button2.update();
if (button0.fallingEdge()) Serial.println("Button (pin 0) Press");
if (button1.fallingEdge()) Serial.println("Button (pin 1) Press");
if (button2.fallingEdge()) Serial.println("Button (pin 2) Press");
if (button0.risingEdge()) Serial.println("Button (pin 0) Release");
if (button1.risingEdge()) Serial.println("Button (pin 1) Release");
if (button2.risingEdge()) Serial.println("Button (pin 2) Release");
int a1 = analogRead(A1);
int a2 = analogRead(A2);
int a3 = analogRead(A3);
if (a1 > a1history + 50 || a1 < a1history - 50) {
Serial.print("Knob (pin A1) = ");
Serial.println(a1);
a1history = a1;
}
if (a2 > a2history + 50 || a2 < a2history - 50) {
Serial.print("Knob (pin A2) = ");
Serial.println(a2);
a2history = a2;
}
if (a3 > a3history + 50 || a3 < a3history - 50) {
Serial.print("Knob (pin A3) = ");
Serial.println(a3);
a3history = a3;
}
}
}
 
Et aussi pour essayer d’entendre un son j’ai branché des écouteurs avec la prise jack de l’audio shield mais je n’entends rien …
 
Et aussi pour essayer d’entendre un son j’ai branché des écouteurs avec la prise jack de l’audio shield mais je n’entends rien …

TRANSLATION (using translate.google.com):

And also to try to hear a sound I plugged in headphones with the jack plug of the audio shield but I can't hear anything...
 
Those headers that you have used to connect the two boards together are too short and the components on the underside of the Audio adaptor will have shorted out components/connectors on the teensy. I suggest you look up various YouTube videos showing HOW to stack the two components together.
It doesn't look like you were soldering the connectors to the Audio Adaptor. In some respects that is good as you had them right down onto the Teensy. On the other hand without soldering them down it just will not work! You should consider buying the sockets and headers intended for the Audio Card/Teensy combo.
 
When posting your code please post it between code tags using the </>. Doing so preserves the spacing and indenting. See below for your code inserted this way:
Code:
// Advanced Microcontroller-based Audio Workshop
//
// http://www.pjrc.com/store/audio_tutorial_kit.html
// https://hackaday.io/project/8292-microcontroller-audio-workshop-had-supercon-2015
//
// Part 1-2: Test Hardware
//
// Simple beeping is pre-loaded on the Teensy, so
// it will create sound and print info to the serial
// monitor when plugged into a PC.
//
// This program is supposed to be pre-loaded before
// the workshop, so Teensy+Audio will beep when
// plugged in.

#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>
#include <Bounce.h>

AudioSynthWaveform waveform1;
AudioOutputI2S i2s1;
AudioConnection patchCord1(waveform1, 0, i2s1, 0);
AudioConnection patchCord2(waveform1, 0, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1;

Bounce button0 = Bounce(0, 15);
Bounce button1 = Bounce(1, 15);
Bounce button2 = Bounce(2, 15);

int count = 1;
int a1history = 0, a2history = 0, a3history = 0;

void setup() {
    AudioMemory(10);
    pinMode(0, INPUT_PULLUP);
    pinMode(1, INPUT_PULLUP);
    pinMode(2, INPUT_PULLUP);
    Serial.begin(115200);
    sgtl5000_1.enable();
    sgtl5000_1.volume(0.3);
    waveform1.begin(WAVEFORM_SINE);
    delay(1000);
    button0.update();
    button1.update();
    button2.update();
    a1history = analogRead(A1);
    a2history = analogRead(A2);
    a3history = analogRead(A3);
}




void loop() {
    Serial.print("Beep #");
    Serial.println(count);
    count = count + 1;
    waveform1.frequency(440);
    waveform1.amplitude(0.9);
    wait(250);
    waveform1.amplitude(0);
    wait(1750);
}

void wait(unsigned int milliseconds)
{
    elapsedMillis msec = 0;

    while (msec <= milliseconds) {
        button0.update();
        button1.update();
        button2.update();
        if (button0.fallingEdge()) Serial.println("Button (pin 0) Press");
        if (button1.fallingEdge()) Serial.println("Button (pin 1) Press");
        if (button2.fallingEdge()) Serial.println("Button (pin 2) Press");
        if (button0.risingEdge()) Serial.println("Button (pin 0) Release");
        if (button1.risingEdge()) Serial.println("Button (pin 1) Release");
        if (button2.risingEdge()) Serial.println("Button (pin 2) Release");
        int a1 = analogRead(A1);
        int a2 = analogRead(A2);
        int a3 = analogRead(A3);
        if (a1 > a1history + 50 || a1 < a1history - 50) {
            Serial.print("Knob (pin A1) = ");
            Serial.println(a1);
            a1history = a1;
        }
        if (a2 > a2history + 50 || a2 < a2history - 50) {
            Serial.print("Knob (pin A2) = ");
            Serial.println(a2);
            a2history = a2;
        }
        if (a3 > a3history + 50 || a3 < a3history - 50) {
            Serial.print("Knob (pin A3) = ");
            Serial.println(a3);
            a3history = a3;
        }
    }
}
 
Merci de votre réponse mais je comprends pas comment j’ai pu créer un court circuit ? Car j’ai mis en contact le plastique noir des broches du teensy en contact avec les trous de l’audio shield.
J’ai fait un test pour tester la connexion avec l’audio shield avec le montage avec les fils précédemment photographié, et une seul fois il a dis qu’il y avait une bonne connexion.
Si je soude avec les broches que vous me conseillez ça va fonctionner à 100% ?
 
@clement_vrd : Si vous connectez le Teensy à l’adaptateur audio avec des fils (comme sur votre dernière photo), examinez attentivement le schéma et le brochage de l’adaptateur audio, car le Teensy possède plusieurs broches de masse, tandis que l’adaptateur audio n’en utilise qu’une seule. Assurez-vous donc de vous connecter à la bonne broche de masse de l’adaptateur audio.

De plus, dans votre schéma, dans votre fonction setup(), j’essaierais d’augmenter le volume du SGTL5000 à sgtl5000_1.volume(0.8);, et d’ajouter une ligne supplémentaire sgtl5000_1.unmuteHeadphone(); pour être sûr que le son soit envoyé via cette interface.

Bonne chance et amusez-vous !


TRANSLATION above (using translate.google.com):

@clement_vrd: If you are connecting the Teensy to the audio adapter with wires (as in your most recent picture), you should look carefully at the schematic & pinout for the audio adapter, as the Teensy has several GROUND pins, but the audio adapter only uses one specific GROUND pin. So, make sure that you are connecting to the appropriate GROUND pin on the audio adapter.

Also, in your sketch, in your setup() function, I would try increasing the SGTL5000 volume to sgtl5000_1.volume(0.8);, and adding an additional line that says sgtl5000_1.unmuteHeadphone(); to be sure that audio will be sent out thru that interface.

Good luck & have fun !!

Mark J Culross
KD5RXT
 
Merci de votre réponse mais je comprends pas comment j’ai pu créer un court circuit ? Car j’ai mis en contact le plastique noir des broches du teensy en contact avec les trous de l’audio shield.
J’ai fait un test pour tester la connexion avec l’audio shield avec le montage avec les fils précédemment photographié, et une seul fois il a dis qu’il y avait une bonne connexion.
Si je soude avec les broches que vous me conseillez ça va fonctionner à 100% ?

TRANSLATION (using translate.google.com):

Thanks for your reply, but I don't understand how I could have created a short circuit? Because I touched the black plastic of the Teensy pins to the holes in the audio shield.I tested the connection to the audio shield using the wire assembly I photographed earlier, and only once did it say there was a good connection.

If I solder with the pins you recommended, will it work 100%?
 
IMG_2577.jpeg

J’ai testé avec ce programme et ça me dis que aucun I2C n’est connecté
Code:
#include <Wire.h>

void setup() {
  Serial.begin(115200);
  delay(1000);
  Serial.println("Scan I2C en continu...");
  Wire.begin();
}

void loop() {
  bool found = false;

  for (byte addr = 1; addr < 127; addr++) {
    Wire.beginTransmission(addr);
    if (Wire.endTransmission() == 0) {
      Serial.print("I2C device found at 0x");
      Serial.println(addr, HEX);
      found = true;
    }
  }

  if (!found) {
    Serial.println("Aucun périphérique I2C détecté !");
  }

  delay(500); // refait un scan toutes les 2 secondes
}
 
J’ai testé avec ce programme et ça me dis que aucun I2C n’est connecté

TRANSLATION (using translate.google.com):

I tested with this program and it tells me that no I2C is connected

REPLY:

Désolé, j'ai oublié de mentionner également que vous devrez également effectuer des connexions soudées à l'adaptateur audio. Le simple passage des fils de connexion à travers les trous du PCB ne permettra pas d'établir une connexion suffisamment solide ni suffisamment fiable. Je suggère de souder les supports de l'adaptateur audio et les broches du Teensy. Cela permet d'accéder facilement au support microSD et au bouton PROGRAM du Teensy lorsque les deux cartes sont superposées.


TRANSLATION (using translate.google.com):

Sorry, I forgot to also mention that you'll need to make soldered connections to the audio adapter as well. Simply passing connecting wires through the PCB holes will not make a connection that is either strong enough nor reliable enough. I would suggest soldering sockets on the audio adapter & pins on the Teensy. This allows easy access to both the microSD socket & the PROGRAM button on the Teensy when the two boards are stacked together.

Hope this helps . . .

Mark J Culross
KD5RXT
 
Last edited:
Back
Top