# SparkFun Spectrum Shield DEV-13116

**URL:** <https://community.sparkfun.com/t/sparkfun-spectrum-shield-dev-13116/45598>\
**Category:** Sound & Audio\
**Created:** [May 16, 2023, 10:33pm UTC](https://community.sparkfun.com/t/sparkfun-spectrum-shield-dev-13116/45598 "2023-05-16T22:33:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Protlor](https://avatars.discourse-cdn.com/v4/letter/p/cab0a1/32.png) [@Protlor](https://community.sparkfun.com/u/Protlor)\
**Post date:** [May 16, 2023, 10:33pm UTC](https://community.sparkfun.com/t/sparkfun-spectrum-shield-dev-13116/45598/1 "2023-05-16T22:33:00Z")

</div>

Hi

I have bought a sparkfun spectrum shield.

I carefully soldered header pins onto the spectrum board and I have tried it on a mega and 2 different Arduino Uno’s.

Does it work on Arduino Uno and Mega? Or do I need a Redboard?

I connected pins 7 to 13 to 330 ohm resistors and some yellow LEDs while I wait for red ones. And the common ground from the breadboard. As per sparkfun page on hook up. On the Mega these pins will be PWM. I want on off for the leds.

I have tried the spark fun demo. This does a chase of the LEDs 1 to 7 in a loop but not audioreactive.

I tried the spectrum analyser software which reads and writes input on the serial monitor and plotter.

I have tried the pulse width modulation on the mega. The LEDs are dim and seem to react to the audio input from phone or computer but not in time to the rhythm and still flash when there is no audio signal.

I have tried powering the mega from a powersupply.

None of the software seems to show audio reactive LEDs in time with the music.

I really want to operate relay modules with bass or frequency responsive but if I can get the LEDs working I am very close.

Can you please advice?

Are there any updates codes or forums with people having similar problems?

My thoughts are audio interference, defective board, bad code or defective Arduino.

Any help much appreciated.

Thanks

Max

---

<div class="post-metadata">

**Author:** ![TS-Russell](https://yyz1.discourse-cdn.com/sparkfun/user_avatar/community.sparkfun.com/ts-russell/32/6092_2.png) [@TS-Russell](https://community.sparkfun.com/u/TS-Russell)\
**Post date:** [May 17, 2023, 7:17pm UTC](https://community.sparkfun.com/t/sparkfun-spectrum-shield-dev-13116/45598/2 "2023-05-17T19:17:08Z")

</div>

It sounds like everything is working separately…which usually points to a code issue. I would recommend fiddling around and changing the programming until getting the desired result

Share a photo of the wiring/setup and the code/pins being used

---

<div class="post-metadata">

**Author:** ![Protlor](https://avatars.discourse-cdn.com/v4/letter/p/cab0a1/32.png) [@Protlor](https://community.sparkfun.com/u/Protlor)\
**Post date:** [July 14, 2023, 9:25am UTC](https://community.sparkfun.com/t/sparkfun-spectrum-shield-dev-13116/45598/3 "2023-07-14T09:25:49Z")

</div>

HI.

I have been playing with code and asking chat gpt to help.

I have tested Leds are turning on or connected right with a simple program.

[https://cdn.sparkfun.com/assets/learn\_t … kup\_bb.jpg](https://cdn.sparkfun.com/assets/learn_tutorials/2/4/3/SpectrumShieldHookup_bb.jpg)

I have the board wired as in the link.

[https://github.com/sparkfun/Spectrum\_Sh … m\_Demo.ino](https://github.com/sparkfun/Spectrum_Shield/blob/master/Firmware/SparkFun_Spectrum_Demo/SparkFun_Spectrum_Demo.ino)

[https://github.com/sparkfun/Spectrum\_Sh … M\_Demo.ino](https://github.com/sparkfun/Spectrum_Shield/blob/master/Firmware/SparkFun_PWM_Demo/SparkFun_PWM_Demo.ino)

These are the 2 codes i have been trying and attempting to tweak.

/\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*

SparkFun Spectrum Shield Demo

Toni Klopfenstein @ SparkFun Electronics

December 2015

[https://github.com/sparkfun/Spectrum\_Shield](https://github.com/sparkfun/Spectrum_Shield)

This sketch shows the basic functionality of the Spectrum Shield, working with a basic RGB LED Matrix.

The Spectrum Shield code is based off of the original demo sketch by Ben Moyes @Bliptronics.

This sketch is available in the Spectrum Shield repository.

Development environment specifics:

Developed in Arduino 1.6.

This code is beerware; if you see me (or any other SparkFun employee) at the local, and you’ve found our code helpful, please buy us a round!

Distributed as-is; no warranty is given.

\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*/

// Declare Spectrum Shield pin connections

#define STROBE 4

#define RESET 5

#define DC\_One A0

#define DC\_Two A1

// Define LED connections on the Arduino/Shield

int LED = {7, 8, 9, 10, 11, 12, 13};

// Define spectrum variables

int freq\_amp;

int Frequencies\_One[3];

int Frequencies\_Two[3];

int i;

// Define LED frequency ranges

int ledFrequencyRanges[2] = {

{60, 130}, // LED 7 - Frequency range 20Hz to 60Hz

{140, 200}, // LED 8 - Frequency range 60Hz to 250Hz

{200, 500}, // LED 9 - Frequency range 250Hz to 500Hz

{500, 1000}, // LED 10 - Frequency range 500Hz to 1000Hz

{1000, 2000}, // LED 11 - Frequency range 1000Hz to 2000Hz

{2000, 4000}, // LED 12 - Frequency range 2000Hz to 4000Hz

{10000, 15000} // LED 13 - Frequency range 4000Hz to 6000Hz

};

/ **Setup Loop** \*\*\*\*\*/

void setup() {

// Set LED pin configurations

for (i = 0; i \< 5; i++) {

pinMode(LED\*, OUTPUT);\*  
_digitalWrite(LED, LOW);_  
 _}_

 

_// Set Spectrum Shield pin configurations_  
_pinMode(STROBE, OUTPUT);_  
_pinMode(RESET, OUTPUT);_  
_pinMode(DC\_One, INPUT);_  
_pinMode(DC\_Two, INPUT);_  
_digitalWrite(STROBE, HIGH);_  
_digitalWrite(RESET, HIGH);_

_// Initialize Spectrum Analyzers_  
_digitalWrite(STROBE, LOW);_  
_delay(1);_  
_digitalWrite(RESET, HIGH);_  
_delay(1);_  
_digitalWrite(STROBE, HIGH);_  
_delay(1);_  
_digitalWrite(STROBE, LOW);_  
_delay(1);_  
_digitalWrite(RESET, LOW);_  
_}_  
_/ **Main Function Loop** \*\*\*/_  
_void loop() {_  
_Read\_Frequencies();_  
_Light\_LEDs();_

_}_  
_/ **Pull frequencies from Spectrum Shield** \*/_  
_void Read\_Frequencies() {_  
_// Read frequencies for each band_  
_for (freq\_amp = 0; freq\_amp \< 7; freq\_amp++) {_  
_Frequencies\_One[freq\_amp] = analogRead(DC\_One);_  
_Frequencies\_Two[freq\_amp] = analogRead(DC\_Two);_  
_digitalWrite(STROBE, HIGH);_  
_digitalWrite(STROBE, LOW);_  
_}_  
_}_  
_/ **Light LEDs based on frequency detection** \*\*\*\*\*\*\*\*\*\*/_  
_void Light\_LEDs() {_  
_for (i = 0; i \< 7; i++) {_  
_// Check if frequency range matches LED_  
_if (Frequencies\_Two \>= ledFrequencyRanges[0] && Frequencies\_Two \< ledFrequencyRanges[1]) {_  
 _digitalWrite(LED, HIGH);  
 } else {  
 digitalWrite(LED, LOW);  
 }  
 }  
 }  
 This is the latest code after an evening of many codes with chat gpt. 🙂  
 The effect of the project i am looking for is leds flashing on in time to the beats or different frequencies. When this is acheived the next stage will be sending the voltage to relays turning on and off in time to the music.  
 I have tried a line in from a mixer, phone and laptop. With one code i was getting interference with a usb cable which meant flickering leds with no signal.  
 I have thought i made need pots as an input to adjust frequency ranges live as the board processes different songs. Is the board meant for live or prerecorded. I think the video with chris taylor and the fire used a pre recorded track.  
 Can you recomend another way to process live sound beats and trigger relays if we cant get the board to work.  
 Thank_

---

<div class="post-metadata">

**Author:** ![Protlor](https://avatars.discourse-cdn.com/v4/letter/p/cab0a1/32.png) [@Protlor](https://community.sparkfun.com/u/Protlor)\
**Post date:** [July 14, 2023, 9:33am UTC](https://community.sparkfun.com/t/sparkfun-spectrum-shield-dev-13116/45598/4 "2023-07-14T09:33:07Z")

</div>

The effect so far is that when i adjust frequency ranges i seem to get 2 of 3 leds close to sync in the 1st 3 bands but only 2 leds with certain songs when ranges are tweaked. Pin out 7 8 and 9 sometimes seem to sync but on low frequency’s. Sometimes i get 2 coming on at the same time close to the beat. I am using pins 7,8,9,10,11,12,13. I have tried donna summers i feel love, drumming loops on youtube and drum and bass songs.
