Dfplayer Micropython library

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
Post Reply
cefn
Posts: 230
Joined: Tue Aug 09, 2016 10:58 am

Dfplayer Micropython library

Post by cefn » Mon Jul 10, 2017 5:43 pm

Just a note that I've put together a moderately-tested library for using the DFPlayer Mini MP3 Player module, using the secondary UART in transmit-only mode. You can see the library at https://github.com/ShrimpingIt/micropython-dfplayer

The library has some smarts around anticipated delays in various serial-triggered operations, but might make things clunky and troublesome until the details of those delays (and why they are needed) are worked out.

There is also a ScanPlayer class which, (based on some strong assumptions about file structure and file length), attempts to play files and detect if they are playing via a busy signal sent from the DFPlayer. This allows a simple map to be constructed of the available files on the SD Card filesystem.

This goes some way to making the content user-authorable without requiring query-logic over Serial RX and without changing code to match the content. It is a feature I am using for a donations box commission, allowing the host organisation to update the coin-triggered audio by just editing the SD card ( http://www.moremusic.org.uk/user_upload ... brief.docx ) .

Just a reference working version of how to use a DFPlayer module and will work for most basic jobs though not tested with full coverage, yet.

Post Reply