Project in progress
Fairytale

Fairytale © CC0

A little box powered by an Arduino Uno, an Adafruit MP3 Music Maker Shield and an NFC breakout board to play MP3 with the command of a tag.

  • 704 views
  • 3 comments
  • 3 respects

Components and supplies

A000066 iso both
Arduino UNO & Genuino UNO
×1
SunFounder PN532 NFC Module
Or of course any other NFC reader with SPI connection
×1
1788 00
Adafruit Arduino MP3 Shield
×1
Adafruit Powerboost 1000c
if you want to have the box portable and with battery
×1
LiPo Battery
if you want to have the box portable
×1
Omron b3f 1000 image 75px
SparkFun Pushbutton switch 12mm
for manual controlling volume and next, previous track selection and to enter program mode
×5
E switch eg1218 image 75px
Slide Switch
in case you opted for the powerboost and want to have an on/off switch
×1
09590 01
LED (generic)
I have three different colored LEDs for visual effects and feedback to the user
×3
10722 01
Speaker: 0.25W, 8 ohms
×1
Justboom air mouse remote
JustBoom IR Remote
×1
IR Remote Receiver
×1
Panasonic eca2am101
Capacitor 100 µF
×1
Mfr 25frf52 100r sml
Resistor 100 ohm
×1
Mfr 25fbf52 221r sml
Resistor 221 ohm
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×2
Mfr 25frf52 1k sml
Resistor 1k ohm
×1
08377 02 l
Resistor 330 ohm
×1
Mfr 25fbf52 475r sml
Resistor 475 ohm
×1
09939 01
Rotary potentiometer (generic)
×1

Necessary tools and machines

09507 01
Soldering iron (generic)
3drag
3D Printer (generic)
in case you want to print the cube - see cad section for STLs
Hy gluegun
Hot glue gun (generic)

About this project

Fairytale

Introduction

Fairytale is an Arduino powered mp3-player designed to play audiobooks (or any MP3 for that matter) from an SD Card. The user controls this playback, that is which Audiobook or Album to play, via NFC tags that he/she may bring near an NFC Reader.

This tags could for example be attached to little figures - such as Snowhite. Of course you could just put them on little dices or whatever suits you - just keep in mind that my box is supposed to be used by my 4 year old daughter and therefor I use little figures.

Fairytale operates from an Arduino UNO V3 onto which an Adafruit Music Maker Shield is attached.

Furthermore there is a Sunfounder PN532 NFC breakout board attached to it and finally a potentiometer

for volume control and 4 buttons for pause/unpause, next or previous track selection and light effects (turning them on and off).

Oh, yes and then of course there is an LED for light effects :-) for warnings and for errors.

As there is no screen included with this MP3 player, certain situations (mainly warnings and errors) are spoken.

Background

To read the story that initially inspired me to do this project, visit: https://gist.github.com/wkjagt/814b3f62ea03c7b1a765

First Try Raspberry PI

I started this project off on a Raspberry PI but gave up on it - mainly for three reasons:

1. The Raspberry PI needs way too much time to startup

2. I can't just turn it off because of the danger of damaging the SD Card

3. The volume of the sound output of the RasPi is very limited

All in all, the RasPi approach is not as failsave for a 4 year old, so I gave it up and used the Arduino UNO as the base platform. If you'd nevertheless like to give the RasPi approach a try, you can find the latest state of work in the sub directory RASPI-stuff - be aware though that I never finished it and that there is no guideline on how to build it.

Second / Final Try Arduino

This is what I present here, an NFC controlled MP3 Audiobook Player for my daughter based on an Arduino UNO, Adafruit Music Maker Shield and Sunfounder PN532 NFC Breakout Board.

Hardware design

This section explains components and hardware layout as well of wiring the different components that make up Fairytale.

Components

  • Arduino UNO V3
  • Adafruit Music Maker Shield
  • Sunfounder PN532 NFC Reader
  • Adafruit Powerboost 1000c
  • 3W Speaker - Mine is quite big as can be seen in the pictures but of course you could use any speaker that fits you. Just make sure it can handle the 3 watts output of the Adafruit Music Maker Shield.
  • LiPo Battery - I have a very big battery and that is good, as it gives plenty of playback time.
  • 5 Push buttons - 4 to control the operation and one to program a new tag.
  • 3 LEDs - 1 operations light, 1 warning and 1 error light
  • 1 Potentiometer for volume control
  • Wires to connect everything together
  • Hot Glue to attach all the stuff in the box
  • Box - Mine is wooden but I also have a 3D model for a plastic box

Hardware layout

All components are of course put into a "little" box - mine is made of wood and I bought it from shelf. I dismantled the top lit and exchanged that with a plain plate of same size.

Speaker

The speaker is directed to the bottom but slightly above the bottom of the box - roughly a centimeter from it. I attached the speaker to a wooden square with a hole the size of the speaker, attached 4 pillars to it to raise this square from the box' bottom. I also created an opening in the bottom of the box and attached some fiber to shield the speaker. Finally I put 4 pillars to the bottom of the box to raise it from ground.

To be honest, this whole layout is a very unfortunate design choice, as the sound is not that strong and clear as it could be. If I'd had it directed to the front, of course the sound would have been stronger and possibly not as muffled, but I wanted to have the volume control (see below) to stick out of the front).

NFC Reader

The NFC Reader is attached to the underside of the top of the box and the top itself is fixed to the box via small nails. I also carved out an oblong opening in this top plate to make room for the 4 buttons. The buttons are again fixed to the top plate by means of a small piece of wood glued to the plate - see pictures here.

Adafruit Powerboost 1000c / LiPo Battery

The Adafruit Powerboost 1000c is glued to on side very low to the bottom of the box and the battery is standing upright in the front left corner. For this I had to create a small opening in the plate that supports the speaker.

Arduino / Music Maker Shield

Opposite the battery the Arduino UNO with attached Adafruit Music Maker Shield is glued to the box. This allows for a small opening on the back of the box. This opening can be used to retrieve and insert the SD card from / into the Music Maker Shield and it also gives access to the USB port for programming purposes of the Arduino - all this without the need to open the top plate of the box.

Buttons

The 4 buttons (see below) are on the top plate and the volume control pot is on the front.

Lights

Also on the front is the operations light, whereas the Error light (also used for LBO) is on the back. The warning LED is on the left side. You can see my design in the pictures.

Control Buttons

The Fairytale audiobook reader box design comes with 4 buttons to control operation:

  • pause / unpause - pauses the playback or unpauses a paused playback
  • next - play the next track in a consecutive list of ordered files
  • previous - play the previous track in a consecutive list of ordered files
  • light on / off - turn the operations light fader on or off

Additionally there is a programming button (A3 see below) included that will change the program in such a way that it will wait for a "new" tag, ask for a directory and track number to associate with this tag and will update the TrackDb accordingly. For this to work the box of course would need to be connected to the Arduino IDE and the serial console must be active. Functionality is not yet implemented)

All 4 control buttons are attached to only one analog pin (here A1). To distinguish which button was pressed, I made sure every button has a resistor with a different Ohm attached to it's input pin. I used:

  • 33 Ohm
  • 220 Ohm
  • 330 Ohm
  • 1 KOhm

Volume Control

A potentiometer connected to analog input pin A0 on the Arduino is used for volume control. While playing a track the program checks for changes on the potentiometer and calculates the corresponding volume from the level of the pot.

Used Pins of the Arduino UNO:

Quite a few, if not nearly all, of the pins of the Arduino are used up.

SPI

- 13 : CLK / PN532_SCK : SPI Clock shared with VS1053, SD card and NFC breakout board

- 12 : MISO / PN532_MISO : Input data from VS1053, SD card and NFC breakout board

- 11 : MOSI / PN532_MOSI : Output data to VS1053, SD card and NFC breakout board

VS1053 Music Maker Shield

- 7 : SHIELD_CS : VS1053 chip select pin (output)

- 6 : SHIELD_DCS : VS1053 Data/command select pin (output)

- 3 : DREQ : VS1053 Data request, ideally an Interrupt pin

SD Card

- 4 CARDCS : SD Card chip select pin

PN532 NFC Reader

- 10 : PN532_SS : NFC breakout board chip select pin

LEDs

- 5 : ledPin : the pin to which the operation led is connected to

- 8 : warnPin : the pin to which the warning led is connected to

- 9 errorPin : the pin to which the error led is connected to (e.g. used for LBO of powerboost 1000c)

Input Buttons etc.

- A0 : volumePotPin : the analog input pin that we use for the potentiometer

- A1 : btnLinePin : pin to which the button line (4 buttons) is connected to

- A2 : batLowInputPin : the pin on which the powerboost 1000c indicates a low battery (LBO) - ouput done via errorPin (not yet implemented)

- A3 : programming : the pin the program button is connected to (not yet implemented).

Putting all together

Power line duplicator

The Arduino has very limited power and ground output pins, so I decided to get +5V and +3V and Ground from the Adafruit Powerboost and have a little "power line duplicator" - This power line duplicator is essentially a little (3cm x 1,5cm) plate onto which a couple of male headers are attached which are connected to +5V, +3V and GND of the Powerboost - This gives me 5 pins for +5V, 5 pins for +3V and also 5 pins for Ground.

To this "power line duplicator" I attached all external components that needed plus voltage and ground - such as the PN532 NFC Reader breakout board or the power for the buttons and the volume control.

Buttons

I also had to restrict the number of input pins used by the buttons, as quite a lot of the digital or analog input pins of the Arduino are already used up.

I connected the 4 control buttons to only one analog input pin (here A1) and used different resistors to distinguish which button is pressed. I took the input power from the +5V line. The buttons output is also tied (via a 10KOhm resistor) to ground to keep it from floating.

The volume control potentiometer is attached to A0 and is also connected to ground via a 10KOhm resistor. It's input voltage is taken from the +5V line.

The programming button is attached to the +3V line and tied to A3 with it's second leg - no ground connection.

Low Battery Output

The Adafruit Powerboost 1000c comes with an LBO (Low Battery Output). This usually ties to the battery plus line but ties to ground once the battery reaches a level of roughly 3,4V. So I attached a wire to the LBO pin of the Powerboost and connected it to A2 plus ground (via a 100KOhm resistor)

ATTENTION: This is not yet operational!!!

Software Design / Operations

The Fairytale program will play albums (audiobooks or music) stored on the SD card inserted into the Adafruit Music Maker Shield. Selection of the album/audiobook to play is done by placing corresponding NFC Tags on the NFC Reader.

Track DB - connect NFC Tag to Audiobook

Upon detection of an NFC Tag, the program will retrieve the tag's UID and use this to scan what I call the TrackDB to find a matching directory to play.

The TrackDB is a list of files in a special directory (SYSTEM00) on the SD card. The TrackDB files are of the form:

taguid:directory:track number

e.g.:

46722634231761290:findorie:1

In the given example:

  • 46722634231761290 is the UID of the NFC Tag
  • findorie is the directory from which to play the files
  • 1 is the number of the track with which to start playback|

Playback

The program will take the retrieved information from the TrackDB and then start a for-loop beginning with the provided first track until all consecutive numbered tracks are played. After playback of all files is finished, the program will resume it's main loop, delay operation for roughly 15 seconds (to give the user the chance to remove the just used Tag from the reader) and then wait until it detects the next tag.

While advancing through the files in the directory, the program will update the TrackDB-File with the number of the currently played track. Doing so allows for interrupted playbacks - tag is removed and later put back on when the playback will start with the last track in playback.

Restrictions

For this to work, a couple of restrictions are in place:

1. All filenames must be in the format trackXXX.mp3 - where XXX is a numbering from 001 to 127

2. You can have a maximum of 127 files per directory - as I use a char to count the files to preserve memory

3. All directory names must be exactly 8 chars long - use any combination of a-z and 0-9 chars for the name

4. if a file is missing in a consecutive order of files in a directory, you may get a (very short) pause which might result in a glitch in the sound while the next track number is calculated

5. All directories must be directly in the root- directory of the SD card - no sub directories are allowed as I use a char array of 9 chars for the directory part of the path to the file.

Lights

While the album (or file) is played an operations light is fading up and down in intensity.

On warnings or errors a warning or error light is lit up respectively.

Errors and Warnings

There are 3 different warning or error conditions:

1. Missing or invalid information for playback warning

2. Low Battery warning

3. Missing or hardware failure error

Additionally we distinct warnings and errors for whether or not we need to turn off the box.

Errors

Errors shown via the error light (also cause the system to halt and the Box must be turned off):

  • Music Maker Shield not found
  • Music Maker shield not on an interrupt enabled pin
  • SD card not found
  • NFC Reader not found (currently no light effect implemented)

Warnings

Warnings shown via a light (Arduino can stay turned on):

  • no directory found for the NFC Tag (aka TrackDB is missing an entry for the Tag)
  • no directory found on the SD card that match the NFC Tag TrackDB record
  • no files in the provided directory
  • a missing file in a consecutive list of ordered files in the directory this may happen in case the files are not numerically ordered without a gap: track001.mp3 exist, track002.mp3 is missing but track003.mp3 exists again.

Additionally if the Adafruit Powerboost 1000c detects a low battery level (LBO of the Powerboost ties to ground) the error LED is shown. Surely the Arduino will turn off at some point from now, but until then it will continue to operate.

Voice feedback

Additionally to the warning or error lights certain messages are spoken through the music maker shield.

Voiced errors and warnings are:

  • Low Battery warning (only voiced if no album is playing)
  • No directory found for the NFC Tag (aka TrackDB is missing an entry for the Tag)
  • No directory found on the SD card that match the NFC Tag TrackDB record
  • No file(s) in the directory on the SD card
  • PN532 NFC Reader is malfunctioning.

Code

Fairytale2Arduino
Fairytale Main program
---------------------------------------------------------------------------------------
This programm will play albums (audiobooks or music) stored on the SD card inserted into
the Adafruit Music Maker Shield. Selection of the album/audiobook to play is done by
placing corresponding NFC Tags on the NFC Reader.

There are two pissibilities on how the connection between an NFC Tag and the corresponding
album on the SD card can be setup:
1. An NDEF Message written to the tag in the form of: en [directory name]
2. Via the so called TrackDB - txt-files for each album in the directory trackdb0


NDEF Implementation
---------------------------------------------------------------------------------------
This implementation is based on the Speedmaster PN532 and Don's NDEF Library. Upon
detection of an NFC Tag at the reader it will check if there is at least one NDEF Message
on the tag. This message must be of the form

en [directory name]

for example, the audiobook "Finding Nemo", stored in files in the directory

/findnemo

would have an NDEF message on the tag which reads as

en findnemo

There may also be a second NDEF message for the track to start playback with and this
would be in the form of

en 1

for the first track. To use this implementation you have to activate the configuration
option NFCNDEF below and you will have to write the NDEF Messages with the
directory name. This can bedone with the program staticNFCWriter.ino from this repository.

The downside of this implementation is it's lack for an usable update of the track to
start playback with - I simply could not get it to work. Secondly the implementation
lacks a reliable way of detecting the absence of a tag. Therefore the playback can only be
stopped by turning the box off. The third problem is with the used progmem. The two libraries
also consume way more progmem than the Adafruit PN532 library due to which I switched to:


TrackDB-Implementation:
---------------------------------------------------------------------------------------
Upon detection of an NFC Tag, the program will retrieve the tag's UID and use this to scan
what I call the TrackDB to find a matching directory to play.

The TrackDB is a list of files in a special directory (TRACKDB0) on the SD card. The TrackDB
files are named after the directory of the album and their respective content is of the form:

taguid:directory:track

For example, the audiobook "Finding Dorie" is stored in the directory

/findorie

on the SD Card. The corresponding TrackDB file is stored at

/trackdb0/findorie.txt

It contains exactly one line:

46722634231761290:findorie:1

This line connects the Tag UID with the aformentioned directory plus the number of the track
with which to start playback:

46722634231761290 the UID of the NFC Tag
findorie the directory from which to play the files
1 the number of the track with which to start playback - here the 1st

To use this implementation you need to activate the configuration NFCTRACKDB
You will also need to create the necessary TrackDb files. This can be done with the program
createTrackDb.ino from this repository.


Playback and controls
---------------------------------------------------------------------------------------
Regardless of the way the program retrieved the information on which directory to play
(NDEF message or TrackDB), it will store this in the global var plrCurrentFolder and then
start a for-loop beginning with the provided first track until all consecutive numbered
tracks are played - for this it counts the number of files in the given dierctory.

While the album (or file) is played an operations light is fading up and down in intensity.

After playback of all files is finished, the program will resume it's main loop, delay
operation for roughly 15 seconds (to give the user the chance to remove the just used Tag
from the reader) and then wait until it detects the next tag.

While advancing through the files in the directory, the program will update the TrackDB-File
with the number of the currently played track. Doing so allows for interrupted playbacks -
tag is removed and later put back on when the playback will start with the last track in
playback.


Restrictions
---------------------------------------------------------------------------------------
For this to work, a couple of restrictions are in place:
1. All filenames must be in the format trackXXX.mp3, where XXX is a numbering from 001 to 127
2. Follows from 1: You can have a maximum of 127 files per directory. I use a char to count the
files in a directory to preserve memory and need the ability to return -1 in case of an error
3. All directory names must be exactly 8 chars long. You may use any combination of a-z
and 0-9 chars for the directory name though
4. if a file is missing in a consecutive order, you may get a glitch in the sound
5. As the Adafruit Music Maker Shield library does not support to jump to a specific
position within a file, the box can always only start from the beginning of a track.


Warnings and errors
---------------------------------------------------------------------------------------
On warnings or errors a warning or error light is lit up respectively. There are 3
different warning or error conditions:
1) Missing information for playback warning
2) Low Battery warning
2) Missing hardware error

Errors shown via the error light (also cause the system to halt):
- Music Maker Shield not found
- Music Maker shield not on an interrupt enabled pin
- SD card not found
- NFC Reader not found

Warnings shown via a light (Arduino can stay turned on):
- Low battery warning (surely the arduino will turn off but until then it will operate)
- no directory found for the NFC Tag (aka TrackDB is missing an entry for the Tag)
- no directory found on the SD card that match the NFC Tag TrackDB record
- no files in the provided directory
- a missing file in a consecutive list of ordered files in the directory
this may happen in case the files are not numerically ordered without a gap:
track001.mp3 exist, track002.mp3 is missing but track003.mp3 exists again

Additionally to the warning or error lights certain messages are spoken through the music .
maker shield. Voiced errors and warnings are:
- Low Battery warning
- no directory found for the NFC Tag (aka TrackDB is missing an entry for the Tag)
- no directory found on the SD card that match the NFC Tag TrackDB record
- no file(s) in the directory on the SD card


Controls
---------------------------------------------------------------------------------------
4 buttons are included:
- Previous Track - play the previous track in a consecurtive list of ordered files
- Next Track - play the next track in a consecurtive list of ordered files
- Pause / Resume - pauses the playback or unpauses a paused playback
- Light on / off - turn the operations light fader on or off


The box is capable of being controlled by a remote control with the following functions
- Volume Up - increase volume by 5 per click
- Volume Down - decrease volume by 5 per click
- Previous Track - play the previous track in a consecurtive list of ordered files
- Next Track - play the next track in a consecurtive list of ordered files
- Pause / Resume - pauses the playback or unpauses a paused playback
- Light on / off - turn the operations light fader on or off


Used Pins:
---------------------------------------------------------------------------------------
NAME PIN USAGE
- CLK / PN532_SCK 13 SPI Clock shared with VS1053, SD card and NFC breakout board
- MISO / PN532_MISO 12 Input data from VS1053, SD card and NFC breakout board
- MOSI / PN532_MOSI 11 Output data to VS1053, SD card and NFC breakout board

- SHIELD_CS 7 VS1053 chip select pin (output)
- SHIELD_DCS 6 VS1053 Data/command select pin (output)
- DREQ 3 VS1053 Data request, ideally an Interrupt pin

- CARDCS 4 SD Card chip select pin

- PN532_SS 10 NFC breakout board chip select pin

- infoLedPin 5 the pin to which the operation led is connected to
- warnLedPin 8 the pin to which the warning led is connected to
- errorLedPin 9 the pin to which the error led is connected to
e.g. used for LBO of powerboost 1000c


- volPotPin A0 the analog input pin that we use for the potentiometer
- btnLinePin A1 pin to which the button line (4 buttons) is connected to
- batLowPin A2 the pin on which the powerboost 1000c indicates a low baterry
- iRRemotePin A3 the pin on which the IR Remote Receiver is connected to
- programming A4 the pin the program button is connected to. The program
button changes the functionality of the overall program in
that (if pressed) the code will register a new tag for use with
an album directory currently not connected to a tag
Functionality yet to come!


Configuration
---------------------------------------------------------------------------------------
Some features (as e.g. Remote Control, Buttons or operation LED etc.) can be turned off
or on via #define switches in the code below.

#define IRREMOTE enables the IR Remote Control option

#define BUTTONS enables the 4 control buttons

#define VOLUMEPOT enables the volume potentiometer

#define LOWBAT enables the low battery warning with light and voice

#define OPRLIGHT enables the operations light on the front of the box

#define OPRLIGHTTIME enables time based operations light - turns off the light after 30 Minutes

#define NFCNDEF enables the use of NDEF messages to get the directory for a tag

#define NFCTRACKDB enables the use of the TrackDB to get the directiry for a tag

#define RESUMELAST enables the option to resume last played album upon startup.
This is achieved via a file in the TrackDB and works without
a tag but uses the pause/resume button instead
Fairytale Main program
   ---------------------------------------------------------------------------------------
   This programm will play albums (audiobooks or music) stored on the SD card inserted into
   the Adafruit Music Maker Shield. Selection of the album/audiobook to play is done by 
   placing corresponding NFC Tags on the NFC Reader.

   There are two pissibilities on how the connection between an NFC Tag and the corresponding 
   album on the SD card can be setup:
   1. An NDEF Message written to the tag in the form of:  en [directory name]
   2. Via the so called TrackDB - txt-files for each album in the directory trackdb0

   
   NDEF Implementation
   ---------------------------------------------------------------------------------------
   This implementation is based on the Speedmaster PN532 and Don's NDEF Library. Upon 
   detection of an NFC Tag at the reader it will check if there is at least one NDEF Message 
   on the tag. This message must be of the form 

      en [directory name]

   for example, the audiobook "Finding Nemo", stored in files in the directory
   
      /findnemo
      
   would have an NDEF message on the tag which reads as

      en findnemo
   
   There may also be a second NDEF message for the track to start playback with and this 
   would be in the form of

      en 1

   for the first track. To use this implementation you have to activate the configuration 
   option     NFCNDEF     below and you will have to write the NDEF Messages with the 
   directory name. This can bedone with the program staticNFCWriter.ino from this repository.
   
   The downside of this implementation is it's lack for an usable update of the track to 
   start playback with - I simply could not get it to work. Secondly the implementation
   lacks a reliable way of detecting the absence of a tag. Therefore the playback can only be 
   stopped by turning the box off. The third problem is with the used progmem. The two libraries 
   also consume way more progmem than the Adafruit PN532 library due to which I switched to:
   
   
   TrackDB-Implementation:
   ---------------------------------------------------------------------------------------
   Upon detection of an NFC Tag, the program will retrieve the tag's UID and use this to scan 
   what I call the TrackDB to find a matching directory to play.
   
   The TrackDB is a list of files in a special directory (TRACKDB0) on the SD card. The TrackDB
   files are named after the directory of the album and their respective content is of the form:
   
      taguid:directory:track
   
   For example, the audiobook "Finding Dorie" is stored in the directory    
   
      /findorie
      
   on the SD Card. The corresponding TrackDB file is stored at
      
      /trackdb0/findorie.txt

   It contains exactly one line:

      46722634231761290:findorie:1

   This line connects the Tag UID with the aformentioned directory plus the number of the track
   with which to start playback:
   
      46722634231761290   the UID of the NFC Tag
      findorie            the directory from which to play the files
      1                   the number of the track with which to start playback - here the 1st 

   To use this implementation you need to activate the configuration   NFCTRACKDB   
   You will also need to create the necessary TrackDb files. This can be done with the program
   createTrackDb.ino from this repository.
   
   
   Playback and controls
   ---------------------------------------------------------------------------------------
   Regardless of the way the program retrieved the information on which directory to play 
   (NDEF message or TrackDB), it will store this in the global var plrCurrentFolder and then 
   start a for-loop beginning with the provided first track until all consecutive numbered 
   tracks are played - for this it counts the number of files in the given dierctory. 
   
   While the album (or file) is played an operations light is fading up and down in intensity. 
   
   After playback of all files is finished, the program will resume it's main loop, delay 
   operation for roughly 15 seconds (to give the user the chance to remove the just used Tag 
   from the reader) and then wait until it detects the next tag.
   
   While advancing through the files in the directory, the program will update the TrackDB-File 
   with  the number of the currently played track. Doing so allows for interrupted playbacks - 
   tag is removed and later put back on when the playback will start with the last track in 
   playback. 
   
   
   Restrictions
   ---------------------------------------------------------------------------------------
   For this to work, a couple of restrictions are in place:
   1. All filenames must be in the format  trackXXX.mp3, where XXX is a numbering from 001 to 127
   2. Follows from 1: You can have a maximum of 127 files per directory. I use a char to count the
      files in a directory to preserve memory and need the ability to return -1 in case of an error
   3. All directory names must be exactly 8 chars long. You may use any combination of a-z 
      and 0-9 chars for the directory name though
   4. if a file is missing in a consecutive order, you may get a glitch in the sound 
   5. As the Adafruit Music Maker Shield library does not support to jump to a specific 
      position within a file, the box can always only start from the beginning of a track.
   
   
   Warnings and errors
   ---------------------------------------------------------------------------------------
   On warnings or errors a warning or error light is lit up respectively. There are 3 
   different warning or error conditions:
   1) Missing information for playback warning
   2) Low Battery warning
   2) Missing hardware error
   
   Errors shown via the error light (also cause the system to halt):
   - Music Maker Shield not found
   - Music Maker shield not on an interrupt enabled pin
   - SD card not found
   - NFC Reader not found

   Warnings shown via a light (Arduino can stay turned on):
   - Low battery warning (surely the arduino will turn off but until then it will operate)
   - no directory found for the NFC Tag (aka TrackDB is missing an entry for the Tag)
   - no directory found on the SD card that match the NFC Tag TrackDB record
   - no files in the provided directory
   - a missing file in a consecutive list of ordered files in the directory
     this may happen in case the files are not numerically ordered without a gap: 
     track001.mp3 exist, track002.mp3 is missing but track003.mp3 exists again

   Additionally to the warning or error lights certain messages are spoken through the music . 
   maker shield. Voiced errors and warnings are:
   - Low Battery warning
   - no directory found for the NFC Tag (aka TrackDB is missing an entry for the Tag)
   - no directory found on the SD card that match the NFC Tag TrackDB record
   - no file(s) in the directory on the SD card


   Controls
   ---------------------------------------------------------------------------------------
   4 buttons are included:
   - Previous Track       - play the previous track in a consecurtive list of ordered files
   - Next Track           - play the next track in a consecurtive list of ordered files
   - Pause / Resume       - pauses the playback or unpauses a paused playback
   - Light on / off       - turn the operations light fader on or off

   
   The box is capable of being controlled by a remote control with the following functions
   - Volume Up            - increase volume by 5 per click
   - Volume Down          - decrease volume by 5 per click
   - Previous Track       - play the previous track in a consecurtive list of ordered files
   - Next Track           - play the next track in a consecurtive list of ordered files
   - Pause / Resume       - pauses the playback or unpauses a paused playback
   - Light on / off       - turn the operations light fader on or off
   
    
   Used Pins:
   ---------------------------------------------------------------------------------------
     NAME             PIN  USAGE
   - CLK / PN532_SCK   13  SPI Clock shared with VS1053, SD card and NFC breakout board 
   - MISO / PN532_MISO 12  Input data from VS1053, SD card and NFC breakout board 
   - MOSI / PN532_MOSI 11  Output data to VS1053, SD card and NFC breakout board 
   
   - SHIELD_CS          7  VS1053 chip select pin (output)
   - SHIELD_DCS         6  VS1053 Data/command select pin (output)
   - DREQ               3  VS1053 Data request, ideally an Interrupt pin
    
   - CARDCS             4  SD Card chip select pin
    
   - PN532_SS          10  NFC breakout board chip select pin

   - infoLedPin         5  the pin to which the operation led is connected to
   - warnLedPin         8  the pin to which the warning led is connected to
   - errorLedPin        9  the pin to which the error led is connected to 
                           e.g. used for LBO of powerboost 1000c
    

   - volPotPin         A0  the analog input pin that we use for the potentiometer
   - btnLinePin        A1  pin to which the button line (4 buttons) is connected to
   - batLowPin         A2  the pin on which the powerboost 1000c indicates a low baterry 
   - iRRemotePin       A3  the pin on which the IR Remote Receiver is connected to
   - programming       A4  the pin the program button is connected to. The program 
                           button changes the functionality of the overall program in 
                           that (if pressed) the code will register a new tag for use with 
                           an album directory currently not connected to a tag 
                           Functionality yet to come!
   
   
   Configuration
   ---------------------------------------------------------------------------------------
   Some features (as e.g. Remote Control, Buttons or operation LED etc.) can be turned off 
   or on via #define switches in the code below.
   
      #define IRREMOTE     enables the IR Remote Control option
      
      #define BUTTONS      enables the 4 control buttons
      
      #define VOLUMEPOT    enables the volume potentiometer
      
      #define LOWBAT       enables the low battery warning with light and voice

      #define OPRLIGHT     enables the operations light on the front of the box
      
      #define OPRLIGHTTIME enables time based operations light - turns off the light after 30 Minutes

      #define NFCNDEF      enables the use of NDEF messages to get the directory for a tag
      
      #define NFCTRACKDB   enables the use of the TrackDB to get the directiry for a tag

      #define RESUMELAST   enables the option to resume last played album upon startup.
                           This is achieved via a file in the TrackDB and works without 
                           a tag but uses the pause/resume button instead 

Custom parts and enclosures

This is the main body cube in which all components reside
Top Plate
This is the top plate onto which NFC tags attached to figures can be laid and under which the NFC board is attached
Buttons
The 5 buttons that come in the front of the cube
Buttons holder
This is the button holder that is glued in the inside of the cube to hold the buttons in place
Rubber inlets
Used to close the outlets in the cube

Comments

Similar projects you might like

Minimal MIDI Drum Kit with 3D Printer

Project tutorial by ryokosaka

  • 9,882 views
  • 1 comment
  • 29 respects

Arduino Piano

Project in progress by Teo Zhi Yi

  • 2,570 views
  • 0 comments
  • 7 respects

Arduino101 / tinyTILE BLE: Match-Making Sunglasses

Project tutorial by Kitty Yeung

  • 11,336 views
  • 2 comments
  • 35 respects

Dual Axis Solar Tracker Panel with Auto and Manual Mode

Project tutorial by Giannis Arvanitakis

  • 7,206 views
  • 6 comments
  • 35 respects

The Light Box

Project tutorial by

  • 4,015 views
  • 2 comments
  • 20 respects

Circuito Arduino Controller Pad

Project tutorial by AhmedAzouz

  • 3,158 views
  • 1 comment
  • 9 respects
Add projectSign up / Login