Silicon Chip16-bit precision 4-input ADC - November 2023 SILICON CHIP
  1. Outer Front Cover
  2. Contents
  3. Publisher's Letter: Computer keyboards need an update / Australia Post wants to put prices up again!
  4. Feature: The History of Electronics, Pt2 by Dr David Maddison
  5. Product Showcase
  6. Project: Pico Audio Analyser by Tim Blythman
  7. Feature: 16-bit precision 4-input ADC by Jim Rowe
  8. Project: K-Type Thermostat by John Clarke
  9. Review: Microchip's new PICkit 5 by Tim Blythman
  10. Project: Modem/Router Watchdog by Nicholas Vinen
  11. Project: 1kW+ Class-D Amplifier, Pt2 by Allan Linton-Smith
  12. Serviceman's Log: Charge of the light yardwork by Dave Thompson
  13. PartShop
  14. Subscriptions
  15. Vintage Radio: Recreating Sputnik-1, Part 1 by Dr Hugo Holden
  16. Market Centre
  17. Advertising Index
  18. Notes & Errata: Watering System Controller
  19. Outer Back Cover

This is only a preview of the November 2023 issue of Silicon Chip.

You can view 47 of the 112 pages in the full issue, including the advertisments.

For full access, purchase the issue for $10.00 or subscribe for access to the latest issues.

Articles in this series:
  • The History of Electronics, Pt1 (October 2023)
  • The History of Electronics, Pt2 (November 2023)
  • The History of Electronics, Pt3 (December 2023)
  • The History of Electronics, part one (January 2025)
  • The History of Electronics, part two (February 2025)
  • The History of Electronics, part three (March 2025)
  • The History of Electronics, part four (April 2025)
  • The History of Electronics, part five (May 2025)
  • The History of Electronics, part six (June 2025)
Items relevant to "Pico Audio Analyser":
  • Pico (2) Audio Analyser PCB [04107231] (AUD $5.00)
  • 1.3-inch blue OLED with 4-pin I²C interface (Component, AUD $15.00)
  • 1.3-inch white OLED with 4-pin I²C interface (Component, AUD $15.00)
  • Short-form kit for the Pico 2 Audio Analyser (Component, AUD $50.00)
  • Pico Audio Analyser PCB pattern (PDF download) [04107231] (Free)
  • Pico Audio Analyser firmware (0410723A) (Software, Free)
  • Pico Audio Analyser box cutting details (Panel Artwork, Free)
Articles in this series:
  • Pico Audio Analyser (November 2023)
  • Pico 2 Audio Analyser (March 2025)
Articles in this series:
  • El Cheapo Modules From Asia - Part 1 (October 2016)
  • El Cheapo Modules From Asia - Part 2 (December 2016)
  • El Cheapo Modules From Asia - Part 3 (January 2017)
  • El Cheapo Modules from Asia - Part 4 (February 2017)
  • El Cheapo Modules, Part 5: LCD module with I²C (March 2017)
  • El Cheapo Modules, Part 6: Direct Digital Synthesiser (April 2017)
  • El Cheapo Modules, Part 7: LED Matrix displays (June 2017)
  • El Cheapo Modules: Li-ion & LiPo Chargers (August 2017)
  • El Cheapo modules Part 9: AD9850 DDS module (September 2017)
  • El Cheapo Modules Part 10: GPS receivers (October 2017)
  • El Cheapo Modules 11: Pressure/Temperature Sensors (December 2017)
  • El Cheapo Modules 12: 2.4GHz Wireless Data Modules (January 2018)
  • El Cheapo Modules 13: sensing motion and moisture (February 2018)
  • El Cheapo Modules 14: Logarithmic RF Detector (March 2018)
  • El Cheapo Modules 16: 35-4400MHz frequency generator (May 2018)
  • El Cheapo Modules 17: 4GHz digital attenuator (June 2018)
  • El Cheapo: 500MHz frequency counter and preamp (July 2018)
  • El Cheapo modules Part 19 – Arduino NFC Shield (September 2018)
  • El cheapo modules, part 20: two tiny compass modules (November 2018)
  • El cheapo modules, part 21: stamp-sized audio player (December 2018)
  • El Cheapo Modules 22: Stepper Motor Drivers (February 2019)
  • El Cheapo Modules 23: Galvanic Skin Response (March 2019)
  • El Cheapo Modules: Class D amplifier modules (May 2019)
  • El Cheapo Modules: Long Range (LoRa) Transceivers (June 2019)
  • El Cheapo Modules: AD584 Precision Voltage References (July 2019)
  • Three I-O Expanders to give you more control! (November 2019)
  • El Cheapo modules: “Intelligent” 8x8 RGB LED Matrix (January 2020)
  • El Cheapo modules: 8-channel USB Logic Analyser (February 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules (May 2020)
  • New w-i-d-e-b-a-n-d RTL-SDR modules, Part 2 (June 2020)
  • El Cheapo Modules: Mini Digital Volt/Amp Panel Meters (December 2020)
  • El Cheapo Modules: Mini Digital AC Panel Meters (January 2021)
  • El Cheapo Modules: LCR-T4 Digital Multi-Tester (February 2021)
  • El Cheapo Modules: USB-PD chargers (July 2021)
  • El Cheapo Modules: USB-PD Triggers (August 2021)
  • El Cheapo Modules: 3.8GHz Digital Attenuator (October 2021)
  • El Cheapo Modules: 6GHz Digital Attenuator (November 2021)
  • El Cheapo Modules: 35MHz-4.4GHz Signal Generator (December 2021)
  • El Cheapo Modules: LTDZ Spectrum Analyser (January 2022)
  • Low-noise HF-UHF Amplifiers (February 2022)
  • A Gesture Recognition Module (March 2022)
  • Air Quality Sensors (May 2022)
  • MOS Air Quality Sensors (June 2022)
  • PAS CO2 Air Quality Sensor (July 2022)
  • Particulate Matter (PM) Sensors (November 2022)
  • Heart Rate Sensor Module (February 2023)
  • UVM-30A UV Light Sensor (May 2023)
  • VL6180X Rangefinding Module (July 2023)
  • pH Meter Module (September 2023)
  • 1.3in Monochrome OLED Display (October 2023)
  • 16-bit precision 4-input ADC (November 2023)
  • 1-24V USB Power Supply (October 2024)
  • 14-segment, 4-digit LED Display Modules (November 2024)
  • 0.91-inch OLED Screen (November 2024)
  • The Quason VL6180X laser rangefinder module (January 2025)
  • TCS230 Colour Sensor (January 2025)
  • Using Electronic Modules: 1-24V Adjustable USB Power Supply (February 2025)
Items relevant to "K-Type Thermostat":
  • Thermocouple Thermometer/Thermostat main PCB [04108231] (AUD $7.50)
  • Thermocouple Thermometer/Thermostat front panel PCB [04108232] (AUD $2.50)
  • PIC16F1459-I/P programmed for the Thermocouple Thermometer/Thermostat (0410823A.HEX) (Programmed Microcontroller, AUD $10.00)
  • MCP1700 3.3V LDO (TO-92) (Component, AUD $2.00)
  • K-Type Thermocouple Thermometer/Thermostat short-form kit (Component, AUD $75.00)
  • K-Type Thermocouple Thermometer/Thermostat firmware (0410823A.HEX) (Software, Free)
  • K-Type Thermocouple Thermometer/Thermostat PCB pattern (PDF download) [04108231] (Free)
  • K-Type Thermostat panel artwork (PDF download) (Free)
Items relevant to "Modem/Router Watchdog":
  • Modem Watchdog PCB [10111231] (AUD $2.50)
  • Modem/Router Watchdog kit (Component, AUD $35.00)
  • Modem/Router Watchdog Software (Free)
  • Modem Watchdog PCB pattern (PDF download) [10111231] (Free)
Items relevant to "1kW+ Class-D Amplifier, Pt2":
  • 1kW+ Mono Class-D Amplifier cutting and drilling details (Panel Artwork, Free)
Articles in this series:
  • 1kW+ Class-D Amplifier, Pt1 (October 2023)
  • 1kW+ Class-D Amplifier, Pt2 (November 2023)
Items relevant to "Recreating Sputnik-1, Part 1":
  • Sputnik design documents and Manipulator sound recording (Software, Free)
Articles in this series:
  • Recreating Sputnik-1, Part 1 (November 2023)
  • Recreating Sputnik-1, Part 2 (December 2023)

Purchase a printed copy of this issue for $12.50.

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 single-ended 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. 46 Silicon Chip Australia's electronics magazine 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 siliconchip.com.au 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. siliconchip.com.au 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. Australia's electronics magazine November 2023  47 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. 48 Silicon Chip 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 Australia's electronics magazine 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 Vdd 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 zipped-up library code at https://github.com/ hideakitai/ADS1x1x 2. A library called ADS1x15, written by Rob Tillaart, with the documentation and the zipped-up 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. siliconchip.com.au 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: siliconchip. 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 The ADS1115 module I checked out is currently available from Altronics (stock number Z6221) for $20.75 (including GST). At the time of writing, it is also available from Paktronics for $30.07, eBay supplier duomin 87 for $16.01, Temu for $7.48 and AliExpress from $2.39 + P&P. There are some other modules using the ADS1115 that look a little different but are very similar in terms of circuitry. SC siliconchip.com.au Australia's electronics magazine November 2023  49