Capacitor / Diode

Hi
Im saw a Picture of a arduino getting power from a DC-DC Buck Down converter. From 12 to 5V
The to pins on the Board (see attachement) is for the wire from the Buck converter.

I guest the capacitor is to avoid spikes.

Is it always a good thing to have a capacitor when getting power from a Wall plug?

And has the diode something to do with the capacitor/Buck converter?

Regards
Jakob

Sorry but your photo shows nothing I can make any sense of. Without a schematic it is difficult to know what is connected to what.

Capacitors across the supply are always a good thing; can't have too many of them. (Well, OK, if you can't get into your room for capacitors and your cat is lost behind them and can't get out then you probably have too many capacitors)

Seriously, given your question and the photo I don't know how to be more helpful. Sorry.

Start by going to this link: https://micro.rohm.com/en/techweb/knowledge/acdc/acdc_pwm/acdc_pwm04/3551 it will give you the fundamentals of the Buck Converter. The output of the converter is a pulsing voltage, which electronics do not like. The simple solution is to put a capacitor across the output to smooth out the voltage. The cap charges when the waveform is high and discharges supplying power when the waveform is low. There are many things to consider when using a capacitor. If you have to much the converter may not even start or blow its switching device, if there is not enough you will have a lot of ripple on the CE, neither is good. As regart to frequency they normally use a small cap maybe 0.01uf to filter out the high frequency components. The switching frequency and configuration have a big impact on the capacitor selection.
This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil