0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Dfplayer miniで音楽再生

Last updated at Posted at 2025-05-11

Dfplayer miniで音楽再生

苦戦した原因

  • ネットでは🔧 抵抗1kΩ×2(または1kΩ + 2kΩ)を使う理由
    ✅ 目的:5V → 3.3V に電圧を分圧するため
    DFPlayer Mini の RX(受信ピン)は3.3Vレベルの入力を想定しているため、Arduino(5V)から直接信号を送ると、ピンが破損するリスクがあります。過電流になる恐れがあるという内容が強調されているものが何個かあったので慎重に使っていましたが、それが原因で動かなかった可能性が高いです。

今回上手くいったものはネットで参考にしたものから抵抗を取り除いて作成してようやく動きました。

  • 🔧 DFPlayer Mini:5V超えの扱い
    ✅ 正常な動作範囲
    動作電圧:3.2V ~ 5.0V
    推奨電圧:5.0V ±5%(= 約4.75V〜5.25V)

❌ 5Vを大きく超えると?
内部IC(特にオーディオアンプやMP3デコーダ)が破損する可能性あり
定格を超えると過電流(焼損)や熱暴走を引き起こす要因に

Untitled Sketch_ブレッドボード.png

🔌 ハードウェア構成とピン配置

機器 DFPlayer Miniのピン Arduino UNOのピン 説明
通信(ソフトウェアシリアル) TX 10 (mySerialのRX) DFPlayer → Arduino(データ送信)
通信(ソフトウェアシリアル) RX 11 (mySerialのTX) Arduino → DFPlayer(データ送信)
電源 VCC 5V 電源供給(推奨は安定化された5V)
グラウンド GND GND 共通グラウンド
スピーカー SPK_1, SPK_2 スピーカー出力 直接小型スピーカー接続可(アンプ内蔵)
#include <SoftwareSerial.h>
#include <DFRobotDFPlayerMini.h>

SoftwareSerial mySerial(10, 11); // RX, TX
DFRobotDFPlayerMini myDFPlayer;

void setup() {
  Serial.begin(115200);
  Serial.println("Serial communication started.");

  mySerial.begin(9600);
  Serial.println("SoftwareSerial communication started.");

  Serial.println("Initializing DFPlayer Mini...");
  if (!myDFPlayer.begin(mySerial)) {
    Serial.println("DFPlayer Mini not found. Check wiring and SD card.");
    while (true); // ここで停止
  }
  
  Serial.println("DFPlayer Mini initialized successfully.");
  
  myDFPlayer.volume(15);  // 音量設定
  Serial.println("Volume set to 15.");

  myDFPlayer.play(1);     // 0001.mp3 再生
  Serial.println("Playing track 001.mp3...");
}

void loop() {
  // ループ内で特に何もしない
}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?