0

Metro, Music Maker and LED
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Metro, Music Maker and LED

by Deck52 on Sun Sep 06, 2020 4:42 pm

Hello All. New to this.

I've got a Music Maker on a Metro and its working fine, playing sound files. The next step is to have LED flashing randomly and then when the audio files play they flash to the words.

Like I said, I'm new to this so I am not sure where the connections would go on the music maker for the LED and what I would need to make the LED responsive. I've done some research but there's a lot out there and some things contradict.

Lastly is code. Again, new to this and am not sure how to write something like this.

Any help would be great. Thanks.

Deck52
 
Posts: 47
Joined: Wed Aug 10, 2016 12:14 pm

Re: Metro, Music Maker and LED

by Deck52 on Mon Sep 07, 2020 1:13 pm

Hello All, I decided to un-stack them because of where I'll be mounting them. Unfortunately, now I'm not getting any power to the music maker. Any help would be great. Thanks. :)

20200907_125530.jpg
20200907_125530.jpg (421 KiB) Viewed 254 times

20200907_125537.jpg
20200907_125537.jpg (576.74 KiB) Viewed 254 times

20200907_125543.jpg
20200907_125543.jpg (487.17 KiB) Viewed 254 times

Deck52
 
Posts: 47
Joined: Wed Aug 10, 2016 12:14 pm

Re: Metro, Music Maker and LED

by Deck52 on Mon Sep 07, 2020 5:50 pm

OK, update, figured out power issue, that was a stupid mistake. So now no audio. I'm using this code from the site and have it wired up like images. When I load the sketch it makes a static noise and says "Couldn't find VS1053, do you have the right pins defined?"

One thing that's throwing me is this one.
#define BREAKOUT_CS 10 // VS1053 chip select pin (output)
I can't find CS on the board, there a MCS and a CCS.

Would love to know what the heck I'm doing wrong. :)


Code: Select all | TOGGLE FULL SIZE
/***************************************************
  This is an example for the Adafruit VS1053 Codec Breakout

  Designed specifically to work with the Adafruit VS1053 Codec Breakout
  ----> https://www.adafruit.com/products/1381

  Adafruit invests time and resources providing this open source code,
  please support Adafruit and open-source hardware by purchasing
  products from Adafruit!

  Written by Limor Fried/Ladyada for Adafruit Industries. 
  BSD license, all text above must be included in any redistribution
 ****************************************************/

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>

// define the pins used
//#define CLK 13       // SPI Clock, shared with SD card
//#define MISO 12      // Input data, from VS1053/SD card
//#define MOSI 11      // Output data, to VS1053/SD card
// Connect CLK, MISO and MOSI to hardware SPI pins.
// See http://arduino.cc/en/Reference/SPI "Connections"

// These are the pins used for the breakout example
#define BREAKOUT_RESET  9      // VS1053 reset pin (output)
#define BREAKOUT_CS     10     // VS1053 chip select pin (output)
#define BREAKOUT_DCS    8      // VS1053 Data/command select pin (output)
// These are the pins used for the music maker shield
//#define SHIELD_RESET  -1      // VS1053 reset pin (unused!)
//#define SHIELD_CS     7      // VS1053 chip select pin (output)
//#define SHIELD_DCS    6      // VS1053 Data/command select pin (output)

// These are common pins between breakout and shield
#define CARDCS 4     // Card chip select pin
// DREQ should be an Int pin, see http://arduino.cc/en/Reference/attachInterrupt
#define DREQ 3       // VS1053 Data request, ideally an Interrupt pin

Adafruit_VS1053_FilePlayer musicPlayer =
  // create breakout-example object!
  Adafruit_VS1053_FilePlayer(BREAKOUT_RESET, BREAKOUT_CS, BREAKOUT_DCS, DREQ, CARDCS);
  // create shield-example object!
  //Adafruit_VS1053_FilePlayer(SHIELD_RESET, SHIELD_CS, SHIELD_DCS, DREQ, CARDCS);
 
void setup() {
  Serial.begin(9600);
  Serial.println("Adafruit VS1053 Simple Test");

  if (! musicPlayer.begin()) { // initialise the music player
     Serial.println(F("Couldn't find VS1053, do you have the right pins defined?"));
     while (1);
  }
  Serial.println(F("VS1053 found"));
 
   if (!SD.begin(CARDCS)) {
    Serial.println(F("SD failed, or not present"));
    while (1);  // don't do anything more
  }

  // list files
  printDirectory(SD.open("/"), 0);
 
  // Set volume for left, right channels. lower numbers == louder volume!
  musicPlayer.setVolume(20,20);

  // Timer interrupts are not suggested, better to use DREQ interrupt!
  //musicPlayer.useInterrupt(VS1053_FILEPLAYER_TIMER0_INT); // timer int

  // If DREQ is on an interrupt pin (on uno, #2 or #3) we can do background
  // audio playing
  musicPlayer.useInterrupt(VS1053_FILEPLAYER_PIN_INT);  // DREQ int
 
  // Play one file, don't return until complete
  Serial.println(F("Playing track 001"));
  musicPlayer.playFullFile("/track001.mp3");
  // Play another file in the background, REQUIRES interrupts!
  Serial.println(F("Playing track 002"));
  musicPlayer.startPlayingFile("/track002.mp3");
}

void loop() {
  // File is playing in the background
  if (musicPlayer.stopped()) {
    Serial.println("Done playing music");
    while (1) {
      delay(10);  // we're done! do nothing...
    }
  }
  if (Serial.available()) {
    char c = Serial.read();
   
    // if we get an 's' on the serial console, stop!
    if (c == 's') {
      musicPlayer.stopPlaying();
    }
   
    // if we get an 'p' on the serial console, pause/unpause!
    if (c == 'p') {
      if (! musicPlayer.paused()) {
        Serial.println("Paused");
        musicPlayer.pausePlaying(true);
      } else {
        Serial.println("Resumed");
        musicPlayer.pausePlaying(false);
      }
    }
  }

  delay(100);
}


/// File listing helper
void printDirectory(File dir, int numTabs) {
   while(true) {
     
     File entry =  dir.openNextFile();
     if (! entry) {
       // no more files
       //Serial.println("**nomorefiles**");
       break;
     }
     for (uint8_t i=0; i<numTabs; i++) {
       Serial.print('\t');
     }
     Serial.print(entry.name());
     if (entry.isDirectory()) {
       Serial.println("/");
       printDirectory(entry, numTabs+1);
     } else {
       // files have sizes, directories do not
       Serial.print("\t\t");
       Serial.println(entry.size(), DEC);
     }
     entry.close();
   }
}
Attachments
20200907_173102.jpg
20200907_173102.jpg (526.06 KiB) Viewed 250 times
20200907_173057.jpg
20200907_173057.jpg (426.7 KiB) Viewed 250 times
20200907_173037.jpg
20200907_173037.jpg (386.27 KiB) Viewed 250 times

Deck52
 
Posts: 47
Joined: Wed Aug 10, 2016 12:14 pm

Re: Metro, Music Maker and LED

by mikeysklar on Wed Sep 09, 2020 12:45 pm

I see the confusion about the CS pin #10 in the code and not being labeled on the shield. It is also not mentioned on our guide page.

There are a couple other pins that are required for talking to the VS1053 to play MP3s and such
MCS - this is the VS1053 chip select pin, connected to Digital #7
DCS - this is the VS1053 data select pin, connected to Digital #6
CCS - this is the SD Card chip select pin, connected to Digital #4
DREQ - this is the VS1053 data request interrupt pin - connected to digital #3


https://learn.adafruit.com/adafruit-mus ... er/pinouts

When in doubt here you can line up the metro headers to where the shield headers would have connected and run your own wire. Since it is using pin #10 on the metro side go with the corresponding connector on the shield side.

mikeysklar
 
Posts: 4912
Joined: Mon Aug 01, 2016 8:10 pm

Re: Metro, Music Maker and LED

by Deck52 on Wed Sep 09, 2020 1:24 pm

Thanks. I used the corresponding pin on the music maker and still get no audio. I have an mps on the sd, named it correctly but I still get.

Adafruit VS1053 Simple Test
Couldn't find VS1053, do you have the right pins defined?

Also do the contacts in the first pic need to be connected or left open. I closed them but then I thought that was wrong so I removed the solder.

Thanks so much for your help.
Attachments
20200909_131141.jpg
20200909_131141.jpg (479.03 KiB) Viewed 249 times
20200909_130425.jpg
20200909_130425.jpg (507.81 KiB) Viewed 249 times

Deck52
 
Posts: 47
Joined: Wed Aug 10, 2016 12:14 pm

Re: Metro, Music Maker and LED

by mikeysklar on Thu Sep 10, 2020 1:19 pm

How come you are not connecting into the female headers on the Music Maker? There could be a difference based on how the board connects and the way the pads are laid out. I would not use any of the vias until you repeat the working behavior on the female headers. The vias when they are used must be soldered.

mm-maker.png
mm-maker.png (83.16 KiB) Viewed 244 times

mikeysklar
 
Posts: 4912
Joined: Mon Aug 01, 2016 8:10 pm

Re: Metro, Music Maker and LED

by Deck52 on Sat Sep 12, 2020 10:50 am

I don't get audio either way. I guess I'm just going to have to try another board or something.

Deck52
 
Posts: 47
Joined: Wed Aug 10, 2016 12:14 pm

Please be positive and constructive with your questions and comments.


cron