I was messing around with Phil Schatzmann's library and how to use a Rotary Encoder, and then I accidentally created a Bluetooth device using a Rotary Encoder to control the volume. The device's volume will also update when the Rotary Encoder is being rotated.
In addition, when the device is inactive for 1 minute (changeable), it will enter "deep sleep" mode. In order to wake up the module, you need to connect PIN 15 of ESP32 with GND via the pull-down resistor. You can modify the auto shutdown time by changing the value of minutes in the code.
Updated: It works on Android, IOS, and Samsung Watch (Wear OS, but not sure about Tizen OS).
The built-in LED of the board will be lit up when your phone is connected to Bluetooth. Also, when you change the volume, the LED on WS2812B will also lit up depending on the volume of the device, and the number of LEDs that will illuminate is 10 (you can change the number of LEDs depending on your project)
Here is the information on how to wire the PCM5102A module to the ESP32:
PCM5102A | ESP32 |
---|---|
LCK | GPIO 25 |
DIN | GPIO 14 |
BCK | GPIO 26 |
SCK | GND |
GND | GND |
VIN | 3V3 OR 5V (VIN) |
Here is the information on how to wire the Rotary Encoder to the ESP32:
Rotary Encoder | ESP32 |
---|---|
CLK | GPIO 33 |
DT | GPIO 32 |
GND | GND |
VIN | 5V (VIN) |
Here is the information on how to wire the WS2812B Led Strip to the ESP32:
WS2812B | ESP32 |
---|---|
V+ | VIN (5V) or 3.3V |
Data In | GPIO 18 |
GND | GND |
https://github.com/pschatzmann/ESP32-A2DP
https://learn.adafruit.com/adafruit-neopixel-uberguide/arduino-library-installation
MIT LICENSED