In my last post I talked about two interference noises in the speaker output. In this post I will explain my understanding of where the interference is occurring, and what I did to reduce them.
1. The low frequency interference (~25 Hz)
This noise is there whenever I have the Arduino board connected to the system. The amplitude of this noise increases significantly when the Arduino is sending data to the RGB strip or sending data over to the computer. When the Arduino board is taken out from the system the noise disappears.
The Arduino board is powered by a computer USB port. Any variation in power levels of the USB port will also affect the speaker amplifier system. To test this I removed the USB port connection and powered the Arduino board with a linear voltage regulator outputting +5V. This reduced the noise notably, but not completely.
In the Arduino board, in addition to the microcontroller there are other systems that use power even when the microcontroller is not doing anything. For example, the on board regulator and the FTDI chip that facilitates USB communication. These devices could affect how much current is flowing in the power rails leading to variations in the power rail voltages. The amplifier is very sensitive to changes in the power rail voltages.
So I decided it is better to have a stand-alone Arduino microcontroller (ATmega328p) on the breadboard. Moving the microcontroller from the Arduino board to a breadboard involves a few additional components. I found this tutorial that explains how it is done very well. Schematic below shows how I implemented the ATmega328p on my breadboard.
The stand-alone breadboard microcontroller reduced the noise even further. However not completely. Then I ran into another problem; The microcontroller kept crashing at random times. Then I realized that I haven’t put any decoupling capacitors on the microcontroller power pins. Adding 10uF decoupling capacitors to the power pins stopped the microcontroller from crashing. A good lesson of the importance of decoupling capacitors in stabilizing the power to a device.
2. The high frequency interference
This high frequency noise is present whenever the LEDs on the RGB strip are lit. The noise is proportional to the number of LEDs lit.
If this noise is entering the speaker amplifier through the input signal, then its intensity should increase when the volume of the input signal is increased. However, increasing the volume of the input signal had no noticeable effect on the noise.
After doing a bit more research into amplifier noise sources on the web, I noticed a problem with the way I have wired the components on my breadboard. On the breadboard I have the amplifier ground, signal input ground, the speaker ground, the microcontroller ground and the RGB strip ground all wired to different locations within the breadboard. They have long leads that connect them to the terminal of the power supply ground as in the diagram below. This way of wiring leads to an unstable ground rail as the voltage in different sections of this rail will be different due to different amounts of current flowing through them.
One solution to this is to use a ‘star’ grounding system as shown in the diagram below. In a ‘star’ grounding system all the ground leads from different devices in the circuit connects directly to a single point (hence the name ‘star’) close to the power supply ground connection.
After rewiring the amplifiers, speaker and the RGB strip in a ‘star’ grounding method, the high frequency noise was greatly reduced. This method also helped to reduce the low frequency noise even further.
I am now satisfied with the Music and Lights system on the breadboard to move it to the next step, which is to design the PCB layout! Proper layout (including a large ground plane) and solid connections on a PCB should take care of the remaining interference. That will be another blog post.