Raspberry Pi Infrared Keyboard

by LennertVdV in Circuits > Audio

403 Views, 2 Favorites, 0 Comments

Raspberry Pi Infrared Keyboard

Poster-page-001.jpg
IMG_3902.JPG

I've always loved music, so when thinking about what I would make as my first Raspberry Pi project, my mind naturally went to it. But ofcourse I wanted to give it an extra touch, or better, no touch! With the current Covid-19 crisis and all the hygene and touching ristrictions in mind, I choose to make a keyboard where the keys were repalce by infrared sensors. You can change the key you are playing in by turning a rotary encoder and pressing it will trigger a backingtrack to start, of wich the tempo can be changed by tapping a touchsensor.

I have given the look a xylophone-piano vibe, wich I have also integrated on the website, where you can see what notes are being played. To build the case, I've only used wood,wich I painted to give it the finishing touch.

Part List

  • Raspberry Pi 4 Model B v1.2 - 2GB
  • Assembled Pi T-Cobbler Plus
  • 40pcs 10cm Male To Female Jumper
  • Cable 40pcs 10cm Male To Male Jumper Cable
  • IR Obstacle avoider
  • Speakers
  • Different pieces of wood
  • Paint
  • Touch sensor
  • LCD
  • Raspberry pi 4
  • adapter resistor package
  • Rotary encoder

Price: around 230 euros but depends on case

Electronics

Wire your electronics like in the given pdf. Be aware that the Infrared Sensor might need some readjusting to make sure they don't send signals at times they are not triggered.

My speaker is plugged into an external usb sound card to inprove sound, but you can also just plug it into the pi's jack output.

Database

dbscema.JPG

This is the database I created. I used a table containing all notenames and coresponding midi note values. Another table contains the keys wich you can choose between. The table PlaySession contains all previously saved tracks you played and connected to that are the notes in this track.

Assembeling Electronics

IMG_3905.JPG

Next came the assembly of the electronics. I decide to leave everything on a breadboard and not to solder it, because I am not that good at solderen and the IR sensors are quite sensitive so it could happen you will have to replace one someday.

Coding

For coding I used a python Library call Mingus wich uses FluidSynth to play midi notes.

To set up both you'll need to run the following commands:

pip install mingus

pip install fluidsynth

You can find the code on my GIT.

Website

Android Mobile – 16.png
Android Mobile – 10.png
Android Mobile – 17.png

Next, designed and coded my website. I used html, css and JS with websockets to communicate with the server running in the back.

Building Case

83264116_562052261147492_5340249099074229790_n.jpg
103090652_747739789329859_3980026017711784849_n.jpg
83124081_299604037730322_6637435790717286655_n.jpg
104093618_644893756239082_83346940646168990_n.jpg
103125237_265093141490167_7714592055337672363_n.jpg
IMG_3887.JPG

I designed my case to resemble a kind of xylophone/ Piano. I made everything in wood and decided to give everything a lick of paint to make it look even nicer.

And Now.. Play!

project.JPG
IMG_3910.JPG
104118891_707610423398517_3956653710889411888_n.jpg

Now you are ready to start playing your selfmade instrument! Don't be afraid to ask any questions in the comments and have fun creating!