Crazy speaker vibration of my gyversaber project.

Good day everyone! This is my first post in this forum and I am so sorry to throw out brunch of questions.
Since English is not my first language so thanks in advance of being patient to read my shitty English.

So…
I am trying to build a lightsaber following the gyversaber project.

However, i made some changes as below :-

  1. Since the mpu6500 doesn’t work with the GND connected to A1. I connected GND to GND instead(as my attachment)
  2. The SD module I bought need 5V input so I connected the VCC to Arduino 5V.
  3. I haven’t connect the LED strip yet. Just want to make sure everything is working until this stage.

And I start it up. I can hear the power-up sound effect which is fine. And then the speaker starts to vibrate like this.(https://youtu.be/iBbtJZwlYtI) When I move the MPU6050, different sound effect play normally. But when it is idle, it vibrates. I tried to remove the HUM.wav, it vibrated. I tried to remove the SD card, same happened.

I have been trying to figure this out for a month, fried couple of Arduino and amp and step down and my brain…
I ran out of idea so I hope you guys can help me with this…

I can’t attach the code to this post. It exceeded the max length of 9000 characters or something.
I put it in txt instead. please find it in the attachment

gyversaber.txt (17.5 KB)

You call toneAC(freq_f) ;, which is set to 20 initially, so you get 20Hz square wave when not playing samples and not in HUMmode.

You also have code that varies freq_f between 18 and 300 Hz.

But I meant the clicking is not normal right?
How do I reduce the clicking? I guess I have to install a capacitor somewhere in the circuit.
Would you mind telling me where should I put it and the uF?

Well you have already discovered what a crappy circuit this is. This problem looks like it is down to the amplifier. It is a class D amplifier and they sometimes do this when there is a little leakage signal on them. Put a 4K7 series resistor on the input line with a 1K to ground. Wire the R input of the amplifier to ground and finally put a 1000uF capacitor across the amplifier’s power pins.

fried couple of Arduino and amp and step down

Do you wire stuff up with the power applied? That would fry anything, never wire stuff when it is powered up.

The other form of crappiness is that you have two faults that might balance themselves out. First there is normally not enough signal out of a 3V3 system to drive a WS2812 strip, but due to the step down being only 4.5V and not the 5V it might be you could get away without a proper level shifter. And I don’t mean an I2C one either.

Grumpy_Mike:
Well you have already discovered what a crappy circuit this is. This problem looks like it is down to the amplifier. It is a class D amplifier and they sometimes do this when there is a little leakage signal on them. Put a 4K7 series resistor on the input line with a 1K to ground. Wire the R input of the amplifier to ground and finally put a 1000uF capacitor across the amplifier’s power pins.
Do you wire stuff up with the power applied? That would fry anything, never wire stuff when it is powered up.

The other form of crappiness is that you have two faults that might balance themselves out. First there is normally not enough signal out of a 3V3 system to drive a WS2812 strip, but due to the step down being only 4.5V and not the 5V it might be you could get away without a proper level shifter. And I don’t mean an I2C one either.

May be this is not a good project for a beginner like me. I will follow your instructions and try it out in few days.
One think for sure I have a lot to work on my soldering skill… And I have done a lot of trial and error to solve the problem without thinking too much… That’s how I fry the component.

Anyway, thank you for your reply, hopefully no more clicking and after this I will design my own project.