I am outputting a 40kHz square wave from arduino and passing it through an RC circuit in order to get a clean 40kHz sinusoid out. However, the output wave I am getting is noisy.(see picture) Any advice on how to get rid of noise?
Radiated or Conducted?
True error or measurement error?
Ground shift ? probing error**? induction loop current , capacitive coupling?
Also avoid long grounds on scope probe gnd loop near switched inductive sources.
For a 10:1 probe** ground lead , 10cm is too long. Best Test Eng practise is by removing gnd clip and probe tip and use twin test points to tip pin and barrel. If not avail make them with resistor wire leads by cut and solder as test points.
Use twisted pair for all sources of interference and use low ESR caps on Supply. Use braided or heavy ground conductors.
Keep wiring short and neat.
Show schematics and photo of possible source and of interference.