0

UART mode not working Sound FX Mini 2MB not playing tracks w
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

UART mode not working Sound FX Mini 2MB not playing tracks w

by ochevallier95 on Tue Mar 19, 2019 10:17 am

Hello,
So I'm currently building a project for my major project. I'm using Arduino UNO as the microcontroller.

The project is using an Infrared remote to trigger cases within the program. As part of these cases, I want the Arduino to play specific tracks that I have saved as .WAV files onto the soundboard. In addition to this, a vibrator motor and an LCd screen will also perform various functions.

I have wired up my Sound FX board and amplifier as shown in the link below
https://learn.adafruit.com/adafruit-aud ... io-control

I have however connected the RX pin to pin 6 on the UNO, RST to pin 8 and TX to pin 7.

I have tried to trigger the tracks playing simply by using the sfx.playTrack(" "); command but nothing seems to occur.

As you can see from the image attached, when I press the appropriate button, the serial plotter is stating that the correct track sound file is being triggered, as well as the related IR key code. But the board just isnt playing.

I have named my files T01RAND1.WAV, T02.WAV and T03.WAV. They are to be played in cases second_key , fourth_key and fifth_key.

If anyone could please tell me where I'm going wrong or if there's a line of code I'm missing I would really appreciate it. Ive spent all day trying to figure it out and I've sadly made no progress.

Below is my full sketch:


#include "IRremote.h"
#include <IRremoteInt.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
#include "Adafruit_Soundboard.h"

int receiver_pin = 13;

int haptic_feedback = 10;
int second_led_pin = 9;
int third_led_pin = 8;
int fourth_led_pin = 7;
int led[] = {0,0,0,0,0};
IRrecv receiver(receiver_pin);
decode_results output;

#define first_key 16724175
#define second_key 16718055
#define third_key 16743045
#define fourth_key 16716015
#define fifth_key 16726215
#define sixth_key 16734885

// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 2;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// Choose any two pins that can be used with SoftwareSerial to RX & TX
#define SFX_TX 7
#define SFX_RX 6
// Connect to the RST pin on the Sound Board
#define SFX_RST 8
// You can also monitor the ACT pin for when audio is playing!



// we'll be using software serial
SoftwareSerial ss = SoftwareSerial(SFX_TX, SFX_RX);
// pass the software serial to Adafruit_soundboard, the second
// argument is the debug port (not used really) and the third
// arg is the reset pin
//Adafruit_Soundboard sfx = Adafruit_Soundboard(&ss, NULL, SFX_RST);
// can also try hardware serial with
Adafruit_Soundboard sfx = Adafruit_Soundboard(&Serial, NULL, SFX_RST);


void setup()
{
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("Welcome to");
lcd.setCursor(0, 1);
lcd.print("OLYMPIA");

Serial.begin(9600);
receiver.enableIRIn();
pinMode(haptic_feedback, OUTPUT);
pinMode(second_led_pin, OUTPUT);
pinMode(third_led_pin, OUTPUT);
pinMode(fourth_led_pin, OUTPUT);
pinMode(SFX_RX, OUTPUT);
pinMode(SFX_TX, OUTPUT);
pinMode(SFX_RST, OUTPUT);
}

void loop() {
if (receiver.decode(&output)) {
unsigned int value = output.value;
switch(value) {

case first_key: // vibrate
if(led[1] == 1) {
digitalWrite(haptic_feedback, LOW);
led[1] = 0;
} else {
digitalWrite(haptic_feedback, HIGH);
led[1] = 1;
}
break;

case second_key: // Bad technique audio, lcd and vibrate

lcd.clear();
digitalWrite(haptic_feedback, HIGH);
digitalWrite(second_led_pin, HIGH);
led[2] = 1;
sfx.playTrack("T01RAND1");
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("Back is Arched!");
lcd.setCursor(0, 1);
lcd.print("Please Correct");
delay(1500);
digitalWrite(second_led_pin, LOW);
digitalWrite(haptic_feedback, LOW);
led[2] = 0;
lcd.clear();
break;

case third_key: // good technique on lcd

lcd.clear();
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("Great Technique!");
lcd.setCursor(0, 1);
lcd.print("Keep Going!");
delay(3000);
lcd.clear();
break;


case fourth_key: // Post workout tip - well done message

lcd.clear();
sfx.playTrack("T03 ");
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("Well Done! 87%");
lcd.setCursor(0, 1);
lcd.print("Correct Techniqu");
delay(3000);
lcd.clear();
break;


case fifth_key: // pre workout technique tip and vibration

lcd.clear();
digitalWrite(haptic_feedback, HIGH);
sfx.playTrack("T02 ");
lcd.setCursor(0, 0); // set the cursor to column 0, line 0
lcd.print("Brace your core&");
lcd.setCursor(0, 1);
lcd.print("flatten the back");
delay(2000);
digitalWrite(haptic_feedback, LOW);
lcd.clear();
break;


}
Serial.println(value);
receiver.resume();
}
}

serial plotter.PNG
serial plotter image
serial plotter.PNG (9.68 KiB) Viewed 122 times

Setup1.JPG
Set Up 1
Setup1.JPG (84.06 KiB) Viewed 118 times

setup2.JPG
Setup 2
setup2.JPG (110.08 KiB) Viewed 118 times

ochevallier95
 
Posts: 2
Joined: Tue Mar 19, 2019 9:45 am

Re: UART mode not working Sound FX Mini 2MB not playing trac

by adafruit_support_mike on Wed Mar 20, 2019 2:06 am

You have to use 11-character filenames in the UART version. The first 8 characters are the filename, the last three are the file extension.

"T01RAND1" needs to be "T01RAND1WAV", for instance.

This part of the tutorial has more detail:

https://learn.adafruit.com/adafruit-aud ... -name-8-25

adafruit_support_mike
 
Posts: 57354
Joined: Thu Feb 11, 2010 2:51 pm

Re: UART mode not working Sound FX Mini 2MB not playing trac

by ochevallier95 on Wed Mar 20, 2019 9:45 am

Hello, tha k you for your response. Sadly I have tried this and it still isn't working! Am I using the correct command to tell the module to play that file?

I used sfx.playTrack("T02_____WAV")
I also tried sfx.playTrack(T02______WAV)

Where the _ are spaces on my code.


Still nothing. Is it possible my module is faulty?

ochevallier95
 
Posts: 2
Joined: Tue Mar 19, 2019 9:45 am

Re: UART mode not working Sound FX Mini 2MB not playing trac

by adafruit_support_mike on Thu Mar 21, 2019 2:54 am

Try running the UART example from the FX Board library. Can you get tracks to play from that?

adafruit_support_mike
 
Posts: 57354
Joined: Thu Feb 11, 2010 2:51 pm

Please be positive and constructive with your questions and comments.