Smart Guitar Using Capacative Touch With Build-in Tuner.

by Thomas Brink in Circuits > Raspberry Pi

22 Views, 0 Favorites, 0 Comments

Smart Guitar Using Capacative Touch With Build-in Tuner.

WhatsApp Image 2025-06-16 at 11.41.42_0f03d891.jpg

Have you ever experimented with chord fingerings on your guitar and wondered, ‘What chord am I playing?’ Or wished for a built-in tuner to keep your sound spot on? The SmartGuitar is designed to enhance your playing experience by identifying chords in real time and providing a seamless way to save progressions. With an intuitive dashboard displaying detailed chord information, this innovative project helps guitarists play with confidence and precision.


The SmartGuitar is a project I made for Project One at Howest MCT. It is built to register finger placement on the fretboard, calculate the played chord, store it in a database and show it in a useful dashboard application. It has a built-in tuner and supports multiple users to track individual statistics.


In this instructible I will explain the project step by step.

Warning: If you can't handle cutting holes in a guitar than this might not be the project for you.


Github repo: link

Supplies

Sensors:

MPR121 capacitive touch breakout board: To register finger placement on the fretboard. At least 2 boards needed.

RFID-RC522 RFID reader: To create a user system that allows multiple users to track their playing individually

--------------------------------------------- Piezo / Electreet

Actuator

Neopixel LED matrix board: Showing chord diagrams to teach new chords.

0.96 inch I2C OLED Screen: Showing tuner data and webserver address


Other

Guitar:

Raspberry Pi 4/5: I'm using a Pi 5. A Pi 4 is perfectly fine as well

Raspberry Pi power supply

Micro SD card

External power supply

Power supply adapter

ESP32

Micro-USB/USB-C data Cable: Depending on the model of your ESP32

jumper wires

resistors 4K7-10K ohm: 3pcs

Soldering tin

Nails

Copper tape



Tools

soldering iron

Creating the Circuit

p1_final_schematic.jpg
p1_final_breadboard.jpg
mpr121.jpg

To rebuild the SmartGuitar, just follow this schematic I made using Fritzing. You might need to solder some pin headers on some of the sensors. In case you don't know how to solder these, here's a tutorial.

The MPR121 capacitive touch breakout board uses I2C and has a configurable address pin. It has 4 possible address configurations: GND, VCC, SCL and SDA. However, when configuring the sensor to VCC , SCL or SDA, it's important to note you have to scratch out the address connectors on the bottom of the board.

I used 2 MPR121 sensors in this project but I made the ESP32 code expandable so you can add up to 4. All you have to do is change the variable SENSOR_AMOUNT before uploading 'main.cpp' to the esp32 (step 6). One MPR121 has 12 electrodes (these are the conducting parts you touch to get a reading). This means using 2 of these boards gives us 4 frets to work with.

Preparing the Raspberry Pi

To set up the Raspberry Pi you'll need to download a few things:

Software: Win32 Disk Imager

Start Image: Image

Once you have downloaded these, put your SD card into your computer using an SD card reader, open up win32 disk imager, select the image you downloaded and press 'write'.

Once it's done uploading, eject the SD card (if win32 disk imager hasn't done this for you) and insert it into the Raspberry Pi.

Connect the Pi to your computer using a network cable and open an ssh connection to 192.168.168.169 with password P@ssw0rd

ssh student@192.168.168.169

On boot the Pi will ask you to configure a new password. Follow the steps and reboot.

sudo reboot

To connect the Raspberry Pi to visual studio code using ssh follow this guide: Setup shh in vscode


Wi-Fi connection

In the terminal run following commands

# Get administrator rights
sudo -i

# Add WiFi network credentials to configuration file
# replace <your_SSID@Home> with the name of your network and <your_wifi-password> with the corresponding password
wpa_passphrase <your_SSID@Home> <your_wifi-password> >> /etc/wpa_supplicant/wpa_supplicant.conf

# Reconfigure the wireless network card in the Pi
wpa_cli -i wlan0 reconfigure

# Test if wireless internet is working
wget www.google.com

Cloning Repository

Now is the time to clone all the files you need to make the project work.

Github repo

Run this line in the command-line. Make sure you have git installed.

gh repo clone howest-mct/2024-2025-projectone-mct-Brink-Thomas

Database Design

eerd_final.png

All of the sensor readings and other data are stored in a mySQL database. You can find the dump file in the github repo under 'data'.

Virtual Environment

To make sure the project runs smoothly, it is good practice to use a virtual environment.

To create a virtual environment, run following lines in the command line.

# Create a virtual environment named 'venv'
python3 -m venv venv

# Activate the venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt


Uploading the Code to the Esp32

In the github repo there is a folder called esp32 under backend. This folder contains a platformIO folder structure that allows to upload code to the esp32 directly from vscode. Here is a tutorial to get started with platformIO.

If you'd rather use the arduino IDE, you could copy the main.cpp file from the src folder and upload it using the IDE. Don't forget to install the necessary dependencies.

If you're using more than 2 MPR121 touch sensors, make sure to update the SENSOR_AMOUNT variable before uploading the code.

You can now test the sensors using the serial monitor.

Backend

To run the backend you need to connect to the database first. In the backend directory there is a file named 'config_example.py'. To be able to connect to the database you need to duplicate the file, call it 'config.py' and add your username and password. Don't worry config.py is included in .gitignore so it won't be committed to github. This way your username and password are perfectly safe.

Once you've done that you should be able to run 'app.py' without any problems.


Serial connection with ESP32

If 'main.cpp' is uploaded to the esp32 you can plug the USB cable into the Raspberry Pi. Make sure your serial monitor is turned off. When running app.py you should get a serial connection. If it gives the warning 'No such file or directory found', try plugging it into a different USB port.


Running on startup

If you want the project to run automatically when you plug in your Pi, paste the following lines in the terminal.

# Move the file mijnproject.Service to the correct directory
sudo cp mijnproject.service /etc/systemd/system/mijnproject.service

# Test the file
sudo systemctl start mijnproject.service

# Stop the file
sudo systemctl stop mijnproject.service

# Enable the file
sudo systemctl enable mijnproject.service

# Status
sudo service mijnproject status

Frontend

Having a good backend is fun but it is not as good without a fitting user interface. This application has a dashboard website with real-time sensor data.

To run a webserver on your Pi you need to execute the following steps.

sudo -i

nano /etc/apache2/sites-available/000-default.conf

Use the arrow key down until you reach

'DocumentRoot /var/www/html'

Replace this line with

'DocumentRoot /home/student/project/<repo_name>/front'


Save: press Ctrl + X then Y and then Enter


service apache2 restart

nano /etc/apache2/apache2.conf

Use the arrow key down until you reach

'<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>'

Replace this with

'<Directory />
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>'


Save: press Ctrl + X then Y and then Enter

sudo chown student:www-data /home/student/project/<repo>/front
sudo chmod 0750 /home/student/project/<repo>/front

service apache2 restart

service apache2 status
# Output should be similar to:
Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
Active: active (running) since ..


If your backend and circuit are implemented correctly, you should see an IP address on the display. If you browse this IP address you should see the website (as long as you're on the same network as the Pi)

Housing

guitar_hole.jpg
guitarbox.jpg
guitarbox2.jpg
guitarboxguitar.jpg
solderguitar.jpg
sensorguitar.jpg

All this time I've been telling you how to build a SmartGuitar but up until now we just had a guitar and some loose unconnected electronics. It's time to change that.


Step 1: Cutting a hole


The SmartGuitar has a lot of electronics it needs to fit inside. The Raspberry Pi, ESP32 and everything that comes with them need to have a safe place to fit inside. I decided to cut a hole in the top and put a box in it.

Steps

  1. Draw the dimensions of the box on the guitar.
  2. It's important to think about the inside of the guitar when drawing dimensions. You can't go as wide as the guitar because there are reinforcements inside the guitar you want to keep.
  3. Drill a small hole at the corner of the drawing big enough to fit a rocking saw.
  4. Saw a hole following the lines of the drawing.


Step 2: Creating a box

Steps

  1. Saw thin planks of wood in the size of the dimensions of your hole and the depth you want.
  2. Glue the side and bottom planks together with wood glue and fortify with nails.
  3. Affix the top plank with screws and hinges so you can still easily access your electronics.


Step 3: Capacitive Touch Sensors


To register touch data on the fretboard, there has to be an electrode connected to a the MPR121 capacitive touch sensor. I've chosen for electrical tape

Steps

  1. Cut off the strings
  2. Drill holes where you want the electrodes to go through the fretboard (you can use wires to connect, but I've chosen for thin long nails). There should be one for every string on every fret you're using.
  3. Put the electrodes through the holes (hitting the nails in in my case)
  4. Put small strokes of copper tape over the electrodes. There should be a bit of a gap between every piece of tape.
  5. On the other end of the guitar neck, connect wires to the electrodes. I've soldered them to the nails.
  6. Isolate the sensors and streamline the wires using electrical tape and connect the other side of the wires to the sensors.
  7. Now just add the electronics inside the case and you're done

Conclusion

Although I didn't get this project where I wanted it to be, it was still a lot of fun to work on. I hope you enjoyed reading this post and potentially recreating it. If you do attempt this yourself, I would love to see the results and I'm open to any questions you might have.