Using capacitors on projects


I'm confused about using capacitors. In a project Im trying to shorten the cable from arduino or powersupply to a capacitor and with my limited knowledge im afraid i might be bypassing the capacitors as such. The two attached images. Are they basically the same thing?

In one image there is a USB power supply. And that is connected to a capacitor AND THEN to the arduino board and to an LED strip.

The other image is the capacitor and power supply both directly soldered to arduino board.

This is where the 1000uf capacitor came from:
https://www.arduinoplatform.com/arduino-visual-output/controlling-and-powering-neopixels-with-arduino/

and this is the other capacitor:
https://www.instructables.com/Smooth-Potentiometer-Input/#discuss

I think its best not to just copy the sample without some indication of the intent. Besides the first referenced is wired wrong.

So:
The 1000µf capacitor is there to keep the 5V at 5V when the neopixels change quickly (like flashing on / off). It acts kind of like a shock absorber to stop the 5V from changing quickly.
It should be connect across the Neopixel's input power. (there white stripe is negative, accidently reverse them and the capacitor will over heat and split open. A really nasty smell is released)

The 10µF capacitor is to stop the Analog input from changing fast. Mostly to remove any noise on the input signal. Similar to above. I believe this capacitor should be more like 0.1 or 1.0µf

Thank you john. Could you clarify what you mean by the first referenced being wired wrong?

I apologize for my question being more basic. my main issue is the placement of the capacitors. You see there is a power line coming from usb, connecting to a capacitor, then going to the arduino vin and ground.

Does this mean I can solder the capacitor directly to arduino vin and ground, and also solder the usb power directly there? Does it need to be in such order that there needs to be a cable between capacitor and arduino?

In general, caps are for 3 things. To provide a reservoir of current to keep voltage stable, to bypass noise to ground and to pass AC signals while blocking DC. The third is of no use in this context, but the other 2 are. Higher value caps are used as reservoirs (ie.1000uF) and lower values to bypass noise (0.1uF, 1uF). As a rule of thumb, caps should be placed close to where the problem that they are to solve occurs. So in the case of the LED strip the cap should be closer to the LED strip than the LED strip's power supply. Or In the case of the pot, the cap is to bypass noise that the wire from the pot to the Arduino picks up from the environment. So put the cap at the end of the wire close to the Arduino.

In the case that the 5v powersupply is coming from a powerbank, or a quality 5v phone wall charger, do the first 2 points still help?
1)reservoir of current to keep voltage stable,
2) bypass noise to ground

Do i still need this cap if the powersource is a Powerbank?

The LEDs still have surges in current demand when turning on and off a bunch of pixels at once and the noise is still picked up by the wires in the pot circuit so those things happen regardless of the power supply. The power bank may deal with those surges better, but it is better to be safe than sorry. An old timer once told me, "you can't have to many caps (within reason)", and, I go by that. You just need to understand what each type of cap does for you and apply them correctly.

thank you. I'm trying to understand this quote. Can we say that all these are done in the second drawing above? The cap for the led strip is directly connected to Vin and gnd of arduino (which ledstrip is also connected to) therefore the cap is relatively closer to led strip.

and in the case of low pass filter for pot the cap is connected directly to arduino as well.:

The input power is shorted out by being connected to the same strip on the solderless board.

In general you want the capacitors to be closest to the load. However in your case the leads are so short it doesn't matter.