Skip to content

Latest commit

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

DFPlayer CircuitPython Driver

A lightweight and robust CircuitPython driver library for the DFPlayer-Mini and MP3-TF-16P v3.0 MP3 modules. This library is specifically optimized for stability with newer HW-247A and GT3200B (v3.0) chips, implementing necessary command delays and checksum verification.

Features

  • Broad Compatibility: Works with DFPlayer-Mini, MP3-TF-16P, and clones.
  • Optimized for v3.0: Handles the timing sensitivities of newer hardware versions.
  • Full API Support: Playback control, volume management, EQ settings, and folder navigation.
  • Debugging Support: Optional verbose logging for troubleshooting communication.
  • Checksum Verification: Ensures data integrity for all UART packets.

Installation

  1. Ensure your CircuitPython board is set up and connected.
  2. Copy the lib/DFPlayer.py file to the lib/ folder on your CIRCUITPY drive.

Wiring

DFPlayer PinCircuitPython PinDescription
VCC3.3V or 5VPower (Check module specs)
RXTX (e.g., GP0)UART Transmit from board
TXRX (e.g., GP1)UART Receive to board
GNDGNDCommon Ground

Note: A 1kΩ resistor is recommended on the RX pin of the DFPlayer when using 5V logic to reduce noise.

Quick Start

importboardimportbusiofromDFPlayerimportDFPlayer# Initialize UARTuart=busio.UART(board.GP0, board.GP1, baudrate=9600, timeout=0.1)
# Initialize DFPlayerdf=DFPlayer(uart, volume=15)
# Play the first trackdf.play_track(1)
# Next trackdf.next()

Advanced Usage

Folder Playback

Organize your SD card with folders named 01, 02, etc., and files named 001.mp3, 002.mp3.

# Play folder 1, track 5df.play_folder(1, 5)

Querying Status

status=df.query_status()
volume=df.query_volume()

License

MIT License

About

CircuitPython library for the DFPlayer

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages