Skip to main content

Designing Analog Hardware

Avoid Noise In Analog Hardware Design

Most imps include multiple Analog-to-Digital Converters (ADCs) and Digital-To-Analog Converters (DACs), which allow you to handle analog applications without additional hardware. To add to the power of this hardware, the imp API includes classes for analog sampling and fixed-frequency analog output, enabling your device to record and play full analog waveforms. Some applications that make use of this functionality include:

  • Single readings of analog voltages, allowing your design to measure its battery voltage or read simple analog sensors, such as thermistors
  • Fast sampling of analog sensors. For example, fast sampling of an analog accelerometer to detect and characterize vibration
  • Audio recording and playback

For more information on developing Electric Imp application firmware to record and playback analog waveforms, please take a look at the software-oriented Developer Guide ‘Audio Waveforms And The imp’.

Depending on the application, signal integrity becomes very important in getting good performance from your design. Some simpler applications, such as reading a low-precision sensor like a thermistor, may not require the considerations covered in this guide. For others, such as audio or electrochemical sensors, a few mV of noise can seriously impact performance, causing audible noise in an audio recording or introducing significant error in a sensor reading.

If your design involves recording or playing back full waveforms, or if you’re doing discrete analog readings that can’t tolerate perhaps 50mV of noise, this guide has important information that will help you optimise your design quickly.

The power story for your design has the largest bearing on vulnerability to noise, so this guide spends a fair bit of time on how your design will be powered. It also covers avoiding noise from aliasing and crosstalk.

Aliasing

In order to understand how various sources of noise impact a signal you’re attempting to record, it’s important to understand aliasing.

When any analog waveform is sampled, the maximum frequency that can be faithfully recorded is half the sampling frequency (the Nyquist Rate). If higher-frequency signals are present in the sampled waveform, they will be aliased to a lower frequency; the sampled copy of the high-frequency signal will be indistinguishable from a copy of a lower-frequency signal.


 
Aliasing occurs when a high-frequency signal is sampled at a much lower frequency,
appearing as a lower frequency than the original signal.
"AliasingSines" by Moxfyre is licensed under CC BY-SA 3.0

 

Aliasing can cause serious problems when recording analog waveforms. For example, consider an audio recording application. If an inaudibly high-frequency sound is present when the recording is made, it can be aliased into an audible sound, introducing noise.

To avoid aliasing, an anti-aliasing filter is recommended. An anti-aliasing filter is an analog filter, which filters the incoming signal before sampling. This filter should attempt to block any frequencies above the Nyquist rate of the sampler, ensuring that any signal present can be recorded by the sampler.

The Lala reference design includes a second-order Butterworth low-pass filter for anti-aliasing. This filter effectively blocks frequencies above 8kHz. If the sampler is run at 16kHz, this filter is effective in preventing any high-frequency noise from being aliased into the signal.


 
Frequency Response of the Lala anti-aliasing filter. Plot generated by Analog Devices’ Filter Design Wizard
 

Even if your application doesn’t focus on audio, it’s important to consider aliasing. Just as this phenomenon can take inaudibly high-frequency noise from a microphone and move it into the audible band, it can also move high-frequency noise from power supply ripple or load transients and move it into the frequency range of interest.

The Power Supply

The key to recording and playing back ‘clean’ analog waveforms is to provide ‘clean’ power to all portions of your analog design. Noise on the power supply of any components that touch the analog signal will be transferred, to some degree, into the analog signal. There are many sources of noise that affect the power supply. Load transients and ground noise are two very dominant sources of noise that affect every design.

Load Transients

The most significant source of noise in your design will probably be load transients on your power supply. Many parts of an Internet-connected device (the WiFi radio and processor, as well as other components your design may include, such as a SPI Flash) draw current from the power supply in large, sudden spikes, causing the entire power rail to ring. When this ringing reaches the analog portions of your design, it will cause noise. To minimize noise from load transients:

  • Use bypass and filter capacitors as recommended on all major components in your design Bypass capacitors filter high-frequency noise. On devices which exhibit substantial load transients, bypass capacitors help prevent that noise from reaching the power supply rail. On other devices not causing transients, bypass capacitors help prevent noise on the rail from reaching the component.

  • Separate your power supply rail into a Digital domain and an Analog domain The analog portions of a design often require much less power than the digital or high-power portions of the design, so it’s often possible and practical to use a separate power supply to drive the analog portions of the design. This can provide excellent isolation for devices in the analog domain from load transients caused by high-power devices in the digital domain. This is covered in greater detail shortly.

Ground Noise

When current passes through a power or ground path in your design, it will cause a potential difference across that trace; this is simply Ohm’s Law: V = IR. If there is a potential difference between the ground connection at one part and the ground connection at another, the difference is noise. Measures that can be taken to reduce this noise include:

  • Ensure a low-impedance path to ground for all of your components, especially high-power components By ensuring that the impedance of the ground return path is low, your design will minimize the potential difference between different points on the same electrical net. To minimize impedance:
    • Use thick traces for high-current nets Narrow traces have a higher DC resistance; thickening a trace reduces its resistance.
    • Avoid running high-current nets through a single via While a single via may be rated for the DC current your application will require, the resistance of the via is significant. If possible, avoid changing layers with high-current nets entirely.
    • Use ground pours and stitching vias Flood ground on the top and bottom of your PCB to provide a good ground path to all components, and stitch the ground pours with vias around the edge and throughout the middle of the board.
  • Use a reference ground Similar to separating the power rails into digital and analog domains, it can be advantageous to separate the ground into separate domains. Low-power, analog devices are placed on an ‘analog ground’, which ties to the imp and to the ‘digital ground’ at a single point, physically located right next to the imp. Because very little current flows over the analog ground path, and the ground path is carefully routed to ensure low impedance, the imp and the analog components ‘see’ the same ground potential.

Using Separate Analog And Digital Power Domains

The best way to deal with noise from load transients is to avoid the load transients all together. For maximum isolation between noisy digital components and sensitive analog components, consider using separate power supply rails for these two domains.

In designs which are always-on, where battery life is not a critical parameter, providing separate analog and digital rails can be very simple. In this case, the 3.3V supply for the imp and other high-power components may be regulated with a DC/DC switching regulator or an LDO, depending on power and cost requirements. The analog supply can then be generated with an entirely separate power supply. An LDO is an especially good fit for creating an analog rail, as it does not generate ripple as a switching regulator does.


Example Block Diagram: Separate Analog and Digital Supplies
 

In some cases, it may not be practical or possible to derive separate analog and digital rails as shown above. There are still options for isolating analog components from digital noise:

  • A separate analog rail can be generated from the digital rail For example, the Lala reference design derives a 2.8V analog rail from the 3.3V system rail with an LDO to help remove processor and WiFi noise from audio signals. This method is less effective than deriving the two supplies separately from a common source. Because a small, low-Iq LDO can be used to derive the analog rail, this strategy can be very effective in designs where battery life is critical.


Analog Rail derived from Digital Rail with an LDO; the LDO acts as a filter. Note that this is not possible with some imps.
 

  • An LC filter on the power supply between the analog and digital domains can provide some isolation This method is most effective at removing high-frequency noise; long load transients from events like WiFi transmit will still generate noise on the analog side of the filter. This strategy may still be suitable where some noise can be tolerated in order to achieve lower component count and BoM cost, such as a simple intercom or an analog sensor that can be read several times and averaged.


A Pi Filter
 

VDD And VDDA

imps have has several separate power domains internally, which are broken out differently depending type of imp being used. For most applications, it is simplest to tie these domains together externally. In applications which use a separate analog supply rail. However, the analog supply may also be used to supply the reference voltage for the imp. The specific electrical requirements for each imp type should always be taken from the datasheet for that type of imp.

The internal power domains of the imp:

Name Role
VDD Digital Power Rail. Provides power for the Processor, WiFi Radio, and other parts
VDDA Analog Power Rail. Provides power for the ADCs, DACs, internal timing, and other parts
VREF Reference Voltage. Provides a reference for the ADCs and DACs
  • For imp001, all three domains are tied together internally. Power is provided on the VDD pin and used for all three domains.
  • For imp002, VDD and VDDA are tied together internally; the external "VDDA" pin is used to supply VREF internally. The voltage on the VDDA pin must never exceed VDD; if separate supplies are used, the supply connected to VDDA must come up with or after the supply connected to VDD. Note also that if the VDDA pin is not within operating range, BlinkUp will not function, as it requires the ADCs to be powered on.
  • For imp003, VDDA and VREF are tied together internally. The "VDD" pin supplies power for the digital portions of the module, and the "VDDA" pin supplies power for internal timing components as well as the reference voltage. On imp003, VDD and VDDA must never differ by more than 50 mV; these supplies must therefore be brought up simultaneously. Note that this typically prohibits the use of a switching power supply for VDD and an LDO for VDDA, as the LDO will typically bring up the rail much more quickly than a switching power supply.
  • For imp004m, please see ‘Working with Audio on the imp004m’.
  • The imp005 lacks ADC and DAC hardware so is not relevant to this discussion.

DC/DC Ripple

A DC/DC switching power supply operates by switching current through an inductor. Switching DC/DC converters naturally create some ripple as the inductor in the power supply is switched and the output capacitor is charged and discharged. While this ripple is typically very high-frequency (into the tens of megahertz), this noise will be aliased down to lower frequency ranges when sampled. Worse still, because this noise effects the very components used to implement an anti-aliasing filter, the anti-aliasing filter will not protect against it.

  • Follow the recommended layout for your switching power supply This usually involves using short traces for signals on each side of the inductor, and routing the power supply output through an output capacitor before passing it on to other parts of your design.


The recommended layout for the TPS62172, a commonly used DC/DC Buck Power Supply IC, from TI’s Datasheet
 

  • Keep vulnerable components away from the inductor The inductor in a switching power supply can magnetically couple with other components in your circuit, particularly those with high inductance, such as long traces. When two inductors magnetically couple, the resulting circuit is effectively a transformer, allowing noise to move between two electrically unconnected nets. To avoid this, keep sensitive components away from the switching power supply, follow the recommended power supply layout, and be sure to use decoupling capacitors throughout your design.

  • If possible, use an LDO to provide the analog supply Because an LDO does not work by switching current through an inductor, it produces less ripple and removes the vulnerability to inductive coupling.

Crosstalk

Crosstalk occurs when two electrical nets inductively couple, causing the signal on one net to bleed into the other. High-frequency signals are more likely to cause crosstalk, as inductive coupling happens more readily at high frequency. To minimize the risk of inductive coupling and crosstalk, keep high-frequency nets physically separated from sensitive analog traces.

For example, consider an application that uses SPI for high-speed signalling, and also includes analog input and output. It might use hardware.spi189: pin 1 serves as the clock, pin 8 as MOSI (‘Master Output, Slave Input’) and pin 9 as MISO (‘Master Input, Slave Output’). These signals need to be kept as far away as possible from analog signals, preferably with a ground pour in between the high-speed traces and the analog traces to act as a shield.

Early versions of the imp include a pair of pins that is especially susceptible to crosstalk. For each of these pairs, if one of the pins is used for high-speed or analog signalling, the other should not be.

imp Type Pin Pair
imp001 1 and 2
imp002 1 and 2
imp003 A and B

Later imp versions (imp003 and up) are not affected this way.