This device lets you control your music or media. I use it regularly while Im using Spotify on my pc.
You can also use it with your smartphone.
Here's the video for the demo and tutorial to make this device:
Features:
- Play
- Pause
- Volume +
- Volume -
- Next song
- Prev song
The youtube video shows the tutorial and usage of these features.Supplies:Hardware parts:
ESP32 DOITDEVKIT V1 : https://a.co/d/7rwitrc
KY 040 Rotary Encoder: https://a.co/d/6ejCpry
some wires
NOTE: Please buy exactly these parts, it can be from any site, for reference I have given the amazon links.
3D Printed parts:
Available on makerworld:
List of parts:
- base.stl
- encoder_holder.stl
- top_part.stl
The main code and the library repository have been shared.
Step 1: Connect the HardwareRefer the circuit diagram provided and make the connections on the rotary encoder and esp32.
NOTE: Solder the rotary encoder first, insert the other end of the unsoldered wires through the encoder_holder.stl part (as shown in the video). Then solder to the pins of the esp32.
Step 2: Setup Arduino IDENOTE: if you already have the esp32 board setup on your arduino IDE, then you can proceed with the next step.
These steps will get you started with setting up the esp32 board in Arduino IDE.
If you want a better idea of how the IDE works:
- It is pretty straight forward. Here is the documentation to help you set things up:
- https://docs.arduino.cc/software/ide-v2/tutorials/getting-started-ide-v2/
You will need to first install the esp32 board in your Arduino IDE.
Therefore follow these steps to do so:
- Navigate to File -> Preferences
- Add this url in the "Additional Board manager URLs"
- Enter this link: https://dl.espressif.com/dl/package_esp32_index.json
- press OK
- Now go to Tools->Board->Board manager: You will find it on the left menu.
- search "esp32 by Espressif" you will find the result select on INSTALL (Refer to the second image in this step, it is the second result).
- In my case it is already installed.
The github link:
https://github.com/T-vK/ESP32-BLE-Keyboard
Download the zip under the code option
Once you unzip it and get a folder,
Copy the folder, and paste it in libraries folder in Arduino folder.
You will find the folder here:
Documents->Arduino->libraries
paste the folder here.
NOTE: the video provides a good walkthrough of these pasting steps.
Step 5: Connect the Esp32 Board to Your PC- Connect your board to your laptop using a USB B type cable.
- You can see if your board is detected or not in the device manager as shown in my image
- Under Ports(COM & LPT) section, you will observe a name like Silicon Labs 210x etc. It means your Board is dtected properly.
- In case you cannot see anything like that, you will need those drivers.
- You can download the drivers here:
- https://www.silabs.com/developer-tools/usb-to-uart-bridge-vcp-drivers
- Its available for windows and MAC OS
- From the previous section, you can observe that my Board is at COM3
- Therefore I need to select COM3 in my Arduino IDE too.
- Then select ESP32 DO IT DEV KIT and you can find it prompted in the dropdown. Select it and Press Ok. (Refer Image).
NOTE: you can change the name of your device in the 2nd line of the code
- Open the muso.ino code I have attached in the supplies section
- Once you have chosen your board press Upload (Arrow Symbol). It is highlighted in the image.
- Now, when it compiles and then starts to upload, you will a connecting... response in the output.
- Here, you have to press and hold "boot" button on the ESP32 when it starts saying connecting.
- Hold it till it has uploaded.
- Refer to second image to see the compiling stage.
- Refer to third image to see the Uploaded stage.
Please refer to the video for clear steps on how to upload the code.
Step 8: Test the ConnectionsOnce the code has been uploaded test the working of the device by connecting it using bluetooth on your PC.
The default name is ESP32 knob.
Once it has paired and connected, rotate the encoder to observe change in volume or push the encoder switch to see if it pauses/plays the song.
Step 9: Assemble the PartsBefore applying hot glue assemble as shown in the images to check the alignment of the rotary encoder part.
As you can see in the third image, the rod of the encoder is not exactly in the centre. Simply rotate it 180 degrees and it will be in the centre.
Step 10: Apply Hotglue and Finish AssemblingAs shown in the first image, make sure the esp32 power/microusb port is facing towards the gap I have given in the part.
Finally power it using a microusb Cable, and thats it!
Step 11: Thats It!Do check out the video, to know how to use all the features.
Hope you liked this project, see ya on the next one.
Comments