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?

ESP32でBluetoothスピーカーを製作する方法

0
Last updated at Posted at 2026-07-20

概要

 ESP32マイコンを使ってBluetoothスピーカーを作る方法を紹介します。製作は3分、プログラムは数行と、非常に簡単に製作できます。

bt_speaker_titile.png


製作の工程や動作動画はこちらに掲載中です。
 https://www.youtube.com/channel/UCmMiial_to0sEagnPoYHSNA

部品リスト

 使用部品は以下です。リンクを載せますが、2026/7/20時点のリンクですので、今後削除される可能性あります。ご参考までに。
ESP32-WROOM
小型スピーカー
MAX98357A

接続

 接続は以下のようになります。GAIN端子は音量設定です。未接続でも動きます。その場合+9dBのゲインになります。GND接続すると+12dBです。

   image.png

ライブラリのインストール

 AruduinoIDEに、ESP32-A2DPライブラリをインストールする必要があります。ダウンロード先は以下です。

ESP32-A2DPライブラリ

ダウンロードしたzipファイルを以下手順でインストール
image.png

プログラム例

プログラム例を紹介いたします。

#include "ESP_I2S.h"
#include "BluetoothA2DPSink.h"
I2SClass i2s;
BluetoothA2DPSink a2dp_sink(i2s);
const uint8_t I2S_WS    = 27;
const uint8_t I2S_SCK   = 26;
const uint8_t I2S_SDOUT = 25;

void setup() {
  Serial.begin(115200);
  i2s.setPins(I2S_SCK, I2S_WS, I2S_SDOUT);
  if (!i2s.begin(I2S_MODE_STD, 48000, I2S_DATA_BIT_WIDTH_16BIT, I2S_SLOT_MODE_STEREO, I2S_STD_SLOT_BOTH)) {
    Serial.println("Failed I2S");
    while (1);
  }
  Serial.println("ESP32_BT_Speaker start");
  a2dp_sink.start("ESP32_BT_Speaker");
}

void loop() {
}

使用方法

 使用方法は簡単で、まずESP32を起動し、その後スマホ側で「ESP32_BT_Speaker」へBluetooth接続するだけです。

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?