I'm reading this great book (AVR Programming: Learning to Write Software for Hardware by Elliot Williams) and setting up my arduino atmega328pu, usbasp programmer and using avrdude to program the chip.
The book shows the following setup to power the chip off the computer's USB port via the USBASP programmer.
The author explains that you should use a 100 nF (0.1 µF) across the VCC to ground to smooth the voltage.
How is that value (100 nF (0.1 µF)) calculated or determined? I know 5V is coming off USB port of computer and I'm wondering how that factors into the calculation.
What Does That Do?
Does that basically "short" certain voltages directly to ground -- when voltage spikes?
Part 2 : A Similar But Different Example
There is also a similar set up of a mintduino but the author is using a 9V battery so the voltage is different but in that case the writer/experimenter shows it hooked up like the following*:
Of course you can also see that this experimenter is setting up the atmega328 to use an external crystal (16 MHz) but he uses two smoothing caps of 22pF and he puts one serially on each pin (XTAL1, XTAL2), each connecting back to ground.
Basic Explanation?
Can someone provide a bit of an explanation of how these are similar or different?
General Formula?
Can someone provide a general formula for calculating the cap values I should use in instances where the voltage is different?
*You can see the entire mintduino article at: https://makezine.com/projects/build-a-mintronics-mintduino/