|Fabian Schlenz fa208858d9||7 months ago|
|bin||7 months ago|
|include||7 months ago|
|lib||7 months ago|
|src||7 months ago|
|test||11 months ago|
|.gitignore||7 months ago|
|.travis.yml||11 months ago|
|DEPLOY.md||7 months ago|
|README.md||7 months ago|
|build_version.sh||7 months ago|
|deploy.sh||7 months ago|
|partitions.csv||7 months ago|
|platformio.ini||7 months ago|
Please note: This list is a "things I used", neither "these are the best things for this stuff" nor "you can only use these things". But please be aware that using other stuff may lead to you having to make more or less easy modifications.
Prizes are more or less the cheapest I could find on Aliexpress.
|What?||For what?||Price (approx)|
|WS1053B on a PCB with SD card slot||Play the MP3 files; provide an SD card slot||5€|
|5V Amplifier(s) (e.g. 2x PAM-8302)||Single-channel Amplifier||2€|
|Speaker(s) matching your amp (e.g. 2pcs 4 Ohm 5W)||Enabling you to hear the sounds||4€|
|RFID tags (ISO14443A) - e.g. 10 cards||You can also get Keyfobs or stickers||4€|
|4 buttons||Prev/Next track, Volume up/down||1€|
You'all also need an SD card, some breadboard(s), jumper cables and a soldering iron. Also, some kind of box for the finished player.
Schematics coming soon...ish...
Format your SD card with FAT32 and put files on it: Every album has to go into its own folder in the root of the SD card. Folders and files should not contain special characters (meaning stuff like äöüß). Spaces and dashes an alike are okay. Put the SD card into the SD card slot.
include/config.h. Modify it to at
least contain the correct login details for your WiFi.
The code then should compile in PlatformIO without errors. Upload it to your ESP32. After that, upload static files using PlatformIO's task "Upload file system image".
The serial console in PlatformIO should give you more or less useful messages about what's going on. There will also be a line saying "WiFi connected. IP address: xxx.xxx.xxx.xxx" when the connection to your WiFi succeeded.
In your browser, enter "http://xxx.xxx.xxx.xxx/" (using the IP address) from above. From there you can define mappings between RFID tag IDs and folders on the SD card.
To create a new mapping between an RFID tag and an folder, you can use the web interface. Click the button with the cogs icon. After putting your rfid tag on the reader (and possibly removing it again), its ID will be shown in the dialog. Click the button with the arrows behind the ID to start the mapping mode.
The dialog showing all folders with media files will be shown. Click the button with the arrows behind the correct folder, to create the mapping.
Mapping are stored on the SD card in the file
mapping goes on its own line. Lines should be separated by \n (Unix-
style line endings); the last line should also end with a newline.
Format of a line is
<RFID id>=<folder>. RFID id is the UID of an
RFID tag, expressed as 8 lowercase characters with leading 0 (if
necessary). Folder is the foldername to play; starting with a slash and
ending without one.
_mapping.txt could look like this:
1a2b3c4d=/Christmas Music Vol. 17 003aab7f=/Let it go b691a22c=/Frozen Audiobook 22cb6ae9=/Let it go
(Yes, more than one tag can map to a folder.)
Buttons pull to GND if pushed -> Internal Pull-Up needed!
The mapping of rfid tags to files uses the ID of the
tag. A file called
_mapping.txt in the root folder of
the SD card defines the mappings between RFID tag ids and
folders to play.
The easiest way to create this file is to use the mapping functionality of the webinterface.
You can also save data on the tags to further manipulate the system. Position of the data is irrelevant, the whole tag will be searched.
[random] will play the files in a random order.
[random:2] will randomize everything except the first 2
files. This can be useful for having the favorite song of
your kids playing, but after that getting a bit of randomness.
[lock] will turn this key into a key for the locking
mode. Scanning the tag enables locking mode. The next album
started will keep running until the end. Removing the tag
will be deactivated, as are the buttons for prev and next
track. You can disable locking mode by again scanning the
lock tag again.
[advent] is used for christmas time. An album with this tag
will only play in December. On December 1st, only track 1
will play. On December 2nd, track 2 followed by track 1. On
December 3rd, tracks 3, 1 and 2. From December 24th on, track
24 followed by tracks 1-23. So your kid will get the "daily track"
first, followed by all previous tags in the right order.
You can send commands to ESMP3 using three different ways:
http://<IP>/cmd, having the command in the variable
Supported commands are:
| Command | Action |
play <PATH> | Starts playing the given path. Path may be a path on the
sd card or a http(s) URL of a webstream (direct links to mp3/4/ogg streams,
PLS files, M3U files or podcast XML feeds are supported). |
play | Continues playing the previously played thing. |
stop | Stops playing. |
volume=<X> | Sets the volume to X (0-255). |
track_prev | Starts the previous track, if available. |
track_next | Starts the next track, if available. |
track=<X> | Starts playing track no. X of the currently playing album. |
reset_vs1053 | Resets the VS1053 audio chip. |
reboot | Reboots ESMP3. |
add_mapping=<ID>=<PATH> | Adds a mapping between RFID card and path
play for valid path formats. |
update | Runs an update check. |
debug=<0|1> | Enables / disables debug messages. This value is persisted across reboots. |
trace=<0|1> | Enables / disables tracing messages. This value is also persisted across reboots. |