https://github.com/hslarson/ece-5-led-cube
ECE 5 Final Project: A 6x6x6 LED matrix that responds to audio input
https://github.com/hslarson/ece-5-led-cube
arduino audio-visualizer led-cube msgeq7 school-project
Last synced: about 2 months ago
JSON representation
ECE 5 Final Project: A 6x6x6 LED matrix that responds to audio input
- Host: GitHub
- URL: https://github.com/hslarson/ece-5-led-cube
- Owner: hslarson
- Created: 2021-02-20T09:44:38.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2025-03-23T19:06:28.000Z (about 1 year ago)
- Last Synced: 2025-03-23T20:20:25.613Z (about 1 year ago)
- Topics: arduino, audio-visualizer, led-cube, msgeq7, school-project
- Language: C++
- Homepage:
- Size: 5.67 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://photos.app.goo.gl/J5VMb96Lni4Fbc2d9 "More Images")
### Main Program:
- loop
- Calls the nextLayer() member function of the Multiplexer class on a preset interval
- While we wait for the next layer to be drawn, the loop calls the subtasks() function to perform several smaller tasks required to draw the matrix
- subtasks
- Each subtask referenced in this function is called once for every complete matrix that is sent to the cube. The function must be reset after every iteration
- The first step (case 0) is calling the checkVolume() member function of the MSGEQ7 class, this decides whether the subtasks function draws a volume matrix or a spectrum matrix
- Next, we collect the data required to construct the matrix. This is only required if we are drawing a spectrum matrix
- Then, we construct the matrix itself. This is handled entirely by the respective classes
- Lastly, we queue the matrix we just drew, meaning that it will be shown in the next iteration of the loop
### Multiplexer Class:
- setMatrix
- Uses memcpy to either queue a new matrix or allow the queued matrix to be shown
- nextLayer
- Handles the drawing of individual layers and the queuing of matrices
- First, calls the constructData() function to format the data in a way that the registers will understand
- Then, calls the sendData() function to send the data to the cube
- constructData
- A helper function for nextLayer() that handles the mapping of output pins and the conversion of the resultant binary array to an integer array
- sendToCube
- Uses the SPI bus to send the data from the constructData() function to the shift registers
### MSGEQ7 Class:
- getSpectrum
- Reads data from the MSGEQ7 breakout board using analogRead()
- normSpectrum
- Takes the array from the getSpectrum() function and converts from 7 channels to 36
- makeSpectrumMatrix
- Maps each frequency band to a specific column of the cube
- Applies a threshold to the raw reading to decide how many LED’s to light in each column and constructs a Boolean matrix based on this data
- queueMatrix
- Calls the setMatrix() member of the Multiplexer class to queue the matrix that was built by the makeSpectrumMatrix() function
### VolumeControl Class:
- checkVolume
- Uses a timer and the getVolume() function to decide whether or not to draw a volume matrix
- getVolume
- Reads data from the volume potentiometer and normalizes the reading
- Creates a running average of the normalized readings
- makeVolumeMatrix
- Takes the current volume reading and creates a Boolean matrix that displays the volume as front-to-back bars that ascend each column then move from left to right to the next column
- queueMatrix
- Takes the matrix that was constructed by the makeVolumeMatrix and queues it to be shown on the cube