Laser Guitar

by PieterWW in Circuits > Arduino

1079 Views, 9 Favorites, 0 Comments

Laser Guitar

20231003_002646.jpg

I attempted to make a laser guitar with arduino using distance sensors and laser sensors.

Supplies

ToFSensor.png
20231104_145220.jpg

Components:

Arduino GIGA

6 ToF Adafruit VL53LOX

6 Red laser 5V 650nm wire

6 red laser sensor module

Teensy v4.0

Teensy Audio Shield

Materials for casing:

Wood. I just used thick wooden panels/planks and sawed them into the correct pieces by using a real guitar as reference

The reason I picked VL53LOX TOF (Time of Flight) was because it was just small enough for 6 to fit next to each other on the neck of the guitar. Also, these sensors are highly accurate up to 2 meters and are much better than your standard infrared. I want to use them for measuring the distance of how far your fingers are on the neck relative from the base of the guitar.

The red laser modules are used for detecting if you have hit a string on the guitar, represented by a simple laser.

I use Teensy to handle our audio. Since we are trying to make a complex sound based on the distance of a finger on the neck, you want something that can properly simulate it.

The Hardware

20230819_143433.jpg
20230817_154127.jpg
20230819_143425.jpg

The first part was to solder all the parts together. Then it was time to connect. We use the SDA and SDL pins shown on the pictures, since the ToF sensors need an adress allocation for them to work. To use the adress system, you also need to use the X shutter pin (Represented by the X on the sensor) This pin works as the regular data pin. The laser sensors are very easy to wire, the have a standard GND,V and Pin connection, so connect these to your arduino and they will work. All sensors work on 5V,

Code

20230809_204602.jpg

https://github.com/PieterWinderlichSchool/IfThisThenThat

The code so far is only to make the sensors work, both ToF and laser. The hardest part is the ToF. The source code is incorrect/incomplete. These sensors need a LOX address, which is expressed in hexadecimal (0x29 as the standard). This is why the XShutter pin is needed, to allocate addresses with multiple sensors, since every sensor but one needs to be deactivated so you can set the address of the one that is still active.

To have multiple addresses, you need to add a function in the source code that sets an address, since it is missing in the source code. I also added a C++ script since the code is not optimized and wanting 6 to work on an arduino mega without proper memory allocation overloads your arduino. The C++ script is built on functionality that every sensor has their own laser sensor, just to keep each guitar string connected with themselves to keep things from getting too convoluted. The code is commented with the necessary explanation on how it works. I do not have the code for teensy, mind you even with the script for memory, you cannot make 2 work on Teensy let alone six, since it has too little memory. I did not have time to solve this issue, but my suggestion is to look if you can send signals from your arduino to a Teensy and have the sensors just send a signal of the guitar string with the finger position to the Teensy and let Teensy handle the rest.



Casing

20231003_002646.jpg
20231003_002649.jpg
20231104_145220.jpg

Get that saw ready, we are getting hands on. Get yourself a real guitar (for reference) and 2 long panels of wood. 1 panel must be as large as the entirety of the guitar, from the bottom to the top and side to side. the second must be at least as large as the base of the guitar. Draw the outline of the real guitar on the first panel, and cut on the outline you just made to create the first layer of your guitar. Then, on the second panel, just outline the base of the guitar without the neck. This is your second layer. To combine these layers, measure the size of your arduino and any pins that are sticking out of it. Then find some filling pieces of wood (maybe use the remainder of the panels you just used) to create a separation base for the 2 panels big enough to fit your arduino in between. Drill these bases shut and now you have the casing. WARNING  Don't forget to thoroughly sand all edges, since your fingers need to slide down them, it is recommended for your safety, as splinters hurt alot and some are hard to remove.


Picture 1 shows the casing, picture 2 shows the separation pieces.


Since I ran out of time I could not finish the implementation of the hardware to the casing, but it was intended as follows.

Near the connection of the neck to the base of the guitar, put the ToF sensors on the casing facing upward. This is done because that would be easier for the functionality. Guitar strings usually require a finger on them but you can also play a string open (when the string has no interference from the user) and in the code I have put a length limit at 9999 mm which is more then enough to simulate a string being open.

Now put the laser sensors directly under the ToF Sensors. Direction does not matter much, it depends on the way you wired the pins into your arduino, you want the right laser sensors to correspond to the right ToF Sensor. Put the lazer light under the sensors, pointing straight towards them. Leave enough space between them and between the sensors so you have enough space for your hand to hit the string properly and you are not interrupted while playing some heavy riffs and shredding the guitar to pieces.



Conclusion

This project did not go well for me due to a multitude of factors I wont get into, however I learned a lot of new things and I really challenged myself with this. Diving in the source code is something I usually stay clear from but I had no other choice. Clearly this is not finished, but I hope I gave you, the reader, enough to work with and maybe finish what I started. Be aware that the ToF sensor is really easy to break, they cost me 5 EURO each and because of a medical reason, I cannot solder all too well, so about 20 ish of these sensors broke on me. The only reason I used this type of TOF sensor is because of the size. The area for the neck is so small, you need the tiniest sensor you can get so I had very little option to switch.

In the end I kept pushing to finish and even though it was not finished, I got some interesting results and I got stuff working.

Overall, I do think with more time and experience, it is doable to finish this project in the future and have an actual laser Guitar.

Take it from me, if this is your first arduino project, look for something a bit more simple. When I told my teachers what I was building, the first thing they all said was: "That's ambitious". If you are more experienced, I'd love to see what you can do with this.