Skip to content

id-studiolab/DFPlayer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

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 Pin CircuitPython Pin Description
VCC 3.3V or 5V Power (Check module specs)
RX TX (e.g., GP0) UART Transmit from board
TX RX (e.g., GP1) UART Receive to board
GND GND Common Ground

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

Quick Start

import board
import busio
from DFPlayer import DFPlayer

# Initialize UART
uart = busio.UART(board.GP0, board.GP1, baudrate=9600, timeout=0.1)

# Initialize DFPlayer
df = DFPlayer(uart, volume=15)

# Play the first track
df.play_track(1)

# Next track
df.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 5
df.play_folder(1, 5)

Querying Status

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

License

MIT License

About

CircuitPython library for the DFPlayer

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages