{"id":10620,"date":"2021-01-06T13:41:28","date_gmt":"2021-01-06T13:41:28","guid":{"rendered":"https:\/\/wolles-elektronikkiste.de\/ads1115-a-d-converter-with-amplifier"},"modified":"2025-10-25T15:10:34","modified_gmt":"2025-10-25T15:10:34","slug":"ads1115-a-d-converter-with-amplifier","status":"publish","type":"post","link":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier","title":{"rendered":"ADS1115 &#8211; A\/D converter with amplifier"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">About this Post<\/h2>\n\n<p>In this article, I would like to introduce the 16-bit, 4-channel A\/D converter ADS1115 and its sibling, the 12-bit, 4-channel A\/D converter ADS1015. You can control both with my ADS1115_WE library. <\/p>\n<p>I will first go into the technical features, then I will use example sketches to show you how you can use the ADS1115 (and the ADS1015) with the library. Finally, there will be&nbsp; &#8211; for those who are interested &#8211; a deeper insight into the ADS1115 and its registers. <\/p>\n<p>To be precise, this article deals with ADS1115 \/ ADS1015 modules. If you are skilled at soldering SMDs, you can of course also use the \u201cbare\u201d ADS1115 \/ ADS1015.  My library should work the same way.<\/p>\n\n<h2 class=\"wp-block-heading\">Why do I need the ADS1115 or the ADS1015?<\/h2>\n\n<p><em>&#8220;My Arduino or microcontroller already has a built-in A\/D converter. So why should I deal with this external A\/D converter?&#8221;<\/em><\/p>\n<p>Here are a few reasons. The ADS1115<\/p>\n<ul>\n<li>has a resolution of 16 bits compared to the 10 bits of the Arduino.<\/li>\n<li>uses an internal amplifier so that it can measure even small voltages.<\/li>\n<li>has an alert function that you can use to efficiently monitor voltages, because:<br><ul>\n<li>if your microcontroller has nothing else to do, you could send it to sleep and let the power efficient ADS1115 work.<\/li>\n<li>outsourced processes that are connected via interrupts can simplify your code.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>The ADS1015 has a resolution of 12 bits but is considerably faster than the ADS1115.<\/p>\n\n<h2 class=\"wp-block-heading\">Technical features of the ADS1115 \/ ADS1015<\/h2>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-1024x316.jpg\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"316\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-1024x316.jpg\" alt=\"Various ADS1115 modules\" class=\"wp-image-6987\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-1024x316.jpg 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-300x93.jpg 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-768x237.jpg 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-1536x474.jpg 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules-1320x408.jpg 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/various_ads1115_modules.jpg 1800w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Various ADS1115 modules<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Inputs and outputs of the ADS1115 \/ ADS1015<\/h3>\n\n<p>The ADS1115 \/ ADS1015 and the modules have the following inputs and outputs:<\/p>\n<ul>\n<li><strong>VCC \/ GND<\/strong>: To be connected to 2 to 5.5 volts.<\/li>\n<li><strong>SDA \/ SCL<\/strong>: Communication via I2C. I didn&#8217;t need any extra pull-up resistors, but they&#8217;re not necessarily implemented in every module.<\/li>\n<li><strong>ADDR<\/strong>: Address pin &#8211; you can choose from four I2C addresses according to the table shown below.<\/li>\n<li><strong>ALRT<\/strong>: the alert pin asserts when adjustable thresholds are exceeded or when an A\/D conversion (&#8220;conversion ready&#8221;) is completed. By default, the pin is deactivated.<\/li>\n<li><strong>A0 &#8211; A3<\/strong>: Connections for the four channels. The applied voltage must not exceed VCC by more than 0.3 volts!<\/li>\n<\/ul>\n\n<p>As you can see, the middle module shown above does not have an address and alarm pin. Thus, you can&#8217;t change the address 0x48 and use the alert functions. If you don&#8217;t need it, you have a very space-saving solution with such a module.<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/ADS1115_Address-1024x111.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/ADS1115_Address-1024x111.png\" alt=\"Setting the I2C addresses of the ADS1115\" class=\"wp-image-6990\"\/><\/a><figcaption class=\"wp-element-caption\">Setting the I2C addresses of the ADS1115 \/ ADS1015<\/figcaption><\/figure>\n\n<p>If you want to check the I2C address, you can use <a href=\"https:\/\/wolles-elektronikkiste.de\/en\/i2c-scanner\" target=\"_blank\" rel=\"noopener noreferrer\">this I2C scanner.<\/a><\/p>\n\n<h3 class=\"wp-block-heading\">attributes<\/h3>\n\n<p>Here is a brief overview of the most important features:<\/p>\n<ul>\n<li>16 bit Resolution &#8211; signed (+\/- 2<sup>15<\/sup> Bit).\n<ul>\n<li>12 bit for the ADS1015<\/li>\n<\/ul>\n<\/li>\n<li>4 channels that can be measured against each other or against GND.<\/li>\n<li>Multiplexing, so only one channel can be converted per time.<\/li>\n<li>6 voltage (or gain) ranges from +\/- 256 mV to +\/- 6.144 V.<\/li>\n<li>Alert function (limit overrun or &#8220;conversion ready&#8221;).<\/li>\n<li>Conversion rate from 8 s<sup>-1<\/sup> to 860 s<sup>-1<\/sup>.\n<ul>\n<li>For the ADS1015: 128 s<sup>-1<\/sup> to 3300 s<sup>-1<\/sup><\/li>\n<\/ul>\n<\/li>\n<li>Continuous mode or single-shot.<\/li>\n<li>Internal voltage reference.<\/li>\n<li>Low power consumption: 150 \u00b5A in continuous mode, 2.5 \u00b5A in power-down mode. The ADS1115 \/ ADS1015 automatically enters power-down mode after a single-shot measurement.<\/li>\n<\/ul>\n<p>Further information can be found in the <a href=\"https:\/\/www.ti.com\/lit\/ds\/symlink\/ads1113.pdf?ts=1593698544723&amp;ref_url=https%253A%252F%252Fwww.google.com%252F\" target=\"_blank\" rel=\"noopener noreferrer\">data sheet<\/a> of the ADS1115.<\/p>\n<p>ADS1115\/ADS1015 modules are available for a few euros in most online stores, e.g. <a href=\"https:\/\/smile.amazon.de\/s?k=ADS1115&amp;__mk_de_DE=%C3%85M%C3%85%C5%BD%C3%95%C3%91&amp;ref=nb_sb_noss\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> on Amazon.<\/p>\n<p>Apparently, there are also ADS1115 modules that do not deliver 16-bit resolution because they are incorrectly based on an ADS1015. There are also ADS1015 modules that are incorrectly based on ADS1115 modules. You can use my sample sketch \u201cWho_AM_I.ino\u201d to check which chip is installed. <\/p>\n\n<h3 class=\"wp-block-heading\">Typical circuit<\/h3>\n\n<p>I used the circuit shown below for all example sketches. Instead of the potentiometers you can, of course, connect anything else to the inputs. You could use a multimeter to check the results, or you could measure in parallel with the analog inputs of the Arduino.<\/p>\n<p>As already mentioned, I didn&#8217;t need pull-ups for the I2C lines. If you have problems, add them.<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-1024x519.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"519\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-1024x519.png\" alt=\"Wiring the ADS1115 - used for all example sketches\" class=\"wp-image-6992\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-1024x519.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-300x152.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-768x389.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-1536x778.png 1536w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring-1320x669.png 1320w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/ADS1115_Test_Wiring.png 1605w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Wiring the ADS1115 &#8211; used for all example sketches<\/figcaption><\/figure>\n\n<h2 class=\"wp-block-heading\">Control with the ADS1115_WE library<\/h2>\n\n<p>You can download the library with the Arduino Library Manager or directly <a href=\"https:\/\/github.com\/wollewald\/ADS1115_WE\" target=\"_blank\" rel=\"noopener noreferrer\">here<\/a> from GitHub.<\/p>\n<p>The use of example sketches is the most effective way to explain how to use the ADS1115_WE library. I have added various example sketches to the library. I go most intensively into Single_Shot.ino. Many functions used there are also used in other sketches. The sketches are written for the ADS1115. The \u201ctranslation\u201d for the ADS1015 is simple. You will find the example sketch \u201cContinuous_ADS1015.ino\u201d as part of the library.<\/p>\n\n<h3 class=\"wp-block-heading\">Example sketch 1: Single_Shot.ino<\/h3>\n\n<p>With this sketch, we measure the four inputs in single-shot mode (i.e. on request) against GND one after the other. The parameters for the library functions you can choose from are listed in the comments in the sketch. A few notes on the (relevant) functions:<\/p>\n<ul>\n<li><code>ADS1115_WE adc = ADS1115_WE()<\/code> creates the ADS1115_WE object. You can pass alternative I2C addresses and buses. &nbsp;<\/li>\n<li><code>init()<\/code> resets the settings of the configuration register of the ADS1115 to the default values. This has the advantage that you do not have to disconnect the ADS1115 from the power supply after you have changed your sketch. Otherwise, you would have to do this to have a defined state of the registers. <code>init()<\/code> also checks the connection to the module. The function returns false if the ADS1115 does not respond.<\/li>\n<li><code>setVoltageRange_mV()<\/code> determines the voltage range in millivolts. The smaller the range, the greater the gain and resolution (= +\/-range \/ 2<sup>15<\/sup>).<\/li>\n<li><code>setCompareChannels()<\/code> sets the channels to be compared.<\/li>\n<li><code>setConversionRate()<\/code> sets the conversion rate in conversions per second (SPS = Samples per second).<\/li>\n<li><code>setMeasureMode()<\/code> sets the mode, i.e. continuous or single-shot. The latter is the default.<\/li>\n<li><code>startSingleMeasurement()<\/code> starts a conversion for the channels previously selected with <code>setCompareChannels()<\/code>.<\/li>\n<li><code>isBusy()<\/code> returns true while the conversion is not yet complete. Without the line<code>while(adc.isBusy()){}<\/code>, the value from the last conversion would be read\u2014and that may come from a different channel. There is only one conversion register!<\/li>\n<li><code>getResult_V()<\/code> delivers the voltage in volts. For small values you can use <code>getResult_mV()<\/code>.<\/li>\n<\/ul>\n<p>The other functions only become relevant when you use the alert pin.<\/p>\n<\/p>\n<div class=\"scroll-paragraph-long\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Single_Shot.ino\" data-enlighter-title=\"Single_Shot.ino\">\/***************************************************************************\n* Example sketch for the ADS1115_WE library\n*\n* This sketch shows how to use the ADS1115 in single shot mode. \n*  \n* Further information can be found on:\n* https:\/\/wolles-elektronikkiste.de\/ads1115 (German)\n* https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier (English)\n* \n***************************************************************************\/\n\n#include&lt;ADS1115_WE.h&gt; \n#include&lt;Wire.h&gt;\n#define I2C_ADDRESS 0x48\n\n\/* There are several ways to create your ADS1115_WE object:\n * ADS1115_WE adc = ADS1115_WE()             -&gt; uses Wire \/ I2C Address = 0x48\n * ADS1115_WE adc = ADS1115_WE(I2C_ADDRESS)  -&gt; uses Wire \/ I2C_ADDRESS\n * ADS1115_WE adc = ADS1115_WE(&amp;wire2)       -&gt; uses the TwoWire object wire2 \/ I2C_ADDRESS\n * ADS1115_WE adc = ADS1115_WE(&amp;wire2, I2C_ADDRESS) -&gt; all together\n * Successfully tested with two I2C busses on an ESP32\n *\/\nADS1115_WE adc = ADS1115_WE(I2C_ADDRESS);\n\nvoid setup() {\n  Wire.begin();\n  Serial.begin(9600);\n  if(!adc.init()){\n    Serial.println(\"ADS1115 not connected!\");\n  }\n\n  \/* Set the voltage range of the ADC to adjust the gain\n   * Please note that you must not apply more than VDD + 0.3V to the input pins!\n   * \n   * ADS1115_RANGE_6144  -&gt;  +\/- 6144 mV\n   * ADS1115_RANGE_4096  -&gt;  +\/- 4096 mV\n   * ADS1115_RANGE_2048  -&gt;  +\/- 2048 mV (default)\n   * ADS1115_RANGE_1024  -&gt;  +\/- 1024 mV\n   * ADS1115_RANGE_0512  -&gt;  +\/- 512 mV\n   * ADS1115_RANGE_0256  -&gt;  +\/- 256 mV\n   *\/\n  adc.setVoltageRange_mV(ADS1115_RANGE_6144); \/\/comment line\/change parameter to change range\n\n  \/* Set the inputs to be compared\n   *  \n   *  ADS1115_COMP_0_1    -&gt;  compares 0 with 1 (default)\n   *  ADS1115_COMP_0_3    -&gt;  compares 0 with 3\n   *  ADS1115_COMP_1_3    -&gt;  compares 1 with 3\n   *  ADS1115_COMP_2_3    -&gt;  compares 2 with 3\n   *  ADS1115_COMP_0_GND  -&gt;  compares 0 with GND\n   *  ADS1115_COMP_1_GND  -&gt;  compares 1 with GND\n   *  ADS1115_COMP_2_GND  -&gt;  compares 2 with GND\n   *  ADS1115_COMP_3_GND  -&gt;  compares 3 with GND\n   *\/\n  \/\/adc.setCompareChannels(ADS1115_COMP_0_GND); \/\/uncomment if you want to change the default\n\n  \/* Set number of conversions after which the alert pin will assert\n   * - or you can disable the alert \n   *  \n   *  ADS1115_ASSERT_AFTER_1  -&gt; after 1 conversion\n   *  ADS1115_ASSERT_AFTER_2  -&gt; after 2 conversions\n   *  ADS1115_ASSERT_AFTER_4  -&gt; after 4 conversions\n   *  ADS1115_DISABLE_ALERT   -&gt; disable comparator \/ alert pin (default) \n   *\/\n  \/\/adc.setAlertPinMode(ADS1115_ASSERT_AFTER_1); \/\/uncomment if you want to change the default\n\n  \/* Set the conversion rate in SPS (samples per second)\n   * Options should be self-explaining: \n   * \n   *  ADS1115_8_SPS \n   *  ADS1115_16_SPS  \n   *  ADS1115_32_SPS \n   *  ADS1115_64_SPS  \n   *  ADS1115_128_SPS (default)\n   *  ADS1115_250_SPS \n   *  ADS1115_475_SPS \n   *  ADS1115_860_SPS \n   *\/\n  \/\/adc.setConvRate(ADS1115_128_SPS); \/\/uncomment if you want to change the default\n\n  \/* Set continuous or single shot mode:\n   * \n   *  ADS1115_CONTINUOUS  -&gt;  continuous mode\n   *  ADS1115_SINGLE     -&gt;  single shot mode (default)\n   *\/\n  \/\/adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/uncomment if you want to change the default\n\n   \/* Choose maximum limit or maximum and minimum alert limit (window) in volts - alert pin will \n   *  assert when measured values are beyond the maximum limit or outside the window \n   *  Upper limit first: setAlertLimit_V(MODE, maximum, minimum)\n   *  In max limit mode the minimum value is the limit where the alert pin assertion will be \n   *  be cleared (if not latched)  \n   * \n   *  ADS1115_MAX_LIMIT\n   *  ADS1115_WINDOW\n   * \n   *\/\n  \/\/adc.setAlertModeAndLimit_V(ADS1115_MAX_LIMIT, 3.0, 1.5); \/\/uncomment if you want to change the default\n  \n  \/* Enable or disable latch. If latch is enabled the alert pin will assert until the\n   * conversion register is read (getResult functions). If disabled the alert pin assertion\n   * will be cleared with next value within limits. \n   *  \n   *  ADS1115_LATCH_DISABLED (default)\n   *  ADS1115_LATCH_ENABLED\n   *\/\n  \/\/adc.setAlertLatch(ADS1115_LATCH_ENABLED); \/\/uncomment if you want to change the default\n\n  \/* Sets the alert pin polarity if active:\n   *  \n   * ADS1115_ACT_LOW  -&gt;  active low (default)   \n   * ADS1115_ACT_HIGH -&gt;  active high\n   *\/\n  \/\/adc.setAlertPol(ADS1115_ACT_LOW); \/\/uncomment if you want to change the default\n \n  \/* With this function the alert pin will assert, when a conversion is ready.\n   * In order to deactivate, use the setAlertLimit_V function  \n   *\/\n  \/\/adc.setAlertPinToConversionReady(); \/\/uncomment if you want to change the default\n\n  Serial.println(\"ADS1115 Example Sketch - Single Shot Mode\");\n  Serial.println(\"Channel \/ Voltage [V]: \");\n  Serial.println();\n}\n\nvoid loop() {\n  float voltage = 0.0;\n\n  Serial.print(\"0: \");\n  voltage = readChannel(ADS1115_COMP_0_GND);\n  Serial.print(voltage);\n\n  Serial.print(\",   1: \");\n  voltage = readChannel(ADS1115_COMP_1_GND);\n  Serial.print(voltage);\n  \n  Serial.print(\",   2: \");\n  voltage = readChannel(ADS1115_COMP_2_GND);\n  Serial.print(voltage);\n\n  Serial.print(\",   3: \");\n  voltage = readChannel(ADS1115_COMP_3_GND);\n  Serial.println(voltage);\n\n  delay(1000);\n}\n\nfloat readChannel(ADS1115_MUX channel) {\n  float voltage = 0.0;\n  adc.setCompareChannels(channel);\n  adc.startSingleMeasurement();\n  while(adc.isBusy()){}\n  voltage = adc.getResult_V(); \/\/ alternative: getResult_mV for Millivolt\n  return voltage;\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">Example sketch 2: Continuous.ino<\/h3>\n\n<p>In this example, the ADS1115 measures continuously. Here, too, we switch channels again. The ADS1115 can always be read, regardless of whether the conversion register has been updated since the last read. Once the channel has been changed, it takes approximately two conversions before a new measurement value is available. To prevent values from being read from the previous channel, a <code>delay()<\/code> matched to the data rate is inserted when changing channels. The library does this in the background.<\/p>\n<p>The main difference in the code is that the measurement does not need to be initiated.<\/p>\n<p>I show here only the relevant or changed lines. <strong>Download the full sketches with the library.<\/strong><\/p>\n<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Continuous.ino\" data-enlighter-title=\"Continuous.ino\">  adc.setVoltageRange_mV(ADS1115_RANGE_6144); \/\/ wir nutzen wieder die ganze Range\n  ....\n  ....\n  \n  adc.setCompareChannels(ADS1115_COMP_0_GND); \/\/ we start with this channel\n  ....\n  ....\n  adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/ here we select continuous mode\n\nvoid loop() {\n  float voltage = 0.0;\n\n  Serial.print(\"0: \");\n  voltage = readChannel(ADS1115_COMP_0_GND);\n  Serial.print(voltage);\n\n  Serial.print(\",   1: \");\n  voltage = readChannel(ADS1115_COMP_1_GND);\n  Serial.print(voltage);\n  ....\n  ....\n  delay(1000);\n}\n\nfloat readChannel(ADS1115_MUX channel) {\n  float voltage = 0.0;\n  adc.setCompareChannels(channel);\n  voltage = adc.getResult_V(); \/\/ we just retrieve a new value no startSingleMeasurement() needed\n  return voltage;\n}<\/pre>\n<p>\u00a0<\/p>\n<p>\n\n<p>Otherwise, the sketch should be understandable without further explanation.<\/p>\n\n<h3 class=\"wp-block-heading\">Example sketch 3: Single_Shot_Conv_Ready_Controlled.ino<\/h3>\n\n<p style=\"text-align: left;\">I have chosen a somewhat unwieldy name for the sketch. What I mean to say is that the ADS1115 measures in single-shot mode and controls the frequency of value output via the number of completed measurements and the conversion rate. I have set the conversion rate to 8 SPS. At every 32nd conversion the sketch outputs a value, i.e. every 4 seconds. Of course, you don&#8217;t have to measure 32 times to read a value. I only did this to slow down the output. It should be clear that the output is controlled by the data rate rather than a delay.  <\/p>\n<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Single_Shot_Conv_Ready_Controlled.ino\" data-enlighter-title=\"Single_Shot_Conv_Ready_Controlled.ino\">  adc.setVoltageRange_mV(ADS1115_RANGE_6144); \n  ....\n  ....\n  adc.setCompareChannels(ADS1115_COMP_0_GND); \n  ....\n  ....\n  adc.setConvRate(ADS1115_8_SPS); \/\/ 8 conversions per second\n  ....\n  ....\n  \/\/adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/ commented, hence default is applied (single-shot)\n  ....\n  ....\nvoid loop() {\n  float voltage = 0.0;\n  for(int i=0; i&lt;32; i++){ \/\/ wait for 32 conversions\n    adc.startSingleMeasurement();\n    while(adc.isBusy()){}\n  }\n  voltage = adc.getResult_V(); \/\/ alternative: getResult_mV for Millivolt\n  Serial.print(\"Channel 0 vs GND [V]: \");\n  Serial.println(voltage);\n  Serial.println(\"-------------------------------\");\n}<\/pre>\n<p>\u00a0<\/p>\n<p>\n\n<h3 class=\"wp-block-heading\">Example sketch 4: Conv_Ready_Alert_Pin_Controlled.ino<\/h3>\n\n<p>Another unwieldy name. This sketch also controls the output frequency by the number of conversions made. Unlike the last example, the Arduino does not ask for completion with <code>isBusy()<\/code>, but the ADS1115 reports this event via the alert pin. If this goes LOW (asserts), an interrupt is triggered that increments the counter variable.<\/p>\n<p>Again, I am only performing the 32 measurements to slow down the output.<\/p>\n<p>As new functions, the sketch uses:<\/p>\n<ul>\n<li><code>setAlertPinMode()<\/code> normally determines after how many limit overruns the alert pin asserts (1, 2 or 4). Actually, this is not relevant here. However, if you do not call the function, the default setting will be applied (ADS1115_DISABLE_ALERT). This means: the function must be called for this sketch with any parameter except ADS1115_DISABLE_ALERT.<\/li>\n<li><code>setAlertPol()<\/code> determines whether the alarm pin is LOW or HIGH in the event of an alert. The default setting is LOW (ADS1115_ACT_LOW).<\/li>\n<li><code>setAlertPinToConversionReady()<\/code> tells the ADS1115 that the alert should be triggered when the conversion is completed.<\/li>\n<\/ul>\n<p>The Conversion Ready alarm also works in continuous mode. However, this only applies to the alarm pin, i.e., the query via hardware. The software query via <code>isBusy()<\/code> only works in single-shot mode.<\/p>\n<\/p>\n<div class=\"scroll-paragraph-long\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Single_Shot_Conv_Ready_Alert_Controlled.ino\" data-enlighter-title=\"Single_Shot_Conv_Ready_Alert_Controlled.ino\">....\n....\nint interruptPin = 2;\nvolatile bool convReady = false;\n....\n....\nvoid setup() {\n  ....\n  ....\n  pinMode(interruptPin, INPUT_PULLUP);\n  ....\n  ....\n  adc.setVoltageRange_mV(ADS1115_RANGE_6144); \n  ....\n  ....\n  adc.setCompareChannels(ADS1115_COMP_0_GND); \n  ....\n  ....\n  adc.setAlertPinMode(ADS1115_ASSERT_AFTER_1); \n  ....\n  ....\n  adc.setConvRate(ADS1115_8_SPS); \/\/comment line\/change paramater to change SPS\n  .... \n  ....\n  \/\/adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/ commented --&gt; single-shot\n  ....\n  ....\n  \/\/adc.setAlertPol(ADS1115_ACT_LOW); \/\/ active-low\n  ....\n  ....\n  adc.setAlertPinToConversionReady(); \/\/ sets the alert pin to conversion ready\n  ....\n  ....\n  attachInterrupt(digitalPinToInterrupt(interruptPin), convReadyAlert, FALLING); \/\/ interrupt, if alert pin is low, ISR = convReadyAlert\n  adc.startSingleMeasurement(); \/\/ start measurement\n}\n\nvoid loop() {\n  float voltage = 0.0;\n  static int counter = 0;\n  if(convReady){\n    counter++;\n    convReady = false;\n    if(counter==32){  \/\/ counter is 32, conversion rate is 8 SPS --&gt; 4s\n      voltage = adc.getResult_V(); \n      Serial.print(\"Channel 0 vs GND [V]: \");\n      Serial.println(voltage);\n      Serial.println(\"-------------------------------\");\n      counter = 0;\n    }\n    adc.startSingleMeasurement();   \n  }\n}\n\nvoid convReadyAlert(){  \/\/ Interrupt Service Routine (ISR)\n   convReady = true;\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">Example sketch 5: Alert_Window_Mode.ino<\/h3>\n\n<p>Now we come to a very helpful feature of the ADS1115, namely the limit alarm. This allows you to monitor voltages very conveniently. However, there is only one register for the upper and lower limits, respectively, and not for each channel. If you want to set the limits for each channel individually, you will have to do so again after each channel change.<\/p>\n<p>The alert pin asserts if you exceed the limits set by you. The conditions under which the ADS1115 deasserts the alert pin again depends on further settings.<\/p>\n<p>The following new function is relevant:<\/p>\n<ul>\n<li><code>setAlertModeAndLimit()<\/code>  :\n<ul>\n<li>Sets the mode:\n<ul>\n<li>With ADS1115_WINDOW, you define a window with maximum and minimum. If values outside the limits are detected, the alert pin asserts. If the ADS1115 then determines values within the limit, the alert pin is deasserted &#8211; unless latch is active.<\/li>\n<li>With ADS1115_MAX_LIMIT, the alert pin only asserts if the maximum is exceeded. The minimum is the value the assertion ends &#8211; unless latch is active.<\/li>\n<\/ul>\n<\/li>\n<li>In addition to the mode, the function also passes the limits in volts.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p>You can find out what latch is all about in example sketch 6. In the current example, the alert pin automatically deassert when the above conditions occur.<\/p>\n<p><em>Note: with assert and deassert I mean &#8220;alert on&#8221; \/ alert off&#8221;. Deassert does not mean that the alert pin is without function.<\/em><\/p>\n<\/p>\n<div class=\"scroll-paragraph-long\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Alert_Window_Mode.ino\" data-enlighter-title=\"Alert_Window_Mode.ino\">....\n....\nint ledPin = 10; \/\/ LED that indicates an alert\nvolatile bool outOfLimit = false;\n....\n....\n\nvoid setup() {\n  ....  \n  pinMode(interruptPin, INPUT_PULLUP);\n  pinMode(ledPin, OUTPUT);\n  digitalWrite(ledPin, LOW);\n  ....\n  ....\n  adc.setCompareChannels(ADS1115_COMP_0_GND); \n  ....\n  ....\n  adc.setAlertPinMode(ADS1115_ASSERT_AFTER_1); \/\/ alert after 1 value that is out of limit\n  ....\n  ....  \n  adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/ single-shot would make no sense here\n  ....\n  ....\n  adc.setAlertModeAndLimit_V(ADS1115_WINDOW, 3.0, 1.5); \/\/you can change modes \/ limits\n  ....\n  ....\n  \/\/adc.setAlertPinToConversionReady(); \/\/ must be commented\n  ....\n  attachInterrupt(digitalPinToInterrupt(interruptPin), outOfLimitAlert, FALLING);\n}\n\nvoid loop() {\n  float voltage = 0.0;\n  if(outOfLimit){\n    voltage = adc.getResult_V();\n    Serial.print(\"Voltage [V]: \");\n    Serial.println(voltage);  \n    digitalWrite(ledPin,HIGH);\n    delay(1000);\n    digitalWrite(ledPin,LOW);\n    outOfLimit = false;\n    attachInterrupt(digitalPinToInterrupt(interruptPin), outOfLimitAlert, FALLING); \n  } \n}\n\nvoid outOfLimitAlert(){\n  detachInterrupt(2);\n  outOfLimit = true;\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h3 class=\"wp-block-heading\">Example sketch 6: Alert_Window_Mode_with_Latch.ino<\/h3>\n\n<p>This sketch basically does the same as Alert_Window_Mode.ino, except that latch is used. Latch prevents the alert pin from being automatically deactivated again.<\/p>\n<p>The following new functions are relevant:<\/p>\n<ul>\n<li><code>setAlertLatch()<\/code> activates or deactivates latch.<\/li>\n<li><code>clearAlert()<\/code> deactivates the alert pin. Latch is active when the next reading is outside the limits. As an alternative to <code>clearAlert()<\/code> you can use <code>getResult_V()<\/code> or <code>getResult_mV()<\/code>.<\/li>\n<\/ul>\n<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Alert_Window_Mode_with_Latch.ino\" data-enlighter-title=\"Alert_Window_Mode_with_Latch.ino\">....\nvolatile int interruptPin = 2;\nint ledPin = 10;\nvolatile bool outOfLimit = false;\n....\n....\nvoid setup() {\n  ....\n  ....\n  adc.setCompareChannels(ADS1115_COMP_0_GND);\n  ....\n  ....\n  adc.setAlertPinMode(ADS1115_ASSERT_AFTER_1); \/\/ ...AFTER_2 or ...4 would also work\n  ....\n  ....\n  adc.setMeasureMode(ADS1115_CONTINUOUS); \n  ....\n  ....\n  adc.setAlertModeAndLimit_V(ADS1115_WINDOW, 3.0, 1.5); \/\/ you could also select the max limit method\n  ....\n  ....\n  adc.setAlertLatch(ADS1115_LATCH_ENABLED); \/\/ latch enabled\n  ....\n  ....\n  attachInterrupt(digitalPinToInterrupt(interruptPin), outOfLimitAlert, FALLING);\n}\n\nvoid loop() {\n  float voltage = 0.0;\n  if(outOfLimit){\n    voltage = adc.getResult_V();\n    Serial.print(\"Voltage [V]: \");\n    Serial.println(voltage);  \n    digitalWrite(ledPin,HIGH);\n    delay(1000);\n    digitalWrite(ledPin,LOW);\n    outOfLimit = false;\n    attachInterrupt(digitalPinToInterrupt(interruptPin), outOfLimitAlert, FALLING); \n    adc.clearAlert(); \/\/ clear alert; alternatives: call getResult_V() or getResult_mV()\n  } \n}\n\nvoid outOfLimitAlert(){\n  detachInterrupt(2);\n  outOfLimit = true;\n}<\/pre>\n<p>\u00a0<\/p>\n<p>\n\n<p>After the output of the exceeded limit value and the warning light of the LED, first the interrupt is switched on again. Then the alarm is deactivated with <code>clearAlert()<\/code>, i.e. the pin goes HIGH. If the out-of-limit condition still exists, the next interrupt is triggered immediately. As a result, the LED lights up almost continuously. <\/p>\n<p>The latch provides more control, but you have to be careful with the timing. If you switch on the interrupt function after you have deactivated the alert, then the alert pin may be low again and a &#8220;falling&#8221; will not occur anymore.<\/p>\n\n<h3 class=\"wp-block-heading\">Example sketch 7: Auto_Range.ino<\/h3>\n\n<p>In this example sketch, I present the functions <code>setAutoRange()<\/code> and <code>setPermanentAutoRangeMode()<\/code>. As you can imagine, the range is set automatically with both. To do this, <code>setAutoRange()<\/code> does the following:<\/p>\n<ul>\n<li>If the ADS1115 is in single-shot mode, the function switches to continuous mode.<\/li>\n<li>The maximum range (+\/- 6.144) is set first.<\/li>\n<li>A measured value is recorded.<\/li>\n<li>The smallest possible range is then selected in which the measured value is still below 80% of the maximum value of the range. I have selected 80% so that certain fluctuations do not immediately lead to an overflow.<\/li>\n<li>If the ADS1115 was originally in single-shot mode, it will switch back to this mode.<\/li>\n<\/ul>\n<p>The function <code>setAutoRange()<\/code> only makes sense if the expected measured values are stable or change only slowly. A call to the function takes a period of several conversions. If you have set 8 SPS as the conversion rate, this is already clearly noticeable.<\/p>\n<p><code>setPermanentAutoRangeMode()<\/code> only needs to be called once. You can use it to set the system to check whether each measured value is within the range of 30 &#8211; 80 % of the maximum value of the current range. Only if this is not the case is <code>setAutoRange()<\/code> called up in the background. This makes the function faster. Uses one OR the other function.<\/p>\n<p>To show that the range change really works, the range is also output in the example sketch.<\/p>\n<\/p>\n<div class=\"scroll-paragraph-long\">\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Auto_Range.ino\" data-enlighter-title=\"Auto_Range.ino\">....\n  adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/comment line\/change parameter to change mode\n  .... \n  .... \n  adc.setPermanentAutoRangeMode(true);  \/\/use either this or setAutoRange()\n  ....\n}\n\nvoid loop() {\n  float voltage = 0.0;\n  \n  Serial.print(\"Channel 0 - \");\n  readChannel(ADS1115_COMP_0_GND);\n  \n  Serial.print(\"Channel 1 - \");\n  readChannel(ADS1115_COMP_1_GND);   \n  ....\n  ....\n  Serial.println(\"-------------------------------\");\n  delay(1000);\n}\n\nvoid readChannel(ADS1115_MUX channel) {\n  float voltage = 0.0;\n  adc.setCompareChannels(channel);\n  \/\/adc.setAutoRange(); \/\/use either this or setPermanentAutoRangeMode(true)\n  voltage = adc.getResult_V(); \/\/ alternative: getResult_mV for Millivolt\n  printVoltageRange(); \/\/ this is just to show that the range is changing with changing voltages \n  Serial.println(voltage);\n}\n  \nvoid printVoltageRange(){\n  unsigned int voltageRange = adc.getVoltageRange_mV();\n  Serial.print(\"Range: \");\n\n  switch(voltageRange){\n    case 6144:\n      Serial.print(\"+\/- 6144 mV, Voltage [V]: \");\n      break;\n    case 4096:\n      Serial.print(\"+\/- 4096 mV, Voltage [V]: \");\n      break;\n    case 2048:\n      Serial.print(\"+\/- 2048 mV, Voltage [V]: \");\n      break;\n    case 1024:\n      Serial.print(\"+\/- 1024 mV, Voltage [V]: \");\n      break;\n    case 512:\n      Serial.print(\"+\/- 512 mV, Voltage [V]: \");\n      break;\n    case 256:\n      Serial.print(\"+\/- 256 mV, Voltage [V]: \");\n      break;\n    default:\n      Serial.println(\"Something went wrong\");\n  }\n}<\/pre>\n<p>\u00a0<\/p>\n<\/div>\n<p>\n\n<h4 class=\"wp-block-heading\">Output of Auto_Range.ino<\/h4>\n\n<p>An output of the sketch could then look like this:<\/p>\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/09\/Output_Auto_Range_2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"774\" height=\"361\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/09\/Output_Auto_Range_2.png\" alt=\"Example sketches ADS1115:&#10;Output of Auto_Range.ino\" class=\"wp-image-12595\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/09\/Output_Auto_Range_2.png 774w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/09\/Output_Auto_Range_2-300x140.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/09\/Output_Auto_Range_2-768x358.png 768w\" sizes=\"auto, (max-width: 774px) 100vw, 774px\" \/><\/a><figcaption class=\"wp-element-caption\"> Output of Auto_Range.ino <\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">Example sketch 8: Result_Format_Options<\/h3>\n\n<p>This sketch shows the various output options for the conversion results:<\/p>\n<ul>\n<li><code>getResult_mV()<\/code> returns the result in millivolts<\/li>\n<li><code>getResult_V()<\/code> outputs the result in volts<\/li>\n<li><code>getRawResult()<\/code> returns the raw value as it appears in the conversion register<\/li>\n<li>With <code>getResultWith Range(x,y)<\/code> the raw value is scaled to the range x to y. If you select (-1023, 1023), for example, you will get your result back as a 10-bit value. <\/li>\n<li>If you call the last function with a third parameter like <code>getResultWithRange(x,y,z)<\/code>, the result is also scaled to a voltage range. The parameter is specified in millivolts. The parameters (-1023, 1023, 5000) would give you the value that you would get with analogRead() with an Arduino Uno R3 in the default settings.  <\/li>\n<\/ul>\n<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-group=\"Result_Format_Options.ino\" data-enlighter-title=\"Result_Format_Options.ino\"> ....\n  adc.setVoltageRange_mV(ADS1115_RANGE_6144); \/\/comment line\/change parameter to change range\n  adc.setCompareChannels(ADS1115_COMP_0_GND); \/\/comment line\/change parameter to change channel\n  adc.setMeasureMode(ADS1115_CONTINUOUS); \/\/comment line\/change parameter to change mode\n  ....\n  ....\n\nvoid loop() {\n  \n  float voltageInMillivolt = adc.getResult_mV(); \n  Serial.print(\"Result in Millivolt          [mV]: \");\n  Serial.println(voltageInMillivolt);\n\n  float voltageInVolt = adc.getResult_V(); \n  Serial.print(\"Result in Volt                [V]: \");\n  Serial.println(voltageInVolt);\n\n  int rawResult = adc.getRawResult();\n  Serial.print(\"Raw Result                       : \");\n  Serial.println(rawResult);\n\n  int scaledResult = adc.getResultWithRange(-1023, 1023);\n  Serial.print(\"Scaled result                    : \");\n  Serial.println(scaledResult);\n\n  int scaledResultWithMaxVoltage = adc.getResultWithRange(-1023, 1023, 5000); \n  Serial.print(\"Scaled result with voltage scale : \");\n  Serial.println(scaledResultWithMaxVoltage);\n\n  unsigned int voltRange = adc.getVoltageRange_mV();\n  Serial.print(\"Voltage Range of ADS1115     [mV]: \");\n  Serial.println(voltRange);\n  \n  Serial.println(\"-------------------------------\");\n  delay(2000);\n}<\/pre>\n<p>\u00a0<\/p>\n<p>\n\n<h4 class=\"wp-block-heading\">Output of Result_Format_Options.ino<\/h4>\n\n<p>And this is what an output of the Result_Format_Option.ino sketch looks like:<\/p>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/02\/Output_Result_Format_Options.png\"><img loading=\"lazy\" decoding=\"async\" width=\"716\" height=\"349\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/02\/Output_Result_Format_Options.png\" alt=\"\" class=\"wp-image-11148\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/02\/Output_Result_Format_Options.png 716w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/02\/Output_Result_Format_Options-300x146.png 300w\" sizes=\"auto, (max-width: 716px) 100vw, 716px\" \/><\/a><figcaption class=\"wp-element-caption\">Output of Result_Format_Options.ino<\/figcaption><\/figure>\n\n<h3 class=\"wp-block-heading\">All functions at a glance<\/h3>\n\n<p><a href=\"https:\/\/github.com\/wollewald\/ADS1115_WE\/blob\/master\/List%20of%20public%20functions.pdf\" target=\"_blank\" rel=\"noopener\">Here<\/a> I have summarized all the functions. The table is part of my documentation on GitHub. However, you can also find the table as &#8220;List of public functions.pdf&#8221; in the library folder &#8220;libraries\/ADS1115_WE&#8221; on your PC, provided you have installed the library.  <\/p>\n<p>I have not mentioned one function yet, namely <code>reset()<\/code> . It uses the global I2C reset (0x06). All I2C devices that are connected to the same interface and also listen to the global commands (general calls) perform a reset when the function is called. <\/p>\n\n<h2 class=\"wp-block-heading\">Deeper insights into the ADS1115 \/ ADS1015<\/h2>\n\n<p>I am referring to the ADS1115 in this chapter. The good news is that the registers of the ADS1015 are almost identical. For all registers where its 12-bit resolution is used, the lowest 4 bits are simply set to 0.<\/p>\n\n<h3 class=\"wp-block-heading\">Register map<\/h3>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/ads1115_register_map-1024x264.png\"><img decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2021\/01\/ads1115_register_map-1024x264.png\" alt=\"Registers of the ADS1115\" class=\"wp-image-10559\"\/><\/a><figcaption class=\"wp-element-caption\">Registers of the ADS1115<\/figcaption><\/figure>\n\n<p>The ADS1115 has a relatively small number of registers. All settings &#8211; with one exception &#8211; are made in the configuration register (config register). I&#8217;ll go into that in a little bit.<\/p>\n\n<p>The results of the conversions are retrieved from the conversion register. There is only one for all four channels. Therefore, you always have to select the channel first and then wait for a result for this channel. The LSB for the conversion register is:<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-9f34c41a5e8089a676a9afda40f46853_l3.png\" height=\"39\" width=\"122\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#76;&#83;&#66;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#82;&#97;&#110;&#103;&#101;&#125;&#123;&#50;&#94;&#123;&#49;&#53;&#125;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>If you have defined the range, as I did, in millivolts, you then calculate the voltage in volts as follows:<\/p>\n<\/p>\n<p class=\"ql-center-displayed-equation\" style=\"line-height: 39px;\"><span class=\"ql-right-eqno\"> &nbsp; <\/span><span class=\"ql-left-eqno\"> &nbsp; <\/span><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/ql-cache\/quicklatex.com-b74bdea25a7bca81db277364de84ef90_l3.png\" height=\"39\" width=\"238\" class=\"ql-img-displayed-equation quicklatex-auto-format\" alt=\"&#92;&#091; &#85;&#32;&#92;&#116;&#101;&#120;&#116;&#123;&#091;&#86;&#093;&#125;&#32;&#61;&#32;&#92;&#102;&#114;&#97;&#99;&#123;&#76;&#83;&#66;&#32;&#92;&#99;&#100;&#111;&#116;&#32;&#67;&#111;&#110;&#118;&#82;&#101;&#103;&#105;&#115;&#116;&#101;&#114;&#125;&#123;&#49;&#48;&#48;&#48;&#125; &#92;&#093;\" title=\"Rendered by QuickLaTeX.com\"\/><\/p>\n<p>\n\n<p>Because the conversion register is signed, it can take values from +2<sup>15<\/sup> to -2<sup>15.<\/sup><\/p>\n<p>Reading the conversion register deletes a limit alert unless latch is enabled.<\/p>\n\n<p>In the two limit registers (Lo_thresh and Hi_thesh) you enter the limit values if you want to use the alert function. The ADS1115 compares the content of the limit registers with the content of the conversion register. If you change the range, you must also convert the content of the limit registers. My library does this automatically. As a result, my function <code>setVoltageRange()<\/code> has become somewhat complex. <\/p>\n\n<p>The only setting you make outside the configuration register (excluding the limits, of course) is to set the conversion ready alert. To activate this function, you need to write a &#8220;1&#8221; in the MSB of the Hi_thresh register and a &#8220;0&#8221; in the MSB of the Lo_thresh register. Since the limit registers are signed, the upper limit is negative and the lower one is positive. This condition, meaningless in itself, instructs the ADS1115 to activate the alert pin when a conversion is complete. The library provides the function <code>setAlertPinToConversionReady()<\/code> for this purpose.<\/p>\n\n<h3 class=\"wp-block-heading\">The configuration register<\/h3>\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/config_reg_ADS1115-1024x174.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"174\" src=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/config_reg_ADS1115-1024x174.png\" alt=\"Configuration register of the ADS1115\" class=\"wp-image-7033\" srcset=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/config_reg_ADS1115-1024x174.png 1024w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/config_reg_ADS1115-300x51.png 300w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/config_reg_ADS1115-768x131.png 768w, https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/06\/config_reg_ADS1115.png 1294w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">Configuration register<\/figcaption><\/figure>\n\n<p>The configuration register contains the following bits:<\/p>\n<ul>\n<li><strong>COMP_QUE[1:0]<\/strong>: defines after how many &#8220;out-of-range&#8221; measurements the ADS1115 activates the alarm pin. Alternatively, the bits switch off the alarm function. The associated function is <code>setAlertPinMode()<\/code> .<\/li>\n<li><strong>COMP_LAT<\/strong> activates or deactivates latch. If latch is activated, you must manually deactivate the alert. The COMP_LAT bit is set or deleted with <code>setAlertLatch()<\/code>.<\/li>\n<li><strong>COMP_POL<\/strong> determines the polarity of the alert pin -&gt; <code>setAlertPol()<\/code>.<\/li>\n<li><strong>COMP_MODE<\/strong> determines the alarm mode. Either you define an upper limit or a window. The associated function <code>setAlertModeAndLimit()<\/code> determines the mode and sets the limits.<\/li>\n<li><strong>DR[2:0]<\/strong> determines the conversion rate -&gt; <code>setConvRate()<\/code>.<\/li>\n<li><strong>MODE<\/strong>: sets the continuous or single-shot mode -&gt; <code>setMeasureMode()<\/code>.<\/li>\n<li><strong>PGA[2:0]<\/strong> sets the range -&gt; <code>setVoltageRange_mV()<\/code>;<\/li>\n<li><strong>MUX[2:0]<\/strong> determines the channel or channels to be compared -&gt; <code>setCompareChannels()<\/code>.<\/li>\n<li><strong>OS<\/strong> has a double meaning. When writing, a &#8220;1&#8221; in single-shot mode triggers a measurement &#8211; &gt; <code>startSingleMeasurement()<\/code> . When reading, a &#8220;0&#8221; means that a conversion is ongoing, and a &#8220;1&#8221; means the opposite. The function for this is <code>isBusy()<\/code>.<\/li>\n<\/ul>\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ADS1115 is a 16-bit, 4-channel A\/D converter with amplifier and alert function. I explain its technical details and present my associated library. <\/p>\n","protected":false},"author":1,"featured_media":8631,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[574,572],"tags":[1247,1241,2272,1242,1243,1245,558,1246,1244],"class_list":["post-10620","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-current-voltage","category-sensors","tag-16-bit-resolution","tag-a-d-converter","tag-ads1015-en","tag-ads1115-en","tag-alert-pin","tag-alertpin","tag-library-en-2","tag-traditional-mode-en","tag-window-mode-en"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.3 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>ADS1115 - A\/D converter with amplifier &#8226; Wolles Elektronikkiste<\/title>\n<meta name=\"description\" content=\"The ADS1115 is a 16-bit, 4-channel A\/D converter with amplifier and alert function. I explain its technical details and present my associated library.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"ADS1115 - A\/D converter with amplifier &#8226; Wolles Elektronikkiste\" \/>\n<meta property=\"og:description\" content=\"The ADS1115 is a 16-bit, 4-channel A\/D converter with amplifier and alert function. I explain its technical details and present my associated library.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier\" \/>\n<meta property=\"og:site_name\" content=\"Wolles Elektronikkiste\" \/>\n<meta property=\"article:published_time\" content=\"2021-01-06T13:41:28+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-25T15:10:34+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1022\" \/>\n\t<meta property=\"og:image:height\" content=\"1022\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Wolfgang Ewald\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Wolfgang Ewald\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"22 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier\"},\"author\":{\"name\":\"Wolfgang Ewald\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"headline\":\"ADS1115 &#8211; A\\\/D converter with amplifier\",\"datePublished\":\"2021-01-06T13:41:28+00:00\",\"dateModified\":\"2025-10-25T15:10:34+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier\"},\"wordCount\":2889,\"commentCount\":112,\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild.png\",\"keywords\":[\"16 bit resolution\",\"A\\\/D converter\",\"ADS1015\",\"ADS1115\",\"alert pin\",\"alertpin\",\"Library\",\"traditional mode\",\"window mode\"],\"articleSection\":[\"Current, voltage\",\"Sensors\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier\",\"name\":\"ADS1115 - A\\\/D converter with amplifier &#8226; Wolles Elektronikkiste\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild.png\",\"datePublished\":\"2021-01-06T13:41:28+00:00\",\"dateModified\":\"2025-10-25T15:10:34+00:00\",\"description\":\"The ADS1115 is a 16-bit, 4-channel A\\\/D converter with amplifier and alert function. I explain its technical details and present my associated library.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#primaryimage\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2020\\\/07\\\/Beitragsbild.png\",\"width\":1022,\"height\":1022},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\\\/ads1115-a-d-converter-with-amplifier#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Startseite\",\"item\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"ADS1115 &#8211; A\\\/D converter with amplifier\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#website\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en\",\"name\":\"Wolles Elektronikkiste\",\"description\":\"Die wunderbare Welt der Elektronik\",\"publisher\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/en#\\\/schema\\\/person\\\/b774e4d64b4766889a2f7c6e5ec85b46\",\"name\":\"Wolfgang Ewald\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"url\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"contentUrl\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\",\"width\":512,\"height\":512,\"caption\":\"Wolfgang Ewald\"},\"logo\":{\"@id\":\"https:\\\/\\\/wolles-elektronikkiste.de\\\/wp-content\\\/uploads\\\/2019\\\/03\\\/cropped-Logo-1.png\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"ADS1115 - A\/D converter with amplifier &#8226; Wolles Elektronikkiste","description":"The ADS1115 is a 16-bit, 4-channel A\/D converter with amplifier and alert function. I explain its technical details and present my associated library.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier","og_locale":"en_US","og_type":"article","og_title":"ADS1115 - A\/D converter with amplifier &#8226; Wolles Elektronikkiste","og_description":"The ADS1115 is a 16-bit, 4-channel A\/D converter with amplifier and alert function. I explain its technical details and present my associated library.","og_url":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier","og_site_name":"Wolles Elektronikkiste","article_published_time":"2021-01-06T13:41:28+00:00","article_modified_time":"2025-10-25T15:10:34+00:00","og_image":[{"width":1022,"height":1022,"url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild.png","type":"image\/png"}],"author":"Wolfgang Ewald","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Wolfgang Ewald","Est. reading time":"22 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#article","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier"},"author":{"name":"Wolfgang Ewald","@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"headline":"ADS1115 &#8211; A\/D converter with amplifier","datePublished":"2021-01-06T13:41:28+00:00","dateModified":"2025-10-25T15:10:34+00:00","mainEntityOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier"},"wordCount":2889,"commentCount":112,"publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild.png","keywords":["16 bit resolution","A\/D converter","ADS1015","ADS1115","alert pin","alertpin","Library","traditional mode","window mode"],"articleSection":["Current, voltage","Sensors"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#respond"]}]},{"@type":"WebPage","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier","url":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier","name":"ADS1115 - A\/D converter with amplifier &#8226; Wolles Elektronikkiste","isPartOf":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#website"},"primaryImageOfPage":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#primaryimage"},"image":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#primaryimage"},"thumbnailUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild.png","datePublished":"2021-01-06T13:41:28+00:00","dateModified":"2025-10-25T15:10:34+00:00","description":"The ADS1115 is a 16-bit, 4-channel A\/D converter with amplifier and alert function. I explain its technical details and present my associated library.","breadcrumb":{"@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#primaryimage","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2020\/07\/Beitragsbild.png","width":1022,"height":1022},{"@type":"BreadcrumbList","@id":"https:\/\/wolles-elektronikkiste.de\/en\/ads1115-a-d-converter-with-amplifier#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Startseite","item":"https:\/\/wolles-elektronikkiste.de\/en"},{"@type":"ListItem","position":2,"name":"ADS1115 &#8211; A\/D converter with amplifier"}]},{"@type":"WebSite","@id":"https:\/\/wolles-elektronikkiste.de\/en#website","url":"https:\/\/wolles-elektronikkiste.de\/en","name":"Wolles Elektronikkiste","description":"Die wunderbare Welt der Elektronik","publisher":{"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/wolles-elektronikkiste.de\/en?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/wolles-elektronikkiste.de\/en#\/schema\/person\/b774e4d64b4766889a2f7c6e5ec85b46","name":"Wolfgang Ewald","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","url":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","contentUrl":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png","width":512,"height":512,"caption":"Wolfgang Ewald"},"logo":{"@id":"https:\/\/wolles-elektronikkiste.de\/wp-content\/uploads\/2019\/03\/cropped-Logo-1.png"}}]}},"_links":{"self":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10620","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/comments?post=10620"}],"version-history":[{"count":4,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10620\/revisions"}],"predecessor-version":[{"id":25041,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/posts\/10620\/revisions\/25041"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media\/8631"}],"wp:attachment":[{"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/media?parent=10620"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/categories?post=10620"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wolles-elektronikkiste.de\/en\/wp-json\/wp\/v2\/tags?post=10620"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}