# DFPlayer Motherboard for Atopile

A compact, SMD-based motherboard for the popular [DFPlayer Mini](https://www.dfrobot.com/wiki/index.php/DFPlayer_Mini_SKU:DFR0299) MP3 module, designed using the atopile hardware description language.

This board serves as a carrier for the DFPlayer, providing stable power, protection, and convenient interfaces for input and output. It is designed to be easily integrated into larger audio projects.

<p>
  <img src="media/pcb_layout.png" height="400" style="display:inline-block; margin-right:10px;" />
  <img src="media/3d_model.png" height="400" style="display:inline-block;" />
</p>

## Features

*   **Power Supply:** On-board diode is used to drop the input voltage to a DFPlayer-safe ~4.3V. Tantalum capacitors are included for power supply filtering, ensuring smooth operation.
*   **All SMD Components:** Designed for a low-profile, surface-mount assembly, making it suitable for compact enclosures.
*   **Simple Interfaces:** Utilizes standard (JST and 3.5mm Jack) connectors for power, data input, speaker output, and stereo line-level output.
*   **Compact Design:** A small footprint carrier board for the 2x8 pin DFPlayer Mini module.

## Interfaces

### Input

*   **Connector:** 4-pin JST PH 2.0mm
*   **Signals:**
    *   `+5V`: Power input
    *   `GND`: Ground
    *   `TX`: Serial Transmit (connects to DFPlayer RX) protected by the 1kΩ resistor
    *   `RX`: Serial Receive (connects to DFPlayer TX) 
*   **Description:** This interface provides both power and UART serial communication to the DFPlayer module. It is important to note that the DFPlayer's RX pin is not 5V tolerant, so a 1kΩ series resistor is included on the board for protection.

### Outputs

#### 1. Speaker (Mono)

*   **Connector:** 2-pin JST PH 2.0mm
*   **Signals:**
    *   `SPK+`
    *   `SPK-`
*   **Description:** A direct, amplified mono output for a small speaker (up to 3W). This connects directly to the `SPK1` and `SPK2` pins of the DFPlayer.

#### 2. Stereo Line Out

*   **Connector:** 3.5mm Stereo Audio Jack (SMD)
*   **Signals:**
    *   `L`: Left Audio Channel
    *   `R`: Right Audio Channel
    *   `GND`: Ground
*   **Description:** A line-level stereo output suitable for headphones, external amplifiers, or other audio equipment. This connects to the `DAC_R`, `DAC_L`, and `GND` pins of the DFPlayer.

## Power Supply Circuit

The motherboard is designed to be powered by a standard +5V source. To ensure the DFPlayer module receives a safe operating voltage (typically 3.2V to 5.0V, with 4.2V being ideal), the following components are included:

*   **Voltage Drop Diode:** A standard silicon diode (e.g., a 1N4001 SMD equivalent) is placed in series with the power input. This provides a forward voltage drop of approximately 0.7V, effectively reducing the 5V input to a safer ~4.3V for the DFPlayer.
*   **Filtering Capacitor:** Tantalum capacitors (e.g., 100µF, 6,3V) is placed across the DFPlayer's power pins (`VCC` and `GND`). This smooths the power supply and filters out noise, which is crucial for clean audio playback.

## Mechanical Design

*   **Mounting Holes:** The board includes four mounting holes, one in each corner.
*   **Hole Diameter:** 2,2mm, providing clearance for standard M2 screws.
*   **Compatibility:** Designed for use with M2 nylon or brass standoffs for easy mounting.

## Bill of Materials

| Component                            | Qty | Type                                           | LCSC Part #                |
| ------------------------------------ | --- | --------------------------------------------   | -------------------------- |
| Female 8-Pin Header                  | 2   | PinSocket 1x08 2.54mm Vertical                 | C48641756                  |
| Diode                                | 1   | A7                                             | C18199093                  |
| Capacitor                            | 5   | Tantalum 100uF 6.3V                            | C178529                    |
| UART Connector                       | 1   | JST PH 1x04 2.00mm Vertical                    | C160354                    |
| Speaker Connector                    | 1   | JST PH 1x02 2.00mm Vertical                    | C265003                    |
| Audio Jack                           | 1   | Jack 3,5mm Horizontal                          | C22459515                  |
| Resistor                             | 1   | 1kΩ, 0805                                      | C17513                     |

## Assembly

This project is intended to be built with surface-mount components. A soldering iron with a fine tip, solder paste, and a hot air rework station are the recommended tools for a clean assembly.

## How to Use

1.  **Prepare an SD Card:** Format a microSD card (up to 32GB) to FAT16 or FAT32. Copy your MP3 or WAV files onto the card.
2.  **Insert SD Card:** Place the microSD card into the DFPlayer module's slot.
3.  **Connect DFPlayer:** Carefully plug the DFPlayer Mini module into the female socket headers on the motherboard. Ensure the orientation is correct.
4.  **Connect Interfaces:**
    *   Plug in your +5V power source and UART controller (like an Arduino or FTDI adapter) to the 4-pin JST connector.
    *   Connect a speaker (e.g., 8Ω, 1W) to the 2-pin JST connector.
    *   (Optional) Connect headphones or an amplifier to the 3.5mm audio jack.
5.  **Power On:** Apply power to the board and begin sending serial commands to control the DFPlayer.

