Introduction: LED Wave Display

Led wave displau

Step 1: Materials

- Arduino Uno ($25)

- 32 x 16 LED Matrix ($20)

- Breadboard ($5)

- Jumper Cables ($5)

- USB A to B Cable ($3)

- Computer

- 5V 2Amp Power Supply ($10)

- A basic understanding of coding in C

In order to create this project, many physical materials are necessary, a lot of which will not be found lying around at home. In order to do this project, you should go out to computer stores or look online for these products. Keep in mind that you can upgrade to larger LED boards or faster arduinos, but that would require some modification of this tutorial as the coding, wiring, etc, changes with the addition of different products. Overall, this project is a fun way for you to practice your engineering, circuitry, and computer science skills while making a device that shows off your music taste in a new light.

Step 2: Software

- Arduino IDE (arduino.cc)

- Processing Software (processing.org)

- Soundflower (https://rogueamoeba.com/freebies/soundflower/)

- Arduino Libraries

As project is very heavy in coding, it will be necessary to download certain pieces of software to control the Arduino, rout the audio, and perform manipulations on the input tee sound waves. If unfamiliar with these programs, especially the Arduino IDE and the Processing Software, feel free to look ate the documentation beforehand, for help with the syntax and functions of the language. In both of these applications, the language is very similar to c and the logic behind the coding is relatively simple, so the task should not be too hard for someone with a basic understanding of computer science.

Step 3: Getting the Libraries

- download the two necessary libraries:

https://github.com/adafruit/RGB-matrix-Panel

https://github.com/adafruit/Adafruit-GFX-Library

This is an important step because the libraries are what is necessary to control the lighting on the board. Libraries are large masses of code written by others that are meant to help make your coding more efficient, so that you do not have to create your own functions. In this case, these libraries were written to be able to control the LED panel. This saves us a great deal of time, because now we can draw something on the board with a few lines of code instead of the countless lines of code that layout the definition of drawLine in the library. In order to make these libraries work, you must place these libraries under documents/Arduino/libraries in your computer and restart your programs to allow it to load. Remember to use #include and replace libraryname.name with the correct name of the library, in order to allow the code to be compatible with the library. What #include essentially does is it copies and pastes the code found in the library to the very front of the document, giving you access to the numerous functions, variables, and other features that the library provides.

Step 4: Connect the Wiring

- One of the major steps that needs to be done to complete this project is wiring the Arduino with the LED board, so that the Arduino can send signals to the LED board. Follow the images below to complete the wiring. On the Arduino uno, there are a multitude of pins, each having a label on the right or left side. Similarly, the connector that connects to the LED board has pins as well, just large enough to hold a jumper cable. The jumper cables will be able to make a connection between the two points and relay information without the need for soldering. The breadboard can also be a very helpful tool, preventing the hassle of having to solder. In the pictures below, my wiring is portrayed, with many black and white jumper cables.

Step 5: Add the Power Source

- After completing the lighting, you are must connect the power source to the LED board so that the lights can turn on. The cable for the LED board comes along with the LED board. In order to turn on the power, you must plug this cord into the middle of the board and then attach the 5 volt 2 amp power supply to the two ends of the cord. Finally, you must plug the power supply into an outlet to generate the energy required to power the board.

- The science behind the power of the LED board is that the power supply takes the alternating current from the outlet and converts it into a direct current, which the board can use as energy. Specifically, the board needs 5 volts and 2 amos in order to power the LED board at a minimum energy level

Step 6: Write the Code

- Now that all of the assembly of the device has been done, it is now time to write the code. First, we will start to write code in processing, creating a pde file. Essentially, what the code that you are going to write is going to do is take an audio input from the computer, which is going to be a song or sound that is played, and transcribe it into a series of waves that can be graphed. The way that this can be done is through the theory of fast Fourier transformations. Essentially, what this theory says is that sound waves can be interpreted with an algorithm and transformed into clean and easily graphable sine and cosine waves. Luckily, in the program that we are using, functions have already been created to help us get past having to code this complex algorithm by hand. If you would like to learn more about this idea read http://mathworld.wolfram.com/FastFourierTransform.html. Next, the information that is found out in the processing code is going to be relayed to the Arduino code, which takes in this input and creates a matrix that is to be displayed on the screen. In the Arduino code, which has a file extension of ino, multiple cases are going to be outlined, with certain heights and colors pertaining to a certain wave that the code is given. Using the libraries that we imported before, we are going to draw lines on the board with a quick refresh interval, to portray the differing waves that the sound creates. Below is a framework of the code, with some of the basic parts started for you. If you get stuck during this step, be sure to look into the library for functions that can be of use as well as the documentation of the c language, if you are unsure of syntax.

Step 7: Sending the Code

Once all of the code is written in both programs and the code is compiled, without any leftover syntax errors or problems, the next step is to add the code from the Arduino ide onto the Arduino itself. The way to do this is not a complicated process, but it can be confusing if you have not done it before. First, we plug the USB a to b cable into the Arduino, with the a side inside the Arduino and the b side connecting it to the computer, with the LED board and everything else still connected to the Arduino. The next step is to go to the Arduino ide and click upload, the second button on the window. Before doing this though, check at the top of the screen to see if the model of your Arduino and the port line up, otherwise problems may arise. Finally, if you have done all of this correct, then you're should get a message saying "done uploading" on your computer.

Step 8: Test It Out

Now that your device is built and the code is finished and uploaded, all you have to do is test the device out. Before you do this, you need to go back to the Soundflower app that you downloaded earlier. One of the things that the processing code needs to do is to receive and audio input, in order to apply algorithms on the audio it receives. Most likely, your computer is not already set up with the audio output going to the Processing application, specifically under Java Sound. In order to fix this and have the audio go to the right place, you need to first go to system preferences found by clicking the apple button in the top left corner and scrolling down to system preferences. Once in system preferences, you should navigate to sound, where you will click audio input and output, selecting Soundflower 2ch in the menu for both. After that, you just have to open the Soundflower preferences and route the audio to the processing application and then you are done. Hopefully, if everything is done right, you will have a cool depiction of the sound waves that you are inputting on the board. Keep in mind however that since the audio can only go through one channel, you will not be able to hear the audio yourself, as it is instead being routed to the computer. Though you can get past this by playing the same audio file at the same time.

Step 9: Troubleshooting

Don't worry if something didn't work along the way. There are many common mistakes that can be made during the creation of this device. The two most major problems would be that the wiring is not correct or that the coding has an error. If the wiring is incorrect, go back and look and the image of the correct wiring and compare your device to it closely, making sure to try and lay the jumper wires out as similar as possible. Another common and easy to fix mistake would be the fixing of coding. When your coding has an error, it will not compile and warnings will be given on which line number is incorrect. When you get this number, be sure to fix the coding on that line so that the code complies and works well.

Step 10: Physics

As a whole, this project demonstrates and models many aspects of waves. Firstly, it uses both sound waves and light waves throughout its running. Sound waves are given as an input through the computer, which is then sent to the Arduino as commands that allow it to draw light, creating light waves. This device uses light waves and sound waves. Another way tang waves are modeled is through the LED display itself and what it is outputting. The whole thing that is being shown on the board is a depiction of the wave, what is being show is the differing amplitudes, periods, wavelengths, etc. of the sound waves that is being shown, portraying it with light waves. One of the things that can be learned from this device that can help improve an understanding of physics is the ideas of fft, fst fourier transformations and the fact that the amplitude of a wave increases as the volume goes up. This can be demonstrated with the device because, as the volume of the sound grows louder, the amplitude that can be seen on the LED board becomes greater, as amplitude and volume are directly proportional. Another thing that can be learned from the device is the idea of fast Fourier transformations, which low us to take an audio input and turn it into a sine or cosine graph that can be sent into an array, which helps us present it on a LED board.

Step 11: Works Cited

Works Cited
"Adafruit/Adafruit-GFX-Library." GitHub. N.p., n.d. Web. 19 Oct. 2015.
"Adafruit/RGB-matrix-Panel." GitHub. N.p., n.d. Web. 19 Oct. 2015.
"DevDocs/ C." DevDocs. N.p., n.d. Web. 19 Oct. 2015.
"Processing.org." Processing.org. N.p., n.d. Web. 19 Oct. 2015.
"WHAT IS ARDUINO?" Arduino. N.p., n.d. Web. 19 Oct. 2015.

Step 12: Problems

Overall, there were not too many problems when creating this device. However, one of the major obstacles that I had to overcome was finding the right parts to make the device. Originally, I did not know how to do the wiring or which Arduino to choose to connect to the board, not knowing how much power the LED board needs. Eventually, after trial and error and reading the Arduino documentation, I was finally able to get the device to work. Another problem that I encountered along the way was that the lights were originally not showing up, which was because I did not wire the board and the Arduino correctly. I order to get over this obstacle by reading the documentation of Arduino and seeing which each pin is connected to. Overall, for this project the problems that occurred are not too hard to fix as long as you read the documentation and make sure you are doing everything correctly.