Comments: Spectrum Shield Hookup Guide
Looking for answers to technical questions?
We welcome your comments and suggestions below. However, if you are looking for solutions to technical questions please see our Technical Assistance page.
If you've found an issue with this tutorial content, please send us your feedback!
-------------------- Tech Support Tips/Troubleshooting/Common Issues --------------------
SparkFun_PWM_Demo.ino
Limitations of PWM Output
Not all of the Arduino Uno's I/O pins are capable of PWM. Looking at the analogWrite() [ https://www.arduino.cc/en/Reference/analogWrite ], PWM can only work with "3, 5, 6, 9, 10, and 11". If you are trying to use analogWrite() on certain pins in the "SparkFun_PWM_Demo.ino" , the LED will not have varying brightnesses because it is not capable of outputting PWM. You might want to adjust the pin definitions here = > [ https://github.com/sparkfun/Spectrum_Shield/blob/master/Firmware/SparkFun_PWM_Demo/SparkFun_PWM_Demo.ino#L27 ] due to the limitations of the Atmega328P. From my observations, the LEDs were mostly off where it was connected to pins that could not PWM.
You might want to consider using using less LEDs for PWM, expanding the I/O using a MUX, or using an Arduino Mega 2560 with the PWM demo since it has more than one PWM pin. The pins do not have to be rerouted since PWM works on pins "2 - 13 and 44 - 46."
Constrain() Function
You might want to use the constrain() function [ https://www.arduino.cc/en/Reference/Constrain ] since the output value for analogWrite() between 0 and 255. If the audio signal has the maximum volume, the analogWrite()'s value will be out of range.
Buzzing or Humming Noises?
Speaking from experience, there is some sort of buzzing noise if you listen to the audio signal from the audio jack labeled Output as the Arduino microcontroller turn on/off I/O pins. You will hear it when you turn your volume down really LOW. When the Arduino microcontroller has a certain I/O pin turned ON, the power output from the LEDs is coupled to the audio signal. You will hear more buzzing/humming when you have more LEDs that are turned ON.
You might want to add a capacitor, blocking diode and splitter, or use a wireless audio bluetooth to send it out to the spectrum shield. By turning the volume close to the maximum, you will not hear the buzzing/humming as much. When testing the code with a digitalWrite() function on the pins, I was able reduce the buzzing/humming since the I/O pins were turned off more frequently.