ESP32 Projects

Gesture Controlled Music Player using ESP32-S3 | No Buttons, No Touch

Last Updated on September 9, 2026 by Engr. Shahzada Fahad

Gesture Controlled Music Player:

Gesture Controlled Music Player using ESP32-S3 | No Buttons, No Touch – You don’t need to press any button.

You don’t even need to look at the screen.

Just use hand gestures to play the next song… previous song… or stop the music.



Gesture controlled music player using ESP32-S3 with hand gesture control
Gesture Controlled Music Player using ESP32-S3 — no buttons, no touch.

Just move your hand like a controller… and that’s it.

All this is possible because of the Makerfabs MaTouch ESP32-S3 Parallel TFT, with a 3.16-inch ST7701S display.




Makerfabs MaTouch ESP32-S3 Parallel TFT development board with 3.16-inch ST7701S display
Makerfabs MaTouch ESP32-S3 Parallel TFT board with 3.16-inch ST7701S display.

Now just imagine; If you wanted to build the same level project using Arduino, or any other development board, how many extra modules would you need?

  • A separate MP3 player
  • Speakers
  • Arduino or ESP32
  • SD card module
  • RGB display
  • Gyro and IMU module
  • buttons
  • A battery charger

So many parts… so many wires.

Because of that:

  • Your cost increases
  • Your wiring becomes complex
  • And a lot of time gets wasted

So, why purchase all these modules separately and waste time on wiring, when you already get everything on one single board?

And let me tell you one thing; this board is not limited to building an MP3 player only.

This board also includes:

An onboard microphone, based on the INMP441

ESP32-S3 board with onboard INMP441 microphone
ESP32-S3 with onboard INMP441 microphone for audio input.

An RTC chip for time-based projects

RTC chip on ESP32-S3 development board for real-time clock applications
Onboard RTC chip for real-time clock and time-based ESP32-S3 projects.

And that’s not all.

You get reserved UART, a 4-pin SH1.0 I2C header, and a 4-pin MX1.25 USB header.



Reserved UART, 4-pin SH1.0 I2C header, and 4-pin MX1.25 USB header on ESP32-S3 board
ESP32-S3 expansion connections: UART, SH1.0 I2C, and MX1.25 USB headers.

This means you can easily connect more sensors and breakout boards whenever you need them.

Because of all this, this board is perfect for portable and wearable projects, like:

  • Sensor monitoring
  • Mini photo album
  • Gesture-controlled robotic car
  • Voice recorder
  • Self-balancing robot
  • Digital spirit level or bubble level
  • Portable receiver for monitoring important processes
  • Home automation systems
  • Real-time digital clock
  • Vibration monitoring
  • Time controlled loads
  • Steps counter
  • Dash board
  • Earth-quack monitoring

The possibilities with this development board are almost endless.

At the heart of all this, you get a powerful ESP32-S3 controller, with WiFi and Bluetooth 5.0.



ESP32-S3 development board for gesture controlled music player project
ESP32-S3 development board powering the gesture controlled music player.

This makes it faster, smarter, and more capable than Arduino-based solutions.

And one more important thing I want to mention; this display is fully compatible with LVGL.

So you can use SquareLine Studio to design amazing and professional user interfaces.



UI designing for ESP32-S3 using LVGL and SquareLine Studio
Designing a professional ESP32-S3 user interface with LVGL and SquareLine Studio.

If you want ready-to-use project folders, with all the project files and extra resources, you can visit my Patreon page.

With just a 1-dollar subscription, you get access to all my projects and future updates.

By now, I am sure you have a very clear idea of how easily you can build a music player using this development board.

On the hardware side, you don’t really need to do anything, because everything is already available on the board.

About the Arduino IDE, ESP32, and Libraries:

However, on the software side, you need to be a little careful to avoid errors.

For that reason, I strongly recommend reading my Getting Started article on this board.

In that article, I explain:

Which Arduino IDE version you should use

 right now, it is version 2.3.6

Which ESP32 board package version is required

And how to install all the necessary libraries

It’s very important that the library versions match exactly, otherwise you may run into compilation or runtime errors.

So, for a smooth and error-free experience, please read that previous article first.

Arduino IDE:

Arduino IDE 2.3.6

ESP32 Boards package:

esp32 V2.0.11 or V2.0.16

Libraries:

QMI8658 v1.0.1 library

Install JPEGDecoder v2.0.0 library

Once all the required libraries are installed, we are officially ready to move forward

Now let’s talk about the code, because this is where the real magic happens.

Gesture Controlled Music Player Code:




First of all, what I really like about this board is that Makerfabs has already exposed all the connections very clearly in the schematic. Because of that, we don’t have to guess anything. We already know exactly which pin is connected to what, and we simply map those pins directly in the code.



MAX98357A I2S amplifier and speaker connected to ESP32-S3
MAX98357A I2S amplifier connected to ESP32-S3 for speaker audio output.

For audio output, we are using the I2S interface, which is the best choice for high-quality sound. According to the schematic, the I2S bit clock is connected to GPIO 44, left-right clock to GPIO 43, and audio data output to GPIO 19.

ESP32-S3 development board with SD card interface for WAV audio storage
ESP32-S3 SD card interface for storing and playing WAV audio files.

Next comes the SD card interface. Instead of using default SPI pins, we use the exact pins defined by Makerfabs. The chip select is on GPIO 42, MOSI on GPIO 40, MISO on GPIO 38, and clock on GPIO 39. This is important, because if you use wrong pins here, the SD card will not initialize at all. Once the SD card is ready, the code scans it and automatically collects all WAV files, so you don’t need to hardcode file names.

Now let’s talk about the display.



ESP32-S3 MaTouch display backlight controlled through GPIO 46
MaTouch ESP32-S3 TFT display backlight controlled through GPIO 46.

On this board, the TFT backlight is connected to GPIO 46. This pin controls the backlight directly, so we don’t need any external transistor or extra wiring. In the setup() function, we simply configure GPIO 46 as an output.

pinMode(TFT_BLK, OUTPUT);

digitalWrite(TFT_BLK, LOW);

One important thing to notice here is that the backlight is active-low, which means setting the pin LOW turns the display ON, and setting it HIGH turns it OFF. As soon as we pull this pin low, the backlight comes alive and the screen becomes visible.

ESP32-S3 development board with built-in QMI8658 gyro and IMU sensor
ESP32-S3 with QMI8658 IMU for motion and gesture detection.

For gesture detection, we are using the QMI8658 IMU, which is already present on the board. The I2C pins are GPIO 17 for SDA and GPIO 18 for SCL, again taken directly from the schematic. In the setup, we configure the accelerometer for a 2G range and a 500Hz output data rate, which gives us fast and smooth motion detection.

Now here comes the interesting part — gesture logic.

float deltaX = abs(data.accelX – lastAccelX);

    lastAccelX = data.accelX;

 

// ——– SHAKE DETECTION ——–

    if (deltaX > SHAKE_THRESHOLD) {

      if (data.accelX > 0) nextSongRequest = true;

      else prevSongRequest = true;

      flatStartTime = 0;

      delay(300); // debounce

    }

The code continuously reads the acceleration on the X-axis. Every time a new value comes in, we compare it with the previous reading. If the difference between these two values crosses a predefined threshold, the code treats it as a shake gesture.

A quick shake toward the right side triggers the next track, while a shake toward the left side plays the previous track. Slow tilting does nothing, so accidental movements are ignored.

To make the system more stable, a small delay is added after detecting a shake. This prevents false triggering and ensures the music player doesn’t skip multiple songs with a single gesture.

When the board is held flat and still for a specific amount of time, the code detects this condition and stops the playback. This is done by checking both X and Y acceleration values and making sure they stay below a defined limit for at least one second. No buttons, no touch; just natural movement.

On the audio side, the WAV file is read in small chunks and sent directly to the I2S driver. We skip the first 44 bytes, because that’s the WAV header, and then stream raw audio data to the speaker. This keeps memory usage low and playback smooth.

The user interface is kept simple on purpose. The screen shows the current acceleration value and the playback status, like playing or stopped. This helps you visually understand what the gestures are doing in real time, which is perfect for debugging and demonstrations.

So overall, this code is designed to be:

  • Simple
  • Efficient
  • And very practical

All the hardware complexity is already handled by the board, and the software focuses only on logic and user experience.

Uploading the program into ESP32S3:

To upload the program, here is what you need to do:

First, go to the Tools menu > Board > ESP32, and select ESP32S3 Dev Module.

Go back to the Tools Menu > Port, and choose the correct communication port.

Again to the tools menu > Flash Size, and select 16MB.

Again go to the Tools menu > Partition Scheme and select 16M Flash

And one last time, go to Tools Menu > PSRAM, and select OPI PSRAM.

Once all these settings are done, you can simply click the Upload button.



ESP32-S3 code upload error fixed by entering download mode
Fixing the ESP32-S3 code upload error by holding the Flash button during upload.

If you get an error during the upload, don’t panic; this is completely normal with ESP32 boards. Just disconnect the USB cable, then press and hold the Flash button, and while holding it, connect the USB cable again.

Now upload the code once more, and make sure you keep the Flash button pressed during the upload.

Uploading code into ESP32-S3 development board using Arduino IDE
Uploading the gesture controlled music player code into the ESP32-S3.

As you can see, the program has been uploaded successfully.

You can now unplug the USB cable and move on to the next step.

Practical Demo:

For the practical demo, I have already copied a few sound files to the SD card.




Playing WAV sound files from an SD card using ESP32-S3
Playing WAV sound files from a Micro SD card using ESP32-S3.

You can save songs, lectures, voice notes; anything you want, as long as it’s in WAV format.

Now, let’s insert the Micro SD card into the slot.



ESP32-S3 development board connected to a Micro SD card for audio file storage
ESP32-S3 connected to a Micro SD card for storing and playing audio files.

If you’re not using a battery, plug in the USB cable again to power the board.

Then turn ON the power switch, and the player will start automatically.



Hand gesture controlled music player using ESP32-S3 without buttons or touch
Control music playback with simple hand gestures using ESP32-S3.

By default, the system plays all the sound files one by one, in sequence.

Stopping the music player using a hand gesture with ESP32-S3
Stopping music playback with a simple hand gesture using ESP32-S3.

If you keep the board flat and still for about one second, the player will stop.

Give it a quick shake, and it will start playing again.



Left and right shake gestures to change songs on an ESP32-S3 music player
Change songs with simple left and right shake gestures.

A normal tilt will do nothing; so there are no accidental skips.

To change the track, you need to give it a quick shake:

Shake to the right to play the next file

Shake gesture control for ESP32-S3 music player
Controlling the ESP32-S3 music player with a shake gesture.

Shake to the left to go back to the previous one

There are no buttons to press, and you don’t even need to look at the display.

just shake your hand and that’s it.

So, that’s all for now.

Support me on Patreon:

If you enjoy my work and find these projects helpful, please consider supporting me on Patreon. With just $1, you can get access to all project source codes, schematics, and extra resources that I share with my supporters. Your support helps me continue creating new electronics tutorials, experiments, and open projects for the community. Thank you so much for being part of this journey and for supporting my work!

Watch Video Tutorial:

ESP32-S3 Gesture Controlled Music Player | LVGL + IMU Project


Discover more from Electronic Clinic

Subscribe to get the latest posts sent to your email.

Engr. Shahzada Fahad

Engr. Shahzada Fahad is an Electrical Engineer with over 15 years of hands-on experience in electronics design, programming, and PCB development. He specializes in microcontrollers (Arduino, ESP32, STM32, Raspberry Pi), robotics, and IoT systems. He is the founder and lead author at Electronic Clinic, dedicated to sharing practical knowledge.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button

Discover more from Electronic Clinic

Subscribe now to keep reading and get access to the full archive.

Continue reading

Electronic Clinic
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.