[![schematic](https://i.stack.imgur.com/2sKdK.png)](https://i.stack.imgur.com/2sKdK.png)

The picture shows the circuit I am working on. A sinusoidal burst of 4 MHz (24 cycles) is generated from a waveform generator. This sinusoidal input is connected to a comparator IC through an SMB jack as shown in the schematic. This comparator IC is powered by a microcontroller that is connected to a PC through a USB cable. The idea is to convert this sinusoidal wave into a square wave.

Although I am getting a square wave, there is also a lot of noise/disturbance (shown in the red circle).

[![square wave](https://i.stack.imgur.com/TS2hI.jpg)](https://i.stack.imgur.com/TS2hI.jpg)

There are a lot of other components connected to the microcontroller as well. I am working on a perf board and the components are connected something like the third picture.

[![back of the perfboard](https://i.stack.imgur.com/ayh4n.jpg)](https://i.stack.imgur.com/ayh4n.jpg)

Since the board is connected with many overlapping wires, I suspect that is the source of this noise. The 3.3 V pin of the microcontroller is especially very noisy. Would that be the right way of thinking? If yes, what would be the correct way to rectify this issue on the perfboard itself?