I have built a circuit with an Arduino Nano to measure frequency from my music, it's basically this schema but I changed the code a little bit to fit my needs.
My problem is I want to add a Relay (I have an arduino single relay module) to the circuit and when I connect the signal on my 5v, it create a lot of noise in the frequency I get from ArduinoFFT.
What my code is doing is getting an average of the frequency to detect if music is currently playing. Here is a sample of data I get when there is no music playing:
2 2 2 4 1 0 0: 1
2 2 4 1 0 0 1: 1
4 4 1 0 0 1 0: 1
1 1 0 0 1 0 4: 1
0 0 0 1 0 4 1: 1
0 0 1 0 4 1 5: 1
1 1 0 4 1 5 3: 2
0 0 4 1 5 3 2: 2
4 4 1 5 3 2 0: 2
1 1 5 3 2 0 0: 1
Here, this is with music (good old rock :) ):
16 16 22 17 20 21 29: 20
22 22 17 20 21 29 28: 22
17 17 20 21 29 28 22: 22
20 20 21 29 28 22 25: 24
21 21 29 28 22 25 28: 25
29 29 28 22 25 28 27: 26
28 28 22 25 28 27 32: 27
22 22 25 28 27 32 27: 26
25 25 28 27 32 27 29: 28
28 28 27 32 27 29 23: 27
And finaly when I connect the relay (with arduino digital pin or if I jump it with the 5v, it the same result):
5 5 5 6 4 4 7: 5
5 5 6 4 4 7 5: 5
6 6 4 4 7 5 4: 5
4 4 4 7 5 4 4: 4
4 4 7 5 4 4 5: 4
7 7 5 4 4 5 4: 4
5 5 4 4 5 4 4: 4
4 4 4 5 4 4 4: 4
4 4 5 4 4 4 6: 4
5 5 4 4 4 6 4: 4
The problem with this is that when I'm playing smooth music, the numbers are not that high, it's basically the same as when the relay is on.
Here is a schema of what I did, it's my first try, let me know if anything is not fine with it.

simulate this circuit – Schematic created using CircuitLab
