What's wrong with this simple PCB design? (midi synth)

I am designing a simple synth with Arduino (just the Atmega IC) and it works fine. The only thing is this annoying clicks I barely hear constantly if I raise the volume somewhat.

I had this problem in the past that’s why I was trying to fix it by designing the PCB, separating 3 ground sectors in digital and analogue parts on one side of the PCB. In theory that should stop the digital part contaminating the analogue part. It seems it didn’t quite worked because I can still hear the clicks.

There are two things making clicks at the same time, according to my tests:
1- the Atmega crystal: If I remove the Atmega, that click stop.
2- the Midi messages: When Midi is not connected, there is no click. After each midi message is sent (a note or clock i.e) I hear a click. For example the clock makes a constant stream of clicks and are sped up if I increase the tempo on the master device sending the BPM. If I take the Atmega IC and send midi messages, I can hear the clicks, so it’s independent of it. That’s why I’m thinking it’s a PCB design issue

To strip down the problem I removed the LM358 part where the “scissors” are in the schematic picture and I just get the output from where it says PWM, that’s just the output from the atmega IC.

So, my question is: Do you see any PCB design flaws? What could be causing the click noises?

Thanks!!

PD: I can attach Eagle file if requested.

Let me try to help you since no one else has replied.

It's going to be difficult to give you definite answers because you have only supplied a PCB Layout. Schematics would be far more useful. Of course removing the Crystal will stop the clicks, that's because once it's removed there is really no digital circuitry in operation whatsoever.

Generally Digital Pulses can infiltrate Analog Circuits very easily. So steps must be taken to isolate this. The most common place that this can happen is through the Power Rails. The V+ Rail is just as prone to transferring them as the GND is. First each chip should have it's own Decoupling Capacitors as close to the power pins as possible. You generally want to use higher grade Caps in the range of 0.01 to 0.1µf. Ceramic Caps are the lowest grade I would use.

If you can use a second 78L05 Regulator to supply power to just the Analog Section and Filter it well that "may" completely remove the clicks. The ATmega Chip may also generate clicks when changing frequencies. Finally the coupling between the ATmega Output and the LM-358 Input may need to be AC Coupled if you now have it DC Coupled.

Hope this helps.

I think the basic issue is that you are deriving an analog signal from a PWM pin which is on the digital supply bus. You should try adding much more decoupling to the supplies on the 328, ranging upto 1000uF, perhaps 0.1uF, 10uF, 1000uF.

There is no point separating the analog and digital supplies on the 328 chip itself, you are not using the ADC or analog comparator.

The values of R21 and R23 are 1M. That is going to make the output a very high impedance. A high impedance is very susceptible to picking up rubbish. To avoid this make the impedances 3K3 or lower. Note that is not make the resistors that value but the overall impedances.

What are you trying to do here make a 16 bit PWM output from two 8 bit ones? If so that is not going to work anyway unless you have super precise resistors which I suspect you haven't.

Bang on, those 1mΩ resisters could definitely be a part of the problem.

High Impedance Analog Circuits are always susceptible to noise.

As far as decoupling goes it's always a good idea to start with low value high grade caps that properly filter out high frequency noise. Next we can add higher value caps like 10µf or higher Electrolytes'. This is standard practice especially in computers and older digital technologies. This article has nothing to do with Analog Circuits but the principles explained in it apply to any and all types of electronic circuits. In a nutshell Chip Output Switching and Interconnects such as wires and even circuit board traces have resistance, capacitance and inductance that add to digital noise getting where it shouldn't.

http://www.vagrearg.org/content/decoupling

There are two main reasons to start off with smaller value, high grade caps. Size and filtering. Electrolytic Caps are terrible at filtering out high frequency noise and they are large. Smaller high grade caps filter out these high frequencies and don't substantially increase your board size.

Thanks