sachiniyer
Member
Hello,
I am currently using a teensy 3.6 with 2 of these amplifiers to drive two 8 ohm speakers. They teensy is being powered by a voltage controlled LiPo battery outputting around 4V (voltage controllers). When I play a wav file, sometimes the audio cuts out or cuts to a lot of static. The teensy also stops accepting input from the pins (at least the button that I have connected stops working and serial communication is also stopped). I also checked to see if audio would continue through a usb connection, after these occurrences, but that also does not happen. However, the teensy as a whole stays on. This happens with much more frequency when the teensy is connected only to the external power source. Right now, it happens consistently about 2 seconds after a wav file starts playing. I have however had times when it has worked through only the external battery, but they are rare.
I originally thought that it might have to do with the clock speed either drawing too much current or too little current, so I tried running the teensy at both 16MHz and 180MHz, however neither seemed to solve my problem. I also thought it might have to do with a loose connection somewhere leading one of the amplifiers drawing more current that it was supposed to, but after resoldering everything, the problem was still there. I thought it might be an audio memory problem with me not giving enough memory. So I increased the memory, and the problem was still there. I then thought it might be a problem with the teensy running at lower clock speeds because of a voltage input of less than 5V, so I tried to change that but I could not find information on forcing clock speeds on the teensy 3.6 (I only found it for the teensy 2.x and lc). I have attached the code (which I know is pretty bad), voltages from the battery (second image is while charging), and videos of the problem (and one of the teensy working when the battery is being charged). The videos are stored here, because I can't upload them. If you would like me to take pictures of the soldering in more detail (at great embarrassment to myself), I would be happy to do so.
Thanks for all the help in advance.
I am currently using a teensy 3.6 with 2 of these amplifiers to drive two 8 ohm speakers. They teensy is being powered by a voltage controlled LiPo battery outputting around 4V (voltage controllers). When I play a wav file, sometimes the audio cuts out or cuts to a lot of static. The teensy also stops accepting input from the pins (at least the button that I have connected stops working and serial communication is also stopped). I also checked to see if audio would continue through a usb connection, after these occurrences, but that also does not happen. However, the teensy as a whole stays on. This happens with much more frequency when the teensy is connected only to the external power source. Right now, it happens consistently about 2 seconds after a wav file starts playing. I have however had times when it has worked through only the external battery, but they are rare.
I originally thought that it might have to do with the clock speed either drawing too much current or too little current, so I tried running the teensy at both 16MHz and 180MHz, however neither seemed to solve my problem. I also thought it might have to do with a loose connection somewhere leading one of the amplifiers drawing more current that it was supposed to, but after resoldering everything, the problem was still there. I thought it might be an audio memory problem with me not giving enough memory. So I increased the memory, and the problem was still there. I then thought it might be a problem with the teensy running at lower clock speeds because of a voltage input of less than 5V, so I tried to change that but I could not find information on forcing clock speeds on the teensy 3.6 (I only found it for the teensy 2.x and lc). I have attached the code (which I know is pretty bad), voltages from the battery (second image is while charging), and videos of the problem (and one of the teensy working when the battery is being charged). The videos are stored here, because I can't upload them. If you would like me to take pictures of the soldering in more detail (at great embarrassment to myself), I would be happy to do so.
Thanks for all the help in advance.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
AudioPlaySdWav playWav1;
AudioOutputUSB audioOutput;
AudioOutputAnalog dac;
AudioConnection patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection patchCord2(playWav1, 1, audioOutput, 1);
AudioConnection patchCord3(playWav1, 0, dac, 0);
#define SDCARD_CS_PIN BUILTIN_SDCARD
#define SDCARD_MOSI_PIN 11 // not actually used
#define SDCARD_SCK_PIN 13 // not actually used
const int ledPin = 13;
void setup() {
Serial.begin(9600);
pinMode(A8, INPUT);
pinMode(15, INPUT);
pinMode(14, OUTPUT);
digitalWrite(14, HIGH);
pinMode(12, INPUT_PULLUP);
pinMode(ledPin, OUTPUT);
digitalWrite(ledPin, HIGH);
AudioMemory(100);
SPI.setMOSI(SDCARD_MOSI_PIN);
SPI.setSCK(SDCARD_SCK_PIN);
if (!(SD.begin(SDCARD_CS_PIN))) {
while (1) {
Serial.println("Unable to access the SD card");
delay(500);
}
}
}
void playFile(const char *filename)
{
if(!playWav1.isPlaying()) {
playWav1.play(filename);
}
else {
playWav1.stop();
playWav1.play(filename);
}
}
bool checkButton(int val) {
if (val == 1023) {
return true;
}
else {
return false;
}
}
String getFile (int val) {
int a = round(val/46.5) + 1;
return (String(a) + ".WAV");
}
void loop() {
if (checkButton(analogRead(15))) {
playFile(getFile(analogRead(A8)).c_str());
Serial.println(getFile(analogRead(A8)));
}
delay(1000);
}