Tone Visualizer: Seeing Sound With a Laser
by Goosetopherson in Circuits > Lasers
695 Views, 8 Favorites, 0 Comments
Tone Visualizer: Seeing Sound With a Laser
This project puts together a few components to create a device that helps visualize some tones through the help of a laser. It's a little loud and the tones aren't great to listen to for long, but it's a fun little project to get a laser dancing on the wall. Similar to projects that use sand to visualize sounds, this does it with a laser and a mirror. The reason I decided to make this project was to have a stand alone device that would hold all the components together without needing to be set up each time.
- CAUTION: As this device does have a laser on it, always point it away when turning it on.
Supplies
Components:
- ESP32-S3 Microcontroller - Amazon Link
- MAX98357 I2S 3W Breakout Board - Amazon Link
- 40mm Speaker - Amazon Link
- Potentiometer - Amazon Link
- Tactile Button (12mm x 12mm) - Amazon Link
- 5V Laser - Amazon Link
- Jumper wires (female - female) 20cm - Amazon Link
- Heat Shrink tubing or electrical wire
- 100kOhm Resistor
- 104 Ceramic Capacitor
- Mirror
- Plastic film (Not shown above)
Note: Any wire will do. I went with jumper wires for the ease of connecting to the board without needing to solder both ends. 20cm or more will make connecting the wires easier. Anything smaller and there will be some struggle with components like the laser and speaker.
For the plastic film, I simply used a shopping bag but you can use cling wrap or any other similar material.
Hardware:
- 4 - 2mm x 30mm rods - Amazon Link
- 4 - m4 x 16mm Screws & Washers - Amazon Link
- 4 - m4 Heat set inserts - Amazon Link
- 2 - Plastic screws ~2 x 6mm
Tools:
- Soldering Iron
- Screwdriver
- Wire Cutters
- Hot Glue Gun
- Super Glue
- Access to a 3D printer
- Helping Hands
- Lighter
- Pliers
3D Printed Parts:
- One of each 3D printed part provided below needs to be printed.
Notes:
- All parts were printed in PETG on a Creality K1 with the default PETG settings.
- Some parts, mainly the 'Right_Side' will not look like it does in the pictures. Some components from the project were removed after testing and the part was adjusted.
Fusion Design
I designed this project in Autodesk Fusion. Fusion really helps me work out how I will be laying out the components and checking if everything will fit properly.
Some of the components that I used already have models available online that I grabbed through GrabCad or other websites. There is no need to spend time designing models that are already widely available.
For all other components, I used some calipers to measure and design how big of an enclosure I would need to design. The end product looks exactly like it does in Fusion with the exception of the wires.
Initial Enclosure Prep
First part of the enclosure to put together is rather easy. The 'Laser_Mount' needs to be glued to the 'Front_Piece' using either super glue or hot glue. The mount should be pointing up towards the center of the hole. After inserting the mount into it's location on the front panel, I fixed it in place with a drop of super glue from the bottom of the part.
Setting the 'Front_Piece' aside, We can grab one of the two side panels and install the 4 rods. If the rod fits snuggly into the hole then there is no need for glue. If there is some slack, feel free to use some glue. The rods are mainly here to guide the pieces together when assembling.
Grabbing two wires, (if using jumper wires, clip the dupont connector off one end on each wire), and pass the wire through the channel under the 'Front_Piece'.
Last part for the initial prep is to install the heat set inserts. These are easier to install if you slide the two halves together temporarily. I set my soldering iron to 10 degrees higher than the print temperature, this should be enough to get the insert installed and avoid deforming the plastic.
Soldering Components Part 1
Grabbing the tactile button and the ceramic capacitor, solder the capacitor across the legs of the button like shown above. The capacitor helps with button debounce. It is not completely necessary to do this step if you don't have a capacitor available, it just means that the switch may or may not function correctly every single press. After soldering the capacitor, a wire needs to be soldered onto one of the remaining legs. I added some heat shrink to the wire to add some stiffness to the connection.
Set the button inside the 'Control_Side' print and fix it in place with some hot glue.
Solder two wires to the potentiometer and add some heat shrink as shown. Install the potentiometer into the 'Control_Side' print and use the nut it comes with to hold it in place over the button.
The last leg of the potentiometer is soldered together with the remaining leg of the button and a wire after the potentiometer has been set into the 'Control-Side' print. I sandwiched the wire between the potentiometer pin and the button pin by bending the button pin over the wire. This also helped keep everything in place while I soldered.
The potentiometer helps keep the button as a backup to the hot-glue when installed this way.
Final Soldering
The Max98357A board needs a 100kOhm resistor soldered across the gain and gnd pin. This enables the board to output with 15bd instead of the default 9db. This is also not completely necessary but the speaker will be able to move the mirror better the louder it is.
The speaker also needs two wires soldered to it's terminals if it does not already have them.
The laser comes with two small wires. I removed those and connected the laser to the two wires that we passed through the 'Front_Piece' earlier with heat shrink added before soldering. The positive terminal on the laser has a resistor on it. I also added a larger piece of heat shrink tube to the outside of the laser. This protects the wires and gives the laser a more snug fit on the mount. The laser can be mounted after soldering. Do not add glue at this stage if it does not fit snug as adjustments will need to be made after the mirror is installed.
The last bit of soldering is done on the ESP32-S3. There are small jumper pads by the usb port that need to be connected together. This will enable 5V to the 5V pin. The laser will not work on any other pin as it requires more amps than the standard GPIO or 3.3v pins can provide.
More Enclosure Prep
The Max98357A module is screwed onto the ESP32-S3 bracket using the two plastic screws. Careful not to apply too much downward pressure while screwing as the bracket could be broken off depending on the orientation of print.
The speaker is hot glued in place after it is set onto the 'Speaker_Mount'.
Wiring & Partial Assembly
The wiring diagrams shows all the connections that are needed.
Notes:
- The speaker wires are connected to the MAX98357A screw terminals.
- The laser wires must be inserted through the small opening on the 'Right_Side' print before being connected.
- There are more wires in the pictures than on the final product. You won't have any wires coming from the 'Right_Side' print aside from ones from the two laser wires.
- The wires can be placed while the ESP32 board is sitting outside or it can be put in place before hand, but the board markings might be hard to see when installed.
When all the wires are connected, if the esp32 board is not installed, slide it under the bracket and push it in as far as possible until it is held in place by the bracket. A small amount of hot glue can be used so it doesn't move around when being plugged in.
Slide the two side pieces together using the rods while pushing the wires in. You should end up with the speaker loosely set in place and all the wires tucked into the enclosure.
Last Few Build Steps
Place a piece of your chosen piece of plastic over the speaker and enclosure. You can use a rubber band to hold it in place while you place the 'Front_Piece' over it.
Take one screw and washer and push it in to the 'Front_Piece' and through the plastic to screw it in. Once one screw is in place, you can install the remaining screws while pulling on the plastic slightly in order to get it plastic on taut.
Tape the small mirror piece to the plastic once the plastic is in place. If fabric or some other material was used, it can be hot glued in place if there is no chance of it melting. The more secure the mirror is to the material, the better.
Code
On the Arduino IDE, install the esp32 board manager. I've also included an image of how I have the settings for the board on the IDE. Download the code file I've provided down below. Connect the ESP32 Board to any of the two usb ports and upload the file. Be careful not to have the laser pointed in your direction.
Please be patient as it may take some time to compile and upload onto the board.
As the file is being uploaded you might notice that the laser is not focused. You can remove it from the mount and turn the housing to adjust the focus. Once you get a small dot you can place the laser back in the mount, line it up with the middle of the mirror and glue in place.
Once the project is uploaded to the board, you can press the button to play the tone and rotate the potentiometer around to play tones between 0 and 1000hz. Tones greater than that don't really move the speaker around enough to display much.
That's all there is for this project. Please let me know if you attempted to create this or found this project interesting.