Git Product home page Git Product logo

arduino-stoerbert's Introduction

Intro

This repository contains the files required to build an easy to use MP3 player for small children. This project is heavily inspired by Hoerbert.

PCB CAD Inside Inside

Main components required to build:

  • Arduino Uno
  • Adafruit Music Maker shield
  • Speaker
  • Button PCB (see below)
  • Volume Pot
  • On/Off switch
  • Battery holders
  • Hookup wire

Button PCB schematics

I created a custom PCB for the input buttons. The schematics for that are in the cad directory in KiCad format. The Arduino UNO does not have enough GPIO pins for the Music Maker shield, the volume pot, and 12 buttons. To reduce the amount of GPIO pins required for the buttons I used 2 shift registers. That reduces the amount of required pins for the buttons to 3.

I used the following components:

PCB CAD PCB Pinout PCB etched PCB populated

If you want to etch the PCB yourself you can print this PDF on a transparency. Make sure to use US letter sized transparencies if you use the PDF below. Alternatively you can just create a new PDF from the KiCad layout.

PCB transparency

I followed this PCB etching process

Button layout

Regular mode

[album 1]   [album 2]       [album 3]
[album 4]   [album 5]       [album 6]
[album 7]   [album 8]       [album 9]
[prev]      [play_pause]    [next]

God mode

[1]         [2]             [3]
[4]         [5]             [6]
[7]         [8]             [9]
[0]         [play_pause]    [next]

God mode

The player supports 2 different modes. Regular mode and god mode. In regular mode one album is assigned to each button. This is the default mode and what the device is mainly intended for. To add more functionality, god mode has been added. This mode allows to add an alternative set of albums which makes it a handy MP3 player for parents as well. In that mode instead of directly playing an album for each button press, the buttons act as numerical input buttons. 2 buttons have to be pressed to select an album. I.e. 4 - 2 to select album 42. Up to 99 albums are supported in god mode.

To enter god mode the god mode sequence has to be pressed. The god mode sequence is: prev - play_pause - play_ pause - next (regular mode keyboard layout). The same sequence can be used to switch back to regular mode. When the sequence has been entered correctly a short beep will sound.

SD card

Structure

The SD card needs to be formated with FAT32.

The root folder structure needs to be:

k01 ... k09 for the regular albums and

g01 ... g99 for the god mode albums

The files in each folder need to be named:

01.mp3 ... 99.mp3

i.e.

/k06/01.mp3
/k06/02.mp3
/k06/03.mp3
/k06/04.mp3
/k06/05.mp3
/k06/06.mp3

Convert files to supported file format

a=`find ./ -type f -name "*.mp3" | awk '{print "mv", "\""$0"\"", substr($0, 3, 2)".mp3;"}'`; eval $a

This only works if the files are named with the first 2 digits indicating their track name already. I.e. 01-meshuggah-bleed.mp3. A great alternative for batch renaming the files is Mp3Tag.

Auto resume

The player will automatically resume the last played track after power off (if powered off before an album finished playing).

Power saving

To remind the user to turn of the device once the album has finished playing the player will sound a short beep every 5 minutes once the last album has played.

Mono mode

To keep the player compact and reduce power consumption this has been designed to work with a single speaker. The Music Maker shield is configured to work in mono mode. You can connect your speaker to either of the 2 speaker ports. In case you want to build a stereo version you can simply remove these lines from player.cpp

// Enable mono mode
vs1053.sciWrite(VS1053_REG_WRAMADDR, 0x1e09);
vs1053.sciWrite(VS1053_REG_WRAM, 0x0001);

Case build

I added an album of the full build on Imgur

arduino-stoerbert's People

Contributors

michaelthessel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

arduino-stoerbert's Issues

Compile errors

When trying to compile the sketch, the following warnings come up (full file path edited to protect privacy):


sketch\player.cpp:89:35: warning: invalid conversion from 'void*' to 'char*' [-fpermissive]

         p.album[sequence] = malloc(strlen(entry.name()) + 1);

                             ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~

sketch\player.cpp: In function 'void powerReminder()':

sketch\player.cpp:235:39: warning: large integer implicitly truncated to unsigned type [-Woverflow]

         musicPlayer.sineTest(1000, 500);

                                       ^

sketch\player.cpp: In function 'void setupPlayer()':

sketch\player.cpp:410:63: warning: invalid conversion from 'const short unsigned int*' to 'const uint16_t* {aka const unsigned int*}' [-fpermissive]

     vs1053.applyPatch(plugin, sizeof(plugin)/sizeof(plugin[0]));

                                                               ^

In file included from sketch\player.cpp:4:0:

x:\path\to\Adafruit_VS1053_Library/Adafruit_VS1053.h:132:8: note:   initializing argument 1 of 'void Adafruit_VS1053::applyPatch(const uint16_t*, uint16_t)'

   void applyPatch(const uint16_t *patch, uint16_t patchsize);

        ^~~~~~~~~~

Compilation appears to complete despite these warnings, and upload to Arduino Uno proceeds as expected.

Bootloop trying to run compiled sketch

When the sketch is compiled and uploaded, this is the output from the Serial Monitor:

Loaded album from EEPROM: ⸮⸮⸮
Loaded track from EEPROM: 255
Resuming playback
Loading files from directory: /⸮⸮⸮/
File ⸮VS1053 found
Loaded album from EEPROM: ⸮⸮⸮
Loaded track from EEPROM: 255
Resuming playback
Loading files from directory: /⸮⸮⸮/
File ⸮VS1053 found
Loaded album from EEPROM: ⸮⸮⸮
Loaded track from EEPROM: 255
Resuming playback

Music never starts playing. It appears to just reboot forever. The 2GB micro SD card is formatted FAT32 and has directories 1 through 9, each one containing files 01.mp3 through 05.mp3. I also tried naming the directories k01 through k09 as specified in readme.MD without success, though the code in player.cpp seems to imply that the directory naming should actually be 1 through 9 (without k0 in front). The Music Maker shield functions fine and plays music from the same SD card when using the player_simple and player_interrupts example sketches.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.