16Hz spikes from SPI on ATmega1284p

I'm using an ATmega1284p to control an LPD8806 LED strip. I am powering the light strip and the MCU separately with a common ground between them and the LPD8806 data & clock pins are connected to pin 6 (MOSI) and pin 8 (SCK) respectively. I'm using a 16MHz crystal oscillator with 22pF caps to ground, both pins 10 & 30 are going to 5V, and both pins 11 & 31 to ground.

Everything is working correctly except that I am seeing 16Hz spike noise on other MCU pins as soon as I connect the data and clock pins of the light strip. For example, here's a screen grab from the scope monitoring ADC0 (pin 40):


And, zoomed in:


As you can see, the spikes on ADC0 are around 500mV, so fairly significant. I've tried adding decoupling caps across Vcc to GND on both sides of the chip (10 to 11, and 30 to 31), but it didn't make any difference. I'm assuming the source of the signal is the SPI communication but I don't understand how it is affecting the other pins. I measure the spikes at 61ms, so it's right at 16.4Hz and very consistent. Any help is much appreciated, and please let me know if you would like any additional information.


Fiver: For example, here's a screen grab from the scope monitoring ADC0 (pin 40):

Other than the scope probe what is connected to ADC0?

The output of an LM321 opamp. The opamp is powered from a 9V supply, and that 9V supply also feeds a 5V voltage regulator that provides the 5V power supply for the MCU. The light strip has it's own separate 5V supply, but shares ground.

Sounds like your own put together board.

Did you add bypass caps?

Ahh I see you did.

Did you scope your 5V supply and your 9V supply.

Yes, it's a standalone ATmega project. I was using a ATmega328P but ran out of SRAM so upgraded to the 1284. Now I'm back in business as far as the memory is concerned...thousands of LEDs!!! But, I'm now seeing this 16Hz blip that I swear wasn't present on the 328.

I've looked at all the rails. Here's the 5V for the MCU with the light strip connected to pins 6 & 8:


And with those pins disconnected:


As you can see, the glitch disappears when those pins are disconnected. Everything else in the circuit is left untouched between those shots. When I first saw the glitch I thought it was common mode noise from somewhere, so I turned off all the fluorescent lamps, unplugged all the unrelated devices, put in decoupling caps, and even held my tongue at various angles but nothing worked. I finally realized those 2 pins were the only thing making the difference but I really don't know how to isolate them.

Did you try to twist all wires going to and between the LED strips ?

If you could post your code and a connection diagram, it could eliminate some guesswork. Right now, I'm guessing that the 16Hz is just your loop frequency (iteration speed) and the spikes are due to insufficient decoupling, poor grounding or an inadequate power supply.

Note: If you're using the adafruit 1m long strip with 32 leds, the maximum load @ 5V would be 16 x 120mA = 1.92A

dlloyd, I'll try creating a minimal circuit/code combo that exhibits the issue when I get home later. I suspect you are correct that the signal is coming from something in the loop and the loop frequency is ~16Hz. This should be easy to test by adding a delay in the loop. I'll try that and post back.


Thanks, it turned out to be an insufficient power supply. Around the time I switched the 328P out for the 1284P I also had the bright idea to power everything via a Voodoo Lab Pedal Power, which is meant to power guitar effects pedals. I failed to notice it maxes out at 100mA.

FYI, the spike originated from calling the setPixelColor() function from Adafruit's LPD8806 library. Setting a delay in the loop decreased the frequency of the spike and commenting out that call removed the spike altogether. Switching to an appropriate power supply for the light strip solved the problem.

Thanks again to everyone for taking the time to help!

Thank you for the follow-up.

Looks like I spoke too fast. The problem was not solved using the different power supply. I’m not sure what made it seem like it was resolved, but I’m still seeing the spikes. I’ve created a minimal circuit exemplifying the problem and posted on stackexchange electronics forum here.

Here’s the minimal circuit:

and the code:

#include <SPI.h>

void setup()
void loop()

Monitoring the ADC0 pin I can still pick up the SPI signal:

I think its the high current load of the RGB led strip if driven to max brightness (white). Your power supply may need a large capacitor as they've used here

Do you still have the problem with the RGB led strip disconnected?


Check out the last comment here regarding switching power supply: http://electronics.stackexchange.com/questions/86638/random-spi-signals-on-lpd8806-led-strip


I was able to replicate the issue without the LED strip. There's only the chip, a 16MHz crystal w/ 22 pF caps, and the power/ground wires. However, the artifact only shows up on other pins when I probe either pin 6 or 8. So it does seem that some load on those pins is necessary to replicate the problem.

Also, there's nothing special about finding the spike on ADC0, it shows up when probing other pins as well. Really seems like decoupling caps should fix this...should there be caps on both the Vcc and AVcc? How about the AREF? Also, for the decoupling I've used 0.1uF ceramics, as well as 2.2uF, 22uF, and 47uF electrolytics. Would it need to be higher than that?

Yes, you should have 0.1uF caps on all VCC pins, AVCC, and Aref.