Wavepad: Gesture Controlled Raspberry Pi Music Player

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
× 1
× 1
Ultrasonic Sensor
× 1
× 2
× 2
Mfr 25frf52 1k sml
Resistor 1k ohm
× 18
Mfr 25frf52 10k sml
Resistor 10k ohm
× 2
Mfr 25frf52 100r sml
Resistor 100 ohm
× 1
Bourns 3362p 1 103lf image 160px
Single Turn Potentiometer- 10k ohms
× 2
× 1
LED Blue
× 12
× 1
11026 02
Jumper wires (generic)
× 30
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)


Wavepad: Gesture Controlled Raspberry Pi Music Player


Wavepad is a gesture controlled music player. It is built using Raspberry pi microcontroller. With Wavepad you can increase and decrease the volume of the song, play next song, play previous song, pause and resume song. To recognise the gestures we are using 2 types of sensors. First one is Ultrasonic sensor which is used to control the volume and Other is IR proximity sensor x 2 which are used to change ,pause and resume songs.

Step 1: Building Circuit

In our circuit there are three main parts.

1. IR Proximity sensor

2. Ultrasonic Sensor

3. LED's

We will go to each parts step by step.

Step 2: Build IR Proximity Sensor

A proximity sensor is a sensor able to detect the presence of nearby objects without any physical contact. We are using 2 proximity sensors in our project it will be used to play next or previous and pause the song.

To build the circuit follow the above circuit diagram.

Explanation of Diagram

We are using pair of Photodiode and IR LED's. Photodiode is connected to 10K Resistor while IR LED connected to 100 Ohm Resistor. S1 & S2 outputs are connected to LM324SN Operational Amplifier which amplifies the voltage according the Potentiometer connected. The output of the LM324SN is 5V. But we need 3.3.V to Raspberry Pi therefore we are using Voltage Divider Circuit.

Connect Output O1 & O2 to GPIO 27 & 17 Pins respectively.

Step 3: Connecting Ultrasonic Sensor

We connect Ultrasonic Sensor as follows

VCC —–> 5V



ECHO —–> Voltage Divider Circuit——>GPIO 22

Echo gives output 5V but Raspberry pi needs 3.3V therefore we are using Voltage Divider Circuit to make voltage equivalent to 3.3V.



Step 4: Connecting LED's

LED's are used to Indicate the volume level. We are using 10 LED's but you can use as many as you want. Each LED's Cathod is connected to common ground and Anode connected to 1K Resistor , then connected to GPIO Pins from Raspberry Pi.

Connect LED's To Following GPIO Pins:

LED1 –> GPIO 14

LED2 –> GPIO 15

LED3 –> GPIO 18

LED4 — > GPIO 23

LED5 –> GPIO 24

LED6 –> GPIO 25

LED7 –> GPIO 8


LED9 –> GPIO 12

LED10 –> GPIO16

Step 5: Coding

Steps to run the program:

1. Download the wavepad.py file and put it in /home/pi directory of raspberry pi.

2. Put songs in /home/pi/Music directory

3. Now we need our python script to execute at startup. To do this follow these steps:

a. Type sudo nano .bashrc

b. Add this line without quotes “sudo python wavepad.py &”

c. Go to Application Menu -> Preferences -> Raspberry pi configuration -> Then click on To CLI Radio button.

d. Restart your pi

Step 6: Finishing Up.

Now it's time to put our circuit in case. I didn't have 3D printer that's why i handmade this simple box using cardboard. And just stick printed paper on it.


python script

import os
import glob
import subprocess
import RPi.GPIO as GPIO
import time
from time import sleep

ECHO = 22
LED1 = 14
LED2 = 15
LED3 = 18
LED4 = 23
LED5 = 24
LED6 = 25
LED7 = 8
LED8 = 7
LED9 = 12
LED10 = 16


Read More: Wavepad: Gesture Controlled Raspberry Pi Music Player

About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:

Leave a Comment

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

Scroll to Top