Here are some pictures and video of the project it it’s (almost) final states.
The point of the display was to take music and visualise this on the LED matrix.
The easiest way to do this, was to transfer data via a serial connection from a PC to the Arduino. Therefore Processing was used load, play and analyse the song and then transmit the data to the board. Processing analyses the music using a minim library, a Fast Fourier Transform (FFT) is performed on the songs features and it is the output of this as a byte that is transferred to the Arduino, some code was acquired from the instructable at http://www.instructables.com/id/Arduino-Processing-Audio-Spectrum-Analyzer/ to perform the FFT correctly.
However as the hardware components were different, different Arduino code was used. This was done from scratch. There are several components to it. Also initially the Arduino Uno was to be the preferred Arduino to use however it appears that it did not have sufficient memory to cope with two arrays and the screen would just display artefacts unrelated to what was required therefore and Arduino Mega2560 was used.
There are two methods for drawing either a visualiser or a circular display. However both use the same values in different manners. The visualiser display take each FFT transform value it receives (maximum of 16) and loads these values into an array. Then each elements in the array is used to determine the height of the line it is required to draw to the matrix, each position in the array corresponds to how far across the display the line should be drawn, two lines are drawn for each element. The circular visualisation simply uses each value as a radius. The colour of the circle is randomised for each loop.
A push button is used to switch between the visualisations. To enable smooth switching between visualisations an Interrupt is attached to pin 2 on the Arduino, such that the array loops can be exited as without this the user would have to press the button at precisely the correct moment to switch visualisations.
Here are some pictures of the LED Matrix being set up and in use.
The LED Matrix comes with it’s own library, which makes drawing things and writing things on the Matrix relatively easy.
There are also some really easy to use examples that comes with the library.
So now that we have all our parts, we decided to test them out to see if they work. We tested the LED matrix panel by wiring it up to the Arduino Mega by using these tutorials:
We connected a 5V 2A power supply to it in labs. For some odd reason, the panel wasn’t working. Not sure if this is due to the power supply or if the wires aren’t in the right place. We’ve taken all the wires out and reconnected but it’s still not working. We’ve ordered a generic UK 5V 2A power adapter so once that’s arrived we’ll resume testing. We’ll try testing it on the Uno too to make sure it isn’t just the wiring on the Mega.
- Generic UK 5V 2A power adapter: http://www.amazon.co.uk/exec/obidos/ASIN/B00DJ4UFCC/ref=ox_ya_os_product
So we’re making a sound visualizer, woo hoo! We’ve just ordered our parts for our project, including an Arduino Mega and an LED matrix panel, which should hopefully reach within a week. The list of the components that we’ve ordered is below, including the prices and links.
- Arduino Mega: £8.17 – http://www.gearbest.com/development-boards/pp_22532.html
- RGB LED matrix panel: £25.52 – http://www.adafruit.com/product/1484
- Wave shield – £14.06 – http://www.adafruit.com/products/94
- Speaker – £1.25 – http://www.adafruit.com/products/1313
- Female DC power adapter – £1.28 – https://www.adafruit.com/products/368
In the meantime, we’ll get started on creating a prototype with an Arduino Uno and a couple dozen LEDs, creating a program to take sound waves as an input and have a cool LED pattern display as an output, as well as the music itself through speakers.