Adafruit VS1053 and Arduino Mega

For other supported Arduino products from Adafruit: Shields, accessories, etc.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
csharprat
 
Posts: 8
Joined: Mon Oct 17, 2016 8:39 pm

Adafruit VS1053 and Arduino Mega

Post by csharprat »

I'm building an mp3 player based on the Adafruit VS1053 r.4 Breakout board (Product ID: 1381). I've had success with getting it to function with an Arduino Nano but the code that I've written is taking up too much memory. The 32k program/2k SRAM is not enough for what I'm trying to do. The Arduino Mega has 256k program/8k SRAM and that should be enough.

I replaced the Nano with the Mega, using the same pin assignments, but now I get this error "Couldn't find VS1053, do you have the right pins defined?". I double-checked the wiring and it's correct based on the pins for the Nano. Does the Mega require different pins than the Nano to operate the VS1053?

Here's an excerpt of my code that refers to the pin assignments

Code: Select all

// include SPI, MP3 and SD libraries
#include <SPI.h>
#include <Adafruit_VS1053.h>
#include <SD.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.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);
Closeup of my setup with the Mega:
Compressed_MegaCloseUp .jpg
Compressed_MegaCloseUp .jpg (568.48 KiB) Viewed 428 times

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit VS1053 and Arduino Mega

Post by adafruit_support_bill »

The SPI pins for the Mega are different from the Nano. You need to use: 50 (MISO), 51 (MOSI), 52 (CLK)

User avatar
csharprat
 
Posts: 8
Joined: Mon Oct 17, 2016 8:39 pm

Re: Adafruit VS1053 and Arduino Mega

Post by csharprat »

Thank you so much! That fixed the problem.
I wired it accordingly and uncommented the lines that aren't needed for the UNO/Nano and changed to the pins you specified:

Code: Select all

// define the pins used
#define CLK 52       // SPI Clock, shared with SD card
#define MISO 50      // Input data, from VS1053/SD card
#define MOSI 51      // Output data, to VS1053/SD card

User avatar
adafruit_support_bill
 
Posts: 88037
Joined: Sat Feb 07, 2009 10:11 am

Re: Adafruit VS1053 and Arduino Mega

Post by adafruit_support_bill »

Good to hear! Thanks for the update.

Locked
Please be positive and constructive with your questions and comments.

Return to “Other Arduino products from Adafruit”