Silicon ChipPrecision Electronics, part seven - July 2025 SILICON CHIP
  1. Contents
  2. Publisher's Letter: ChatGPT can analyse circuit diagrams
  3. Subscriptions
  4. Feature: The Fox Report by Barry Fox
  5. Feature: Circuit Surgery by Ian Bell
  6. Project: Compact OLED Clock/Timer by Tim Blythman
  7. Feature: Techno Talk by Max the Magnificent
  8. Feature: Max’s Cool Beans by Max the Magnificent
  9. Back Issues
  10. Project: 180-230V DC Motor Speed Controller by John Clarke
  11. Feature: Precision Electronics, part seven by Andrew Levido
  12. Project: Repurposing the Mains Power-Up Sequencer by John Clarke
  13. Feature: Audio Out by Jake Rothman
  14. Project: Intelligent Dual Hybrid Power Supply,.Part 2 by Phil Prosser
  15. PartShop
  16. Market Centre
  17. Advertising Index
  18. Back Issues

This is only a preview of the July 2025 issue of Practical Electronics.

You can view 0 of the 80 pages in the full issue.

Articles in this series:
  • The Fox Report (July 2024)
  • The Fox Report (July 2024)
  • The Fox Report (September 2024)
  • The Fox Report (September 2024)
  • The Fox Report (October 2024)
  • The Fox Report (October 2024)
  • The Fox Report (November 2024)
  • The Fox Report (November 2024)
  • The Fox Report (December 2024)
  • The Fox Report (December 2024)
  • The Fox Report (January 2025)
  • The Fox Report (January 2025)
  • The Fox Report (February 2025)
  • The Fox Report (February 2025)
  • The Fox Report (March 2025)
  • The Fox Report (March 2025)
  • The Fox Report (April 2025)
  • The Fox Report (April 2025)
  • The Fox Report (May 2025)
  • The Fox Report (May 2025)
  • The Fox Report (July 2025)
  • The Fox Report (July 2025)
Articles in this series:
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (June 2025)
  • Circuit Surgery (June 2025)
  • Circuit Surgery (July 2025)
  • Circuit Surgery (July 2025)
Articles in this series:
  • Techno Talk (August 2020)
  • Techno Talk (August 2020)
  • Techno Talk (September 2020)
  • Techno Talk (September 2020)
  • Techno Talk (October 2020)
  • Techno Talk (October 2020)
  • (November 2020)
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
  • Techno Talk (June 2025)
  • Techno Talk (July 2025)
  • Techno Talk (July 2025)
Articles in this series:
  • Max’s Cool Beans (January 2025)
  • Max’s Cool Beans (January 2025)
  • Max’s Cool Beans (February 2025)
  • Max’s Cool Beans (February 2025)
  • Max’s Cool Beans (March 2025)
  • Max’s Cool Beans (March 2025)
  • Max’s Cool Beans (April 2025)
  • Max’s Cool Beans (April 2025)
  • Max’s Cool Beans (May 2025)
  • Max’s Cool Beans (May 2025)
  • Max’s Cool Beans (June 2025)
  • Max’s Cool Beans (June 2025)
  • Max’s Cool Beans (July 2025)
  • Max’s Cool Beans (July 2025)
Items relevant to "180-230V DC Motor Speed Controller":
  • 180-230V DC Motor Speed Controller PCB [11104241] (AUD $15.00)
  • 180-230V DC Motor Speed Controller PCB pattern (PDF download) [11104241] (Free)
  • 180-230V DC Motor Speed Controller lid panel artwork and drilling templates (Free)
Articles in this series:
  • 180-230V DC Motor Speed Controller (July 2024)
  • 180-230V DC Motor Speed Controller (July 2024)
  • 180-230V DC Motor Speed Controller Part 2 (August 2024)
  • 180-230V DC Motor Speed Controller Part 2 (August 2024)
  • 180-230V DC Motor Speed Controller (July 2025)
  • 180-230V DC Motor Speed Controller (July 2025)
Articles in this series:
  • Precision Electronics, Part 1 (November 2024)
  • Precision Electronics, Part 1 (November 2024)
  • Precision Electronics, Part 2 (December 2024)
  • Precision Electronics, Part 2 (December 2024)
  • Precision Electronics, Part 3 (January 2025)
  • Precision Electronics, part one (January 2025)
  • Precision Electronics, part one (January 2025)
  • Precision Electronics, Part 3 (January 2025)
  • Precision Electronics, part two (February 2025)
  • Precision Electronics, Part 4 (February 2025)
  • Precision Electronics, Part 4 (February 2025)
  • Precision Electronics, part two (February 2025)
  • Precision Electronics, part three (March 2025)
  • Precision Electronics, part three (March 2025)
  • Precision Electronics, Part 5 (March 2025)
  • Precision Electronics, Part 5 (March 2025)
  • Precision Electronics, Part 6 (April 2025)
  • Precision Electronics, Part 6 (April 2025)
  • Precision Electronics, part four (April 2025)
  • Precision Electronics, part four (April 2025)
  • Precision Electronics, part five (May 2025)
  • Precision Electronics, Part 7: ADCs (May 2025)
  • Precision Electronics, part five (May 2025)
  • Precision Electronics, Part 7: ADCs (May 2025)
  • Precision Electronics, Part 8: Voltage References (June 2025)
  • Precision Electronics, part six (June 2025)
  • Precision Electronics, part six (June 2025)
  • Precision Electronics, Part 8: Voltage References (June 2025)
  • Precision Electronics, part seven (July 2025)
  • Precision Electronics, part seven (July 2025)
Items relevant to "Repurposing the Mains Power-Up Sequencer":
  • Mains Power-Up Sequencer PCB [10108231] (AUD $15.00)
  • Mains Power-Up Sequencer hard-to-get parts (Component, AUD $95.00)
  • Firmware (ASM and HEX) files for the Mains Power-Up Sequencer (Software, Free)
  • Mains Power-Up Sequencer PCB pattern (PDF download) [10108231] (Free)
  • Panel labels and cutting diagrams for the Mains Power-Up Sequencer (Panel Artwork, Free)
Articles in this series:
  • Mains Power-Up Sequencer, Pt1 (February 2024)
  • Mains Power-Up Sequencer, Pt1 (February 2024)
  • Mains Power-Up Sequencer, Pt2 (March 2024)
  • Mains Power-Up Sequencer, Pt2 (March 2024)
  • New use for Mains Sequencer (July 2024)
  • New use for Mains Sequencer (July 2024)
  • Mains Power-Up Sequencer, part one (February 2025)
  • Mains Power-Up Sequencer, part one (February 2025)
  • Mains Power-Up Sequencer, part two (March 2025)
  • Mains Power-Up Sequencer, part two (March 2025)
  • Repurposing the Mains Power-Up Sequencer (July 2025)
  • Repurposing the Mains Power-Up Sequencer (July 2025)
Articles in this series:
  • Audio Out (January 2024)
  • Audio Out (January 2024)
  • Audio Out (February 2024)
  • Audio Out (February 2024)
  • AUDIO OUT (April 2024)
  • AUDIO OUT (April 2024)
  • Audio Out (May 2024)
  • Audio Out (May 2024)
  • Audio Out (June 2024)
  • Audio Out (June 2024)
  • Audio Out (July 2024)
  • Audio Out (July 2024)
  • Audio Out (August 2024)
  • Audio Out (August 2024)
  • Audio Out (September 2024)
  • Audio Out (September 2024)
  • Audio Out (October 2024)
  • Audio Out (October 2024)
  • Audio Out (March 2025)
  • Audio Out (March 2025)
  • Audio Out (April 2025)
  • Audio Out (April 2025)
  • Audio Out (May 2025)
  • Audio Out (May 2025)
  • Audio Out (June 2025)
  • Audio Out (June 2025)
  • Audio Out (July 2025)
  • Audio Out (July 2025)
Items relevant to "Intelligent Dual Hybrid Power Supply,.Part 2":
  • Intelligent Dual Hybrid Power Supply PCB set (AUD $25.00)
  • Intelligent Dual Hybrid Power Supply regulator PCB [18107211] (AUD $7.50)
  • Intelligent Dual Hybrid Power Supply front panel control PCB [18107212] (AUD $2.50)
  • DSP Crossover CPU PCB [01106193] (AUD $5.00)
  • DSP Crossover LCD Adaptor PCB [01106196] (AUD $2.50)
  • PIC32MZ2048EFH064-250I/PT programmed for the Intelligent Dual Hybrid Power Supply [0110619A.HEX] (Programmed Microcontroller, AUD $30.00)
  • 128x64 Blue LCD screen with KS0108-compatible controller (Component, AUD $30.00)
  • Hard-to-get parts for the Intelligent Dual Hybrid Power Supply regulator board (Component, AUD $100.00)
  • Hard-to-get parts for the Intelligent Dual Hybrid Power Supply CPU board (Component, AUD $60.00)
  • LCD panel bezel for the Dual Intelligent Hybrid Power Supply (PCB, AUD $5.00)
  • Intelligent Dual Hybrid Power Supply firmware [0110619A.HEX] (Software, Free)
  • Intelligent Dual Hybrid Power Supply PCB patterns [18107211/2] (Free)
  • DSP Active Crossover/DDS/Reflow Oven PCB patterns (PDF download) [01106191-6] (Free)
Articles in this series:
  • Dual Hybrid Power Supply – Pt1 (February 2022)
  • Dual Hybrid Power Supply – Pt1 (February 2022)
  • Dual Hybrid Power Supply, part two (March 2022)
  • Dual Hybrid Power Supply, part two (March 2022)
  • Intelligent Dual Hybrid Power Supply, part one (June 2025)
  • Intelligent Dual Hybrid Power Supply, part one (June 2025)
  • Intelligent Dual Hybrid Power Supply,.Part 2 (July 2025)
  • Intelligent Dual Hybrid Power Supply,.Part 2 (July 2025)
Precision Electronics By Andrew Levido Precision Electronics Part 7: Analog-to-Digital Conversion Last month, in the sixth instalment in this series, we covered the various sources of analog-to-digital and digital-to-analog conversion errors. We also looked at digitalto-analog converters (DACs) in detail. This month, we will focus on analog-to-digital converters (ADCs) and, as usual, that will include a practical example. J ust as a quick recap, we saw that all converters exhibit quantisation errors due to the discrete way numbers are represented in digital systems. Quantisation error is directly related to the number of bits (the resolution) of the converter. We saw that this can cause quantisation noise if we are dealing with AC signals. On top of quantisation errors, we saw that there are usually offset, gain and non-linearity errors associated with conversion and that these can be combined to give a total unadjusted error (TUE) figure that can be used in error calculations. All of this applies equally to DACs and ADCs. Sampling and aliasing In contrast to DACs, which convert discrete digital codes to discrete voltage levels, ADCs have to convert an infinitely variable (and maybe varying) voltage level to discrete digital codes. We therefore have to ‘sample’ the analog voltage at some instant in time and convert that value to the appropriate (nearest) digital code. Because the conversion takes a finite amount of time, in most instances, we want to take a ‘snapshot’ of the input voltage so that the entire conversion process takes place with a fixed input value. For this reason, many converters (but not all, as we shall see below) are preceded by a ‘sample-and-hold’ circuit similar to that shown in Fig.1. The output of the sample-and-hold buffer follows the input during the sampling period, when the switch is closed. It is held constant by the capacitor during the hold period, while the switch is open. The conversion takes place during the hold period while the value is stable. In Fig.1, I have shown the sample and hold’s output (red trace) instantaneously snapping back to track the input voltage when the switch is closed. In reality, the capacitor takes a finite time to charge or discharge. If your ADC has a sample-and-hold system, you need to make sure the sampling time is long enough for the capacitor to fully charge to the signal voltage through the signal’s source impedance. This source impedance can include the sample-and-hold switch on-­resistance, the on-­resistance of any analog multiplexer, and the external source impedance. Values in the kilohms range are not unusual. The sampling time should be long enough for the capacitor voltage to Fig.1: the output of a sample-and-hold circuit follows the input while the switch is closed, but ‘freezes’ the value while it is open. This allows the analog-to-digital conversion process to occur with a steady input voltage. 44 charge or discharge to within ½LSB (least significant bit) of the signal voltage to avoid adding error to the conversion. Many ADCs allow the user to control the sampling time for this purpose. Assuming we want to perform the analog-to-digital conversion on an ongoing basis, we need to sample and convert the input signal at regular intervals. We call these intervals the sampling rate. The Nyquist-Shannon sampling theorem states that an AC signal can be fully reconstructed (without any loss whatsoever) so long as the sampling rate, fsamp, is at least twice the highest frequency component present in the signal (fmax). The particular sampling rate that is exactly twice fmax is the known as the Nyquist frequency, fn. If we sample at a higher rate than strictly necessary (fsamp > fn), we are said to be oversampling, while if we sample at a lower rate (fsamp < fn), we are undersampling. We often want or need to oversample, but we generally try to avoid undersampling as it can lead to a phenomenon called aliasing, which can give rise to significant errors. Fig.2 shows what can happen if we Fig.2: here a 1kHz signal is sampled at 1.25ksps, lower than the Nyquist limit of 2ksps. This results in the ADC measuring a 250Hz alias signal instead of the expected 1kHz signal. Practical Electronics | July | 2025 Part 7 – analog-to-digital conversion undersample a signal. Here, a 1kHz sinewave (shown in blue) is sampled at about 1.25ksps – lower than the Nyquist frequency of 2ksps. The sample points (red dots) trace out a false ‘alias’ signal with a frequency of 250Hz. Within the digital system, we will have no idea that the true signal includes a 1kHz component and that the 250Hz signal is an alias – all we will measure is the 250Hz sinewave. To avoid aliasing, we must ensure that there is no content in the sampled signal with a frequency higher than ½fsamp. This can be achieved by limiting the bandwidth of our signal with a filter, or by using a high enough sampling rate. In practice, we often need to do both. For wideband signals, it can be difficult or impossible to totally eliminate aliasing since perfect ‘brick wall’ filters are hard to come by! Instead, we have to be satisfied with reducing the amplitude of the worst possible alias to something we can live with. It is easiest to understand this in the frequency domain, as shown in Fig.3. In each diagram, the vertical axis is the relative amplitude of the signal in decibels (dB), while the horizontal axis is the frequency on a linear scale. We are interested in digitising a broadband signal within the band of interest shown shaded in blue. Because the signal is broadband, we apply some low-pass filtering with corner frequency fc, shown by the solid curve. The dotted lines represent the magnitude of the alias signals obtained by reflecting the filter roll off about the Nyquist limit (½fsamp). If the filter had a ‘brick wall’ cutoff, there would be no aliasing. In the first diagram, we try to eliminate aliasing by adding a second-­ The Wireless for the Warrior books are references for the history and development of radio communication equipment used by the British Army from the very early days of wireless up to the 1960s. Volumes 1 & 3 are still available. Order a printed copy now from: https://pemag.au/link/ac20 order low-pass filter, with its corner frequency set at the upper end of the bandwidth of interest, and by oversampling by 50% (the Nyquist limit is set 50% higher than the upper limit of the band of interest). You might think that this would be enough to eliminate aliasing, but unfortunately, it is not. The dotted line shows that there will still be an alias component within the band of interest, although it will be 6dB or more below the level of the signal of interest. This happens because there is still content in the lowpass filtered signal with frequency components above the Nyquist limit, albeit at a low level. The second chart shows that using a fourth-order filter, with its steeper rolloff, helps by shifting the alias signal down to -16dB or lower. We could improve this even further by using a sixth- or eighth-order filter, at the expense of complexity. The final chart shows what happens if we retain the fourth-order filter but increase the sampling rate to oversample at 100%, rather than the 50% in the first two cases. The alias signal is now down by 30dB or more. The long and short of this is that if you are digitising signals with a broadband AC component, you need to choose your sampling rate and filter configuration carefully to ensure you don’t introduce errors due to aliasing. You don’t have to eliminate the aliases entirely – you just need to get them down to a level where the errors from them are manageable. You may not need an anti-aliasing filter or oversampling if your signal is band-limited by its very nature. If your signal is nominally DC (or at least very slowly changing), you can be even more relaxed about choosing the sampling rating and anti-aliasing filter. Flash ADCs With anti-aliasing taken care of, and a sample-and-hold system keeping our ADC’s input constant while sampling, we are ready to actually convert our analog signal to a digital one. The most straightforward way to do this is the ‘flash’ or parallel ADC, a simple threebit example of which is shown overleaf in Fig.4 (this is not directly related to flash memory). A resistor string establishes a series of threshold voltages representing the transition voltages between each code. The input voltage is simultaneously compared to all of these thresholds. A comparator output will be asserted low if the input voltage exceeds the respective transition threshold. A priority encoder outputs the code associated with the highest-­value input that is asserted. Fig.3: using a higher-order low-pass filter and increasing the sampling rate can both help reduce aliasing when digitising broadband signals. Practical Electronics | July | 2025 45 Precision Electronics True flash converters require 2 n matched resistors and the same number of comparators (where n is the resolution in bits), so they are usually limited to about 16 bits, but they are very fast. They can make a conversion every clock cycle, so they can reach sampling rates in the Gsps (gigasamples per second or 1,000,000,000+ samples per second) range. Many modern flash ADCs use a multistage architecture with a series of lower bit-count flash conversions of increasing precision. These ‘pipelined’ flash converters can have a latency of several tens of clock cycles, but maintain conversion rates in the Gsps range, since sequential samples are being processed in each stage. Several flash ADCs can be interleaved to achieve even higher sampling rates. If you have a digital oscilloscope (DSO), it most likely uses a pipelined flash converter with eight, 10 or 12 bits of resolution and a multiGsps sampling rate. Successive approximation Successive approximation analog-­ to-digital conversion uses a binary search strategy to find the digital code corresponding to the analog input. A simplified three-bit successive approximation converter is illustrated in Fig.5. At the start of the conversion cycle, the controller clears the successive approximation register and sets its MSB to one. The output of the DAC will therefore be a voltage that is 50% of the full scale. The comparator checks if the input voltage is above or below this threshold. If it is above 50% (comparator output high), the MSB in the SAR remains set; otherwise, it is cleared. The controller then sets the next most significant bit so the DAC and comparator can check if the input voltage lies in the upper or lower part of the appropriate sub-range. Again, the bit remains set or is cleared based on the comparator output. This process continues bit-by-bit until the value of the least significant bit is confirmed. At this point, the controller latches the SAR contents through to the converter output, and the cycle can begin again. This binary search process is shown graphically on the right side of Fig.5. Starting with the MSB, each bit is set or cleared successively until the output code is complete. This iterative approach means that the conversion takes at least one clock cycle for each bit, so SAR converters are generally slower than flash converters, with conversion rates typically limited to the Msps (megasamples) range. This is the type of converter you will usually find in microcontrollers and many low-cost serial interface ADC chips. Integrating converters Fig.4: a ‘flash’ ADC compares the input signal to each threshold voltage simultaneously. The output is the digital code associated with the highest threshold the input signal reaches. 46 You can see why a sample-and-hold system is important if you are using a successive approximation ADC. If the value of the input were to change mid-conversion, the result could be a wrongly set bit and therefore a potentially significant error. However, there is a class of converter – the integrating converter – that can accommodate a changing input during the conversion cycle. In fact, we can use this characteristic to our advantage. The simplest integrating converter is the single-slope variant shown in Fig.6. When the start signal is pulsed, the flip-flop is set, the transistor is switched off and capacitor C begins to charge linearly at a rate determined by the value of the current source. Simultaneously, the clock is gated through to the counter, which begins counting up. When the voltage on the capacitor rises to Vin, the comparator resets the flip-flop and stops the counter, which holds a number proportional to the time taken to charge the capacitor to Vin. The count time is given by Tcount = C × Vin ÷ I and the count value will be N = (C × Vin) ÷ (I × Tclk), where Tclk is the clock period. The output count is therefore dependent not only on Vin and the current I but also on the capacitor value and the precision of the clock frequency. The latter two are a bit of a problem, since tight tolerance capacitors are rare and expensive, and very precise and stable clocks are not easy to create. Fortunately, a variation on this scheme – the dual-slope converter – solves these problems very elegantly. Fig.7 shows how it works. This time, the controller first charges the capacitor up for a fixed period (Tcharge) with a current proportional to the input voltage. The capacitor is then discharged by a fixed current of Idis, and the time taken for the capacitor voltage to ramp down to zero (Tcount) is measured by the counter. If we allow the capacitor to charge for M clock cycles, its voltage will reach Vcap = Iin × M × Tclk ÷ C. The count required for the capacitor to discharge from Vcap to 0V will be N = C × Vcap ÷ (Idis × Tclk). As Vcap is the same for both charge and discharge phases, we can substitute the first equation into the second. The capacitor value and the clock period cancel out, and we are left with N = M (Iin ÷ Idis). Recalling that Iin is proportional to Vin, we can see the count N is proportional to Vin, Idis and some constants. The conversion precision is therefore not dependent on the capacitor’s value or the clock frequency. As a bonus, any offset error in the comparator is also eliminated since the charge-discharge cycle will start and end at the same voltage, even if it is not precisely zero. Practical Electronics | July | 2025 Part 7 – analog-to-digital conversion Fig.5: a successive approximation ADC uses a binary search algorithm to determine the state of each successive bit, starting with the MSB (most significant bit). Fig.6: a single-slope integrating ADC measures the time taken to charge a capacitor up to the input voltage using a known current. Achieving high precision requires a stable clock and a precise capacitor value. The only requirement is to use precision current sources and a capacitor with low dielectric absorption (a polypropylene dielectric is a good choice). Dielectric absorption is the mechanism responsible for the ‘memory effect’ in capacitors, where a recently discharged capacitor recovers some voltage over time after being discharged. This would obviously lead to errors in the dualslope converter. The ‘integrating’ nature of the charge cycle explains why dual-slope ADCs don’t generally need a sample-and-hold circuit. Any changes in input voltage are averaged out over the capacitor charge period. This means integrating converters are inherently low-pass filters, so they work best with DC or very low-frequency signals. An antialiasing filter is not normally required for the same reason. You can take advantage of this averaging to very effectively reject any mains-frequency interference that might be present on your signal. By setting the charge time to an integer multiple of the mains cycle period (20ms for 50Hz mains), any mains component present at the input will be averaged to zero over one or more full cycles. Being counter-based, integrating ADCs are quite slow, but with resolutions of 20 or more bits (better than 1ppm resolution), and the ability to effectively reject mains interference, they are widely used in test and measurement equipment like digital multimeters (DMMs). Very high-end test equipment (6½ or 7½ digit multimeters, for example) use more advanced variants known generically as multi-slope converters. Each manufacturer has their own proprietary flavour, but they all rely on the same charge-balancing principle. Delta-Sigma ADCs Another type of ADC that has come to the fore in recent years is the delta-­ sigma converter. A delta-sigma ADC consists of an analog modulator that produces a single bit stream, followed by a complicated digital filter. The inner workings of delta-sigma ADCs are not easy to describe or understand – so bear with me as I give it a shot. We will start with the modulator, which is where the magic happens. The upper part of Fig.8 shows a simplified first-order modulator. Practical ADCs use higher-order modulators, but the principles remain the same. The input is an analog voltage in the range ±V with a maximum frequency Fig.7: the dual-slope integrating ADC has the advantages of not being dependent on either a precise capacitor value or clock frequency. Its integrating nature also allows it to be configured to reject mains interference. Practical Electronics | July | 2025 47 Precision Electronics Fig.8: the delta-sigma ADC consists of a modulator that produces an oversampled bit stream followed by a complex digital filter. These ADCs can have up to 32 bits of resolution and sampling rates in the Msps range (although not at the same time). component of fmax. The modulator is clocked at a rate higher than 2fmax by an oversampling rate factor (OSR). We will assume the OSR is 128 for the purposes of this example. The clock frequency is therefore 256fmax. The output of the modulator is a stream of 1s and 0s at the clock frequency, where a 1 code corresponds to V+ and a 0 code corresponds to V–. The average value of this bit stream over many cycles is equal to Vin. For example, a zero-volt input would be represented as a string of alternating 1s and 0s corresponding to alternating V+ and V– voltages, averaging to 0V. The example waveforms to the right of the figure show what happens with an input voltage of ¼V+. In the initial clock cycle, the bit stream value is zero, and the switch directs a voltage of V– to the summing junction, where it is subtracted from the input voltage. The resulting voltage (5/4V) represents the ‘error’ between the input and the reconstructed modulator output (this is the ‘delta’ part of the delta-­ sigma converter). This error is integrated (the ‘sigma’ part) and the comparator determines if the result is positive or negative. In our example, the result transitions from negative to positive about ¼ of the way through the clock cycle. On the next clock edge, a one is latched into the bit stream. The error voltage swings to -3/4V, and the integra48 tor starts to ramp down. The result is still positive at the end of this cycle, so the comparator output stays high and the third bit in the stream is also a 1. This process continues indefinitely, producing a bit stream with five 1s and three 0s for every eight bits, as shown. Since we want to provide an output code at the sampling frequency (2fmax), we have to do it every 128 clock cycles. There can therefore only be 128 possible discrete values in the bit stream for each sample (128 zeros to 128 ones). If this was all there is to it, we would have created a 7-bit converter, which is pretty unexciting. However, the delta-­ sigma converter has a trick or two up its sleeve. The filter component of the ADC is a digital filter called a Finite Impulse Response (FIR) filter. We could write a whole series of articles on digital filters, but for a one-bit input this just consists of a long shift register with each output enabling or disabling a coefficient (a carefully chosen number) depending on whether it is a one or a zero. All the coefficients are summed on each clock cycle to produce a digital output code. The coefficients are chosen to produce a very steep low-pass filter, with a cutoff frequency of fmax. The output is decimated so that the resulting number changes only once for each sampling period. Decimation in our example just means each 128th sample is sent to the output and the other 127 are thrown away. The filter coefficients have a resolution much higher than seven bits, and there may be many hundreds or even thousands of coefficients in the filter. This means each output code can take significantly more than 128 different values and, therefore, it has much more than seven bits of resolution. If you find this last part hard to grasp, you are not alone. The mathematics behind it is complex, and some of the explanations you will find are confusing. Another way to look at it is to think of the modulator as a ‘perfect’ ADC with significant quantisation noise superimposed on it. The oversampling nature of the modulator is such that this noise is ‘shaped’ (pushed up) to frequencies well above the sampling rate. The low-pass filter then blocks most of this noise, leaving a level of quantisation noise corresponding to many more bits of resolution than the oversampling rate would suggest. Delta-sigma ADCs offer excellent performance at reasonable prices. Audio ADCs can easily have 24-bit resolution and sampling rates of 96kbps or 192kbps, with extremely low distortion. Precision DC-accurate delta-­sigma converters with up to 32 bits of resolution are available (at a price). Delta-sigma ADCs are available with sampling rates up to 20Mbps. One of Practical Electronics | July | 2025 Part 7 – analog-to-digital conversion the big advantages of delta-sigma converters is their inherently high oversampling rate means that anti-aliasing filtering is made easier. A practical example I am developing a project that uses a low-cost microcontroller with a 12-bit successive approximation ADC to measure a ±6V analog signal. We will use this example to see what kind of performance we can expect from this pretty common scenario. The microcontroller I have chosen is the STM32L031, a low-power, lowpin-count unit with a Cortex M0+ CPU core. It has a built-in 12-bit ADC with a maximum sample rate of 1.1Msps that uses the microcontroller’s power rail as its reference. The ADC’s headline specifications are modest, with a worst-case offset error of ±2.5LSB, a worst-case gain error of ±2.0LSB and an INL of ±2.5LSB for a TUE of just over ±4LSB. Data sheet typical values are about half of these figures, but you already know how I feel about typical values. This would mean that the lower two bits of the result probably should not be trusted, making this effectively a 10-bit converter, unless we can do something to improve its performance. The ADC does have some nice features. One of the downsides of microcontroller ADCs is that they use the power rail (or, if you are lucky, a dedicated analog supply pin) as the full-scale voltage reference. Since I am powering this device from a 3V coin cell and boost converter, the power rail is neither very precise nor very stable. The STM32L031 includes an on-­ chip bandgap reference with a nominal 1.2V value and ±100ppm/°C tempco. At manufacture, the value of this internal reference is read by the ADC while the chip is supplied with a precise supply voltage (3.0 ±0.01V). The resulting code is burned into non-­ volatile memory on the chip. You can use this to convert a supply-referenced ADC reading to an absolute voltage with known precision. The ADC also includes an auto-­ calibration feature that automatically performs a zero calibration. This only works to eliminate on-chip offset errors, such as those related to the analog multiplexer, the sample-and-hold system and the ADC itself. If you want to eliminate off-chip offset errors, you need to provide the hardware and do this yourself, as we discussed in the third article in this series. In addition, the ADC includes an oversampler that automatically makes several sequential conversions (up to 256), sums the result, then scales the result back by some factor to get an averaged result. Of course, you could do this in firmware, but the hardware oversampler does everything in the background for you. This technique can actually improve the precision of ADC measurements in the presence of noise. This means that a 12-bit ADC could appear to have 13 or more bits of precision. The reason this works is shown in Fig.9. Here, we have a noisy signal with an average value between the nth and nth+1 thresholds of an ADC. If we were to take just one sample, we could get either result. In fact, it is possible we could get a result one more bit higher and lower if we are unlucky with our sampling. If we make many measurements, however, some will be high and some low, but their average will lie somewhere between the two thresholds. We could say the resulting measurement is at the nth+½ threshold, effectively giving us an extra bit of resolution. This only works if the noise has an average value of zero and is uncorrelated with the sampling rate, and the noise has to have sufficient magnitude. Sometimes, a designer will deliberately introduce noise or some other form of ‘dither’ to a signal to increase the resolution when oversampling. Design decisions The relevant part of the test circuit I built is shown in Fig.10. The challenge is to digitise a bipolar (in this case, ±6V) signal with a single-ended ADC and a single 3.3V supply. The input signal is coupled to the ADC by a difference amplifier with a gain of 0.25, reducing the 12V input span to 3V, within the ADC input range. Using a difference amp here allows the input voltage to extend well beyond the supply rails without getting into problems with an op amp’s commonmode input range. The reference input of the difference amplifier is connected to the mid-point of the power supply derived from a voltage divider and buffer op amp. The output of the difference amplifier will therefore Vout = 0.25 (Vin+ – Vin–) + 1.65V. This means the voltage applied to the ADC will be in the range 1.65 ±1.5V (0.1V to 3.2V) over the ±6V input span, Fig.9: it is possible to increase the effective resolution of an ADC for slowly changing signals by averaging many samples of a noisy signal. Fig.10: the test circuit digitises a ±6V input using a difference amplifier with a gain of 0.25 and an offset of about 1.65V. The latter value is not critical, since this voltage is also digitised and the measured value is used to reconstruct the input voltage. Practical Electronics | July | 2025 49 Precision Electronics avoiding the ends of the ADC input range near the supply rails where we know errors may lie. I have used lowcost TP5534 zero-drift op amps and 0.1% gain setting resistors to keep the analog errors down. The error budget table (Table 1) shows the analog error (line 5) is around ±0.2% in the worst case – almost all down to the gain resistor tolerance. The offset errors in lines 1 and 2 of the table are very low, so the internal zero calibration should be sufficient for our purposes. It is probably not worth using higher precision resistors here, since the ADC and calibration errors are of a similar magnitude. The ADC TUE of ±4LSB corresponds to a relative error of just over 0.1% and an absolute error of ±3.2mV. The relative error is easy to calculate from the TUE and the ADC precision: 100% × TUE ÷ (2n – 1), where n is the ADC precision in bits. We don’t need to use precision resistors to create the mid-supply voltage since we also digitise this voltage and subtract it in firmware. The absolute value of the mid-point voltage therefore does not matter – it just has to be close to half the supply voltage. I set the ADC up with an 8MHz clock giving a cycle time of 125ns. A single conversion consists of a sampling period, which is programmable, and a conversion time of 12.5 clock cycles. I chose a sampling time of 19.5 cycles (about 2.5µs) to be 10 or more times longer than the time constant of the external RC filter, and that of the internal filter made up of the 8pF sampling capacitor and the 1kW resistance of the analog multiplexer and sampleand-hold switches. I configured the oversampler to take 256 samples and to divide the resulting sum by 256 to restore 12 bits of resolution. There is no point in going for higher resolution, since the analog errors and the ADC TUE are already at this level of precision. No amount of oversampling will compensate for errors that affect every sample to the same extent. We use the same oversampling on all three ADC conversions: the main input, the mid-supply offset and the internal voltage reference. I also performed an internal zero-calibration on initialising the ADC to make sure any offset errors in the input multiplexer and sample and hold were minimised. Scaling the ADC results The relationship between the ADC code N and the absolute voltage on an ADC pin is Vin = Vdd (N ÷ 4095), where V dd is the microcontroller’s power supply voltage. We don’t know this voltage precisely, but we can work it out by using the ADC to read the internal reference (NIREF) and the stored ADC code (NCAL) that was converted with a known supply voltage: Vdd = 3.0 × (NCAL ÷ NIREF) Having calculated the absolute voltage of the input and the midpoint offset voltage (in millivolts, since we are dealing with integers), we can use these, plus the nominal differential amp gain, to calculate the overall circuit input voltage. I did all of this and measured the input voltage, the ADC channel input voltage and read out the digital result. The results are pretty impressive – the measured error is better than ±0.05%, corresponding to ±3mV on the fullscale ±6V input range. This is 1 part in 2000, or about 11 bits of effective resolution. The transfer function of the ADC turned out to be f(x) = 0.9995x – 0.0002 with an R2 of 1.000. The line-of-bestfit gain error is less than ±0.01% and the offset error is less than 1mV. The worst individual sample error was better than ±0.05%. These results are an order of magnitude better than the 0.6% error calculated in the error budget. To some extent, this is to be expected (the odds are low that we will have the worstcase errors everywhere), but it is worth a bit of a closer look at why it performs better than expected. First, the calculated analog gain error is almost all due to the resistor tolerances, which would have to all be at the extremes of their tolerance band – that is unlikely in practice (but possible, of course). Second, the calculated TUE includes offset error, which is nulled out through the zero-calibration process. And finally, the 0.3% error on the supply voltage for the factory calibration seems to me to be a very conservative figure. I would be surprised if the supply voltage was not regulated more tightly than ±10mV during this step, so will probably be better than specified by an order of magnitude. So, in conclusion, the typical 10- to 12-bit ADCs used in microcontrollers are really useful, but they have some limitations – especially if you are using the power supply voltage as the reference. Read the data carefully, since they will likely have fewer bits of effective resolution once the TUE is taken into account. To most effectively use the bits at your disposal, you should think seriously about averaging many samples if your microcontroller has the time to do so. That depends on how quickly your input is changing, how fast your ADC is, how many measurements you have to make, how often and so on. As I have mentioned before, in precision applications, you should also avoid using the very ends of the ADC PE span. Table 1: ADC (analog-to-digital converter) error budget Nominal Value Absolute Error Relative Error 1 Op Amp Offset Voltage (±20µV, 0.05µV/˚C) Error Source (25˚C) 0V 20μV 0.000% 2 Voltage due to Op Amp Offset Current (±100pA, 300kW || 1.2MW) 0V 24μV 0.000% 3 Total error at Op Amp Input (Line 1 + Line 2) 0V 44μV 0.001% 4 Op Amp Gain Error (0.1% resistors) 1.25 5 Voltage error at ADC Input (Line 3 × Line 4) 0V 12mV 0.201% 6 ADC (TUE ±4LSB – least significant bits) 0V 3.2mV 0.107% 7 Total error in ADC code (Line 5 × Line 6) 0V 10.2mV 0.308% 8 Error in internal Vref calibration (<at>3.0±0.01V) 0V 10mV 0.303% 9 Total error (Line 7 × Line 8) 0V 20.2mV 0.611% 50 0.200% Practical Electronics | July | 2025