Silicon ChipElectronic Modules - 16-bit precision 4-input ADC - October 2024 SILICON CHIP
  1. Contents
  2. Publisher's Letter: Updates on kits and the magazine
  3. Feature: Techno Talk - Sticking the landing by Max the Magnificent
  4. Feature: Net Work by Alan Winstanley
  5. Feature: The Fox Report by Barry Fox
  6. Project: 500W Monoblock Class-D Amplifier by Phil Prosser
  7. Subscriptions
  8. Feature: Circuit Surgery by Ian Bell
  9. Project: TQFP Programming Adaptors by Nicholas Vinen
  10. Feature: Audio Out by Jake Rothman
  11. Feature: Electronic Modules - 16-bit precision 4-input ADC by Jim Rowe
  12. Feature: Max’s Cool Beans by Max the Magnificent
  13. Review: Linshang LS172 Colorimeter by Allan Linton-Smith
  14. Back Issues
  15. Project: 2m VHF FM Test Signal Generator by Andrew Woodfield, ZL2PD
  16. Feature: Teach-In 2024 – Learn electronics with the ESP32 by Mike Tooley
  17. PartShop
  18. Market Centre
  19. Advertising Index
  20. Back Issues

This is only a preview of the October 2024 issue of Practical Electronics.

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

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Articles in this series:
  • Win a Microchip Explorer 8 Development Kit (April 2024)
  • Net Work (May 2024)
  • Net Work (June 2024)
  • Net Work (July 2024)
  • Net Work (August 2024)
  • Net Work (September 2024)
  • Net Work (October 2024)
  • Net Work (November 2024)
  • Net Work (December 2024)
  • Net Work (January 2025)
  • Net Work (February 2025)
  • Net Work (March 2025)
  • Net Work (April 2025)
Articles in this series:
  • The Fox Report (July 2024)
  • The Fox Report (September 2024)
  • The Fox Report (October 2024)
  • The Fox Report (November 2024)
  • The Fox Report (December 2024)
  • The Fox Report (January 2025)
  • The Fox Report (February 2025)
  • The Fox Report (March 2025)
  • The Fox Report (April 2025)
  • The Fox Report (May 2025)
Articles in this series:
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (June 2025)
Articles in this series:
  • Audio Out (January 2024)
  • Audio Out (February 2024)
  • AUDIO OUT (April 2024)
  • Audio Out (May 2024)
  • Audio Out (June 2024)
  • Audio Out (July 2024)
  • Audio Out (August 2024)
  • Audio Out (September 2024)
  • Audio Out (October 2024)
  • Audio Out (March 2025)
  • Audio Out (April 2025)
  • Audio Out (May 2025)
  • Audio Out (June 2025)
Articles in this series:
  • Max’s Cool Beans (April 2024)
  • Max’s Cool Beans (May 2024)
  • Max’s Cool Beans (June 2024)
  • Max’s Cool Beans (July 2024)
  • Max’s Cool Beans (August 2024)
  • Max’s Cool Beans (September 2024)
  • Max’s Cool Beans (October 2024)
  • Max’s Cool Beans (November 2024)
  • Max’s Cool Beans (December 2024)
Articles in this series:
  • Teach-In 2024 (April 2024)
  • Teach-In 2024 (May 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (June 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (July 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (August 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (September 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (October 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (November 2024)
Electronic Modules Using Electronic Modules with Jim Rowe 16-bit precision 4-input ADC This month we’re looking at the tiny ADS1115 that can add up to four high-speed 16-bit analog-to-digital conversion (ADC) channels to almost any microcontroller. It has a built-in I2C serial interface, so it can be easily connected to popular microcontrollers like an Arduino Uno or Nano. L et’s say you want to make precise measurements of analog voltages or currents with one of the common microcontroller units (MCUs). The ADC in most MCUs provides a resolution of only ten bits over a range of either 3.3V or 5V, which corresponds to a precision of ±1.6mV (3.3V ÷ 1024 ÷ 2) or ±2.5mV (5V ÷ 1024 ÷ 2), where 1024 is equal to 210. That is acceptable for many applications, but not good enough if you want to make precision measurements, especially of small voltages. That’s where this module is worth considering because it allows you to add precision 16-bit ADC capability to any of the popular MCUs. As a result, you will be able to make much more precise measurements, even on quite small signals. It offers a precision improvement of 64 times compared to a 10-bit ADC or 16 times compared to a 12-bit ADC. It is not just useful for a singleended full-scale range of 3.3V or 5V either, because the module gives you a choice of six different full-scale ranges: ±6.144V, ±4.096V, ±2.048V, ±1.024V, ±512mV or ±256mV. This means that the smallest step size on the highest range is 187.5µV, while on the lowest range, it’s 7.8125µV. Note though that the inputs must go no more than 0.3V beyond the supply rails and those measurement ranges can be between two inputs or from an input to ground. So you can’t actually measure voltages very far below ground or above the (typically 3.3V or 5V) supply range. A further feature of the module is that it has four analog inputs, which can be used to measure either four different voltages with respect to ground, or to provide two differential inputs. Another feature of the module which adds to its appeal is the ability to make measurements at eight different rates, from eight per second to 860 per second. It connects to the MCU via a standard two-wire I2C serial interface, with the ability to set the module’s I2C port to one of four addresses: 48h, 49h, 4Ah or 4Bh (h = hexadecimal). That means you can connect up to four modules to a single I2C port on an MCU, each set for a different I2C address. Even if you don’t need the improved precision, if you’ve run out of ADC channels on your micro, it might be worth considering this module for the extra analog inputs it provides. If you’re already using an I2C serial bus in your project, it won’t even take up any more pins on the micro to add as many as 16 more analog inputs. Otherwise, you can dedicate two digital pins – not a bad swap. In short, it’s a very flexible and impressive precision ADC module. All of these capabilities are due to the IC that forms the ‘heart’ of the module: an ADS1115 made by Texas Instruments. So let’s look at the innards of this impressive chip. Inside the ADS1115 Fig.1: a block diagram of the ADS1115 IC. This shows the ADS1115 can be configured as four single-ended channels or as two differential channels. 42 Fig.1 shows the basic block diagram of the ADS1115. The 16-bit delta-­ sigma ADC is in the centre, with the chip’s built-in voltage reference just above it and the internal clock oscillator just below. To the left of the ADC (on its input side) is a programmable-­gain differential amplifier (PGA), providing the chip’s six full-scale ranges. Left of the PGA is the input multiplexer (MUX), which selects which of Practical Electronics | October | 2024 Four-channel 16-bit precision ADC the four single-ended inputs (AIN0AIN3) are connected to the input of the PGA, or which two inputs are connected as a differential input. When one of the single-ended inputs is selected, the lower input of the PGA is connected internally to ground. In contrast, when two inputs are selected for differential measurements, each is connected to one of the PGA inputs. You can see the chip’s I2C interface to the right of the ADC. This provides two-way communication between the ADS1115 and the external MCU, with programming and control data inwards, and the measurement data stream outwards. This is done using the SCL and SDA pins; the ADDR pin sets the chip’s I2C address by linking it to one of the Vdd, GND, SCL or SDA pins, as will be explained shortly. Above the I2C interface is a comparator with its output connected to the chip’s ALERT/READY (or ALRT/ RDY) pin. The comparator can be programmed to perform one of two functions: either an alert ‘flag’ whenever the ADC output reaches the top or bottom threshold of its measurement range, or as an indication that a measurement has been made and the result is ready for ‘collection’ by the MCU. The final section of the ADS1115 is below the I2C interface. This comprises four 16-bit registers: 1. The Conversion register, which holds the last conversion data. 2. The Configuration register, which holds the programming bits for the chip’s input multiplexer, the gain/ range settings for the PGA, the sampling rate setting and whether the device is to operate in single-shot or continuous conversion mode – see Fig.2. 3. Lo-thresh, the lower threshold value for the Alert Comparator. 4. Hi-thresh, the upper threshold value for the Alert Comparator. Data in the Conversion, Lo-thresh and Hi-thresh registers is stored in signed two’s complement format: from 8000h (-32768) to 7FFFh (+32767). Because this ADC has differential inputs, it can produce negative results, meaning that a signed number is needed. This also means that there are effectively 15 bits of resolution when single-ended samples are taken. Practical Electronics | October | 2024 Fig.2: how the configuration register is arranged. This 16-bit register handles the chip’s input multiplex (bits 12-14), the PGA (bits 9-11), whether the device is operated in single-shot or continuous conversion mode (bit 8) and the sampling rate (bits 5-7). Fig.3: the ADS1115-based module is extremely simple, as can also be seen in the lead photo. The values of the L1 & L2 inductors are unknown, they could be ferrite beads. Fig.4: it’s easy to connect the ADS1115-based module to an Arduino Uno or similar, as all you need to do is connect its I2C interface (SCL & SDA) and power rails to the Arduino. 43 Electronic Modules As you can see, there’s quite a lot inside the ADS1115’s tiny (3.0 × 3.0mm) 10-pin VSSOP (very-thin shrink small-outline) package. It can be powered from supply voltages (Vdd) between 2.0V and 5.5V. However, the analog input voltages must be kept within the range of (GND − 0.3V) to (Vdd + 0.3V) to prevent the ESD diodes inside the input MUX from conducting, which would degrade the accuracy of the ADS1115 as well as possibly damaging it. When the ADS1115 is initially powered up, it is set to its reset/default mode: the input MUX selects AIN0 and AIN1 in differential mode, the PGA is set for a full-scale range of ±2.048V, the sampling rate set to 128 samples per second and the conversion mode set to one-shot mode. If any of those need to be changed, it can be done by sending the appropriate instructions from the MCU. The I2C address of the chip is not determined by anything in the Configuration register, but by the connection to the ADDR pin. The module circuit As you can see from the circuit in Fig.3, there’s very little in the module apart from the ADS1115 chip itself. There are three pull-up resistors connected between its SDA, SCL and ALRT/RDY pins and the Vdd line, a pull-down resistor between the ADDR line and GND, two small inductors (L1 and L2) of unknown value (they might even be ferrite beads), plus two 100nF capacitors which provide filtering for the module’s input power. The only other item is 10-pin SIL header CON1, which makes all the connections to the module. Connecting to an Arduino Fig.5: this wiring diagram shows how to connect the ADS1115 module to an Arduino Nano. Fig.6: by default the ADS1115 has an I2C address of 48h. If you plan to connect multiple ADS1115 modules to communicate with a microcontroller, then you will need to link the ADDR pin to one of the other pins as shown. 44 As mentioned earlier, one of this module’s features is how its I2C interface makes it easy to connect to one of the popular MCUs. This is illustrated in Fig.4, which shows how easily it can be connected to an Arduino Uno. The module’s Vdd pin connects to the Arduino’s +5V pin, its GND pin to one of the Arduino’s GND pins, its SDA pin to the Arduino’s A4/SDA pin and its SCL pin to the Arduino’s A5/SCL pin. With R3 and later versions of the Uno, the last two pins can be connected to the SDA and SCL pins at upper left on the Arduino, just to the left of the AREF pin. These locations have the advantage of always being in the same position on Uno-compatible boards, regardless of which pins the micro actually uses for I2C. Connecting the module to an Arduino Nano is just as easy, as shown in Fig.5. As you can see, the module’s Vdd pin connects to the Nano’s +5V pin, the GND pin to one of the Nano’s GND pins, its SCL pin to the Nano’s A5 pin and its SDA pin to the Nano’s A4 pin. By default, the ADDR pin is connected to ground by a 10kW resistor, so the module will have the address 48h. To change it, link the module’s ADDR pin to one of the pins to its left, as shown in Fig.6. Linking this pin to the V dd pin sets the I2C address to 49h; linking it to the SDA sets the address to 4Ah, while linking it to the SCL pin sets the address to 4Bh. It should be just as easy to connect the ADS1115 module to just about any other MCU, including one of the ‘Mite’ series (Maximite, Micromite, PicoMite etc). Whichever MCU you want to connect the module to, you will need software to configure it and interpret its output data stream. Let’s now consider how this can be done with an Arduino. This will involve finding a software library designed to communicate with the ADS1115, plus (hopefully) an example sketch to show how it’s done. Arduino software libraries Searching the web for Arduino libraries for the ADS1115, I came up with three choices: 1. A library called ADS1x1x, written by someone named hideakitai, with the documentation and the zippedup library code at https://github.com/ hideakitai/ADS1x1x 2. A library called ADS1x15, written by Rob Tillaart, with the documentation and the library code at https://github. com/RobTillaart/ADS1x15 3. A library called ADS1115_WE, written by Wolfgang Ewald, with the documentation and the zipped-up library code at https://github.com/ Wollewald/ADS1115_WE All three come with at least one example sketch, while the third comes with no fewer than 10 examples illustrating different ways of using the ADS1115. After trying each of these libraries and their example sketches, I decided that the ADS1115_WE library and its examples were probably the easiest to use. I also found that Mr Ewald had a very informative piece on his blog site (linked at the end of this article) giving a lot of information regarding the ADS1115, how it works and how it is programmed. Practical Electronics | October | 2024 Four-channel 16-bit precision ADC I made a few minor changes to Mr Ewald’s single-shot example and tried using it to take measurements of different DC voltages. You can see the results in the Serial Monitor listing shown in Fig.7. I had connected the test voltage to AIN1, with the AIN0 and AIN2 inputs connected to ground and the AIN3 input left floating. The ADS1115 was programmed to set its measurement range to ±2048mV and to compare AIN1 to GND. When I set the sketch at 7:09:36am, the voltage fed to the AIN1 input was +100mV and remained so until 7:09:49am. Then I changed it to +200mV before changing it to +500mV at 7:05:58am. Then at 7:10:07am, I changed it to +50mV, passing briefly through +100mV. Finally, at 7:10:16am, I changed the voltage to +20mV. The AIN0 column remains fixed at readings of -0.00, as does the AIN2 column, reflecting the fact that both of these inputs were grounded. But because the AIN3 input was left floating, the readings in this column remained fixed at 0.27V. If you decide to try out my example sketch, remember to change the address in the code to match what you have configured your module for, as shown in Fig.6. Conclusion Overall, this module is easy to use, flexible, and far more accurate than most microcontrollers for measuring analog voltages. It doesn’t have as much precision as a good DMM, but it is nonetheless extremely handy. If you want to learn more about the ADS1115, you can view the datasheet at: www.ti.com/product/ADS1115 Also see the technical write-up on Wolles Elektronikkiste: https://pemag. au/link/abph Above: the ADS1115 module can run from a 2-5.5V supply, making it easy to use both 3.3V and 5V powered micros. The available sampling rates are: 8, 16, 32, 64, 128, 250, 475 and 860 samples per second (SPS). Fig.7 (right): we ran Wolfgang Ewald’s singleshot example code, with some minor changes, and used it to measure different DC voltages. Where you can get it This ADS1115 module is available online from a few different suppliers. You can find multiple offers on eBay or AliExpress starting at just over £1 each (eg, https://pemag.au/link/abyy). Search for “ADS1115” but check the description and photos to make sure they match the module shown here. There are some other modules using the ADS1115 that look a little different, but they are very similar in terms of circuitry. PE Practical Electronics | October | 2024 45