Bypass capacitors: no black magic here
A basic requirement for all electronic circuits is the inclusion of bypass, or decoupling, capacitors. These devices reside across the positive supply to ground, as close as possible to the supply pin of the active device. You may get away with excluding these capacitors in low-frequency circuits, but many low-frequency active devices have high-frequency entities inside the active devices. An example of a supposed "low-frequency device" is a microcontroller that uses a low-frequency system clock. Granted, the clock's frequency is slow, but the internal-gate transitions can occur in nanoseconds. Without proper power-supply filtering, these rising and falling glitches will traverse the circuit. The first step to proper supply filtering is to include a properly valued bypass capacitor.
Digital devices are not the only chips that require bypass capacitors. Analog circuits also benefit from including bypass capacitors but in another way. Although bypass capacitors in digital systems control fast rising- and falling-time glitches from the device, bypass capacitors in analog systems help reduce power-supply noise at the analog device. Typically, analog devices have built-in, preventive power-supply filtering or line-rejection capability. These noise-rejection mechanisms effectively reduce low-frequency power-supply noise, but this scenario is not the case at higher frequencies.
Typically, manufacturers include suggested bypass-capacitor values in their data sheets, but you can also determine the proper value on your own.
For instance, with microcontrollers or microprocessors, you can calculate the bypass-capacitor value when you know the typical rise and fall times (tRISE) of the device signals. You also need the controller's average operating current (IAVE). These quantities are in the product-data-sheet tables. You finally need to define the maximum voltage-ripple noise (VRIPPLE) that your power-supply trace can tolerate. Using these values, you can determine noise frequency with the formula fNOISE=1/(2×tRISE); approximate surge current with the formula ISURGE=IAVE×fNOISE/fMICRO, where fMICRO is the clock frequency of the controller; and calculate bypass-capacitor value with the formula CBYPASS=ISURGE/(2×π×fNOISE×VRIPPLE).
Bypass-capacitor selection for analog devices is another matter. With these kinds of circuits, you need to find the frequency at which power-supply noise affects your circuit. The best place to find this information is with the power-supply- or line-rejection-performance-over-frequency graphs in the product data sheet. Additionally, you need to determine the minimum acceptable noise that your design can tolerate. For instance, with a 12-bit ADC, you can tolerate unrejected power-supply noise of approximately ±¼ LSB for true 12-bit performance. You also need to estimate the power-supply noise-voltage magnitude. With these two parameters, you can refer to the typical power-supply-rejection-versus-frequency curve in the manufacturer's data sheet.
For example, Figure 1a provides the power-supply-rejection-over-frequency curve of a 12-bit ADC. This converter's power-supply rejection is equal to 20 log (VPOWER-SUPPLY-RIPPLE/VADC-ERROR).
If the noise level of your ADC power is ±20 mV (or 40 mV peak) and the allowed error is ±¼ LSB (or 0.61 mV peak, implying 5V full-scale range), the noise from the power supply will show up in the converter's output code at a –36.33-dB level. In Figure 1a, this scenario occurs at approximately 5 MHz. In Figure 1b, the appropriate bypass-ceramic-capacitor value for this converter is 0.1 to 0.01 µF.
Note that these calculations use typical values. Additionally, devices and capacitors vary from part to part. But don't let this situation deter you from using bypass capacitors. The worst of all cases is when you use none.