Template: Music Shield Quick Start

From Waveshare Wiki
Jump to: navigation, search

Getting Started

Pin Descriptions

  1. D11, D12 and D13 are the MOSI, MISO and SCLK buses of the SPI interface by default.
  2. A0, A1, A2 and A3 are connected to the XRESET, DREQ, XDCS and XCS of VS1053.
  3. D10 and D9 are the CS and SD_Detect pins of the SD card.
  4. D7,D6,D5,D4 and D3 correspond to the button Down (Volume -), Left (Previous), Middle (Play/Stop/Record), Right (Next), Up(Volume +).
  5. D8 is the LED indicator (it blinks when the module plays or records).

How to use

In this section, we will illustrate the applications of this shield by using 2 kinds of development boards.

Used for STM32 XNUCLEO, NUCLEO

1. Playing Audio

  1. Copy some audio files to the root directory of a TF card and insert it into the TF socket of a Music Shield.
  2. Connect the development board to a PC.
  3. Compile and program the Music Shield Player Demo.
  4. Run the serial monitor software (PuTTY, SecureCRT, Arduino Serial Monitor, etc.) Set the software as: Baud: 9600, Data bits: 8, Stop bits 1; Parity: None, Flow control: None.
  5. Plug in an earphone and you will hear the music. Press the Up/Down button to adjust the volume and Left/Right button to select the audio file. Press the Middle button to play or pause. Hold the Middle button to start recording (The Line In port is set as default recording input or you can edit the source code to set the onboard mic as a recording input) then press the Middle button to stop recording. The Serial Monitor software will print:
**********playing list**********
1 . test.wav
2 . test.aac
3 . test.flac
4 . test.mp3
5 . test.ogg
6 . test.wma
Playing test.wav ...
Recording......
Press play button to stop.
Recording end

2. MIDI (SD card is not required under Real-Time MIDI)

  1. Connect the development board to a PC.
  2. Compile and program the Music Shield MIDI Demo.
  3. Run the serial monitor software (PuTTY, SecureCRT, Arduino Serial Monitor, etc.) Set the software as: Baud: 9600, Data bits: 8, Stop bits 1; Parity: None, Flow control: None.
  4. Plug in an earphone and you will hear the beautiful MIDI music. Meanwhile the Serial Monitor software will print:
Init vs10xx in MIDI format...
done
Fancy Midi Sounds
 Instrument: 30
N: 27
N: 28
N: 29
N: 30
N: 31
N: 32
N: 33
N: 34
N: 35
N: 36
N: 37
N: 38
N: 39
N: 40

Used for Arduino UNO PLUS

1. Playing Audio (High quality or lossless music and recording function are not supported by UNO, due to the lack of speed and memory.)

  1. Copy some audio files to the root directory of a TF card and insert it into the TF socket of a Music Shield.
  2. Connect the development board to a PC.
  3. Unzip the demo files to the directory of Arduino software: ..\arduino\libraries.
  4. Run Arduino software and click File --> Examples --> MusicPlayer --> MusicShield to open the demo. Compile (click Verify) and program (click Upload) it.
  5. Run the serial monitor software (PuTTY, SecureCRT, Arduino Serial Monitor, etc.) Set the software as: Baud: 115200, Data bits: 8, Stop bits 1; Parity: None, Flow control: None.
  6. Plug in an earphone and you will hear the music. Press the Up/Down button to adjust the volume and Left/Right button to select the title. Press the Middle button to play or pause. Meanwhile the Serial Monitor software will print:
---- songs in TF card (root dir) ----
RECORD~1.WAV
TEST.ACC
TEST.MP3
TEST.OGG
TEST.WAV
TEST.WMA
Playing RECORD~1.WAV
[done!]
Playing TEST.WAV

2. MIDI (SD card is not required under Real-Time MIDI)

  1. Connect the development board to a PC,
  2. Run Arduino software and click File --> Examples --> MusicPlayer --> MusicShield to open the demo. Compile (click Verify) and program (click Upload) it.
  3. Run the serial monitor software (PuTTY, SecureCRT, Arduino Serial Monitor, etc.) Set the software as: Baud: 115200, Data bits: 8, Stop bits 1; Parity: None, Flow control: None.
  4. Plug in an earphone and you will hear the beautiful MIDI music. Meanwhile the Serial Monitor software will print:
Init vs10xx in MIDI format...done
Fancy Midi Sounds
 Instrument: 30
N: 27
N: 28
N: 29
N: 30
N: 31
N: 32
N: 33
N: 34
N: 35
N: 36
N: 37
N: 38
N: 39
N: 40