{"id":1549,"date":"2020-04-28T08:13:23","date_gmt":"2020-04-28T00:13:23","guid":{"rendered":"https:\/\/www.strongd.net\/?p=1549"},"modified":"2020-04-28T08:13:23","modified_gmt":"2020-04-28T00:13:23","slug":"ads1115-analog-to-digital-converter-and-esp8266","status":"publish","type":"post","link":"https:\/\/www.strongd.net\/?p=1549","title":{"rendered":"ADS1115 analog-to-digital converter and ESP8266"},"content":{"rendered":"<p>The ADS1115 device is a precision, low-power, 16-bit, I2C-compatible, analog-to-digital converters (ADCs) offered in an ultra-small, leadless, X2QFN-10 package, and a VSSOP-10 package. The ADS1115 device incorporates a low-drift voltage reference and an oscillator. The ADS1115 also incorporate a programmable gain amplifier and a digital comparator. These features, along with a wide operating supply range, make the ADS1115 well suited for power- and space-constrained, sensor measurement applications.<\/p>\n<p><a href=\"http:\/\/s.click.aliexpress.com\/e\/I3eIGgY\" target=\"_parent\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/i1.wp.com\/ae01.alicdn.com\/kf\/HTB1F2AnFv9TBuNjy1zbq6xpepXa8\/I2C-font-b-ADS1115-b-font-16-Bit-ADC-4-channel-Module-with-Programmable-Gain-Amplifier.jpg_220x220.jpg?w=696\" width=\"220\" height=\"219\" \/><\/a><\/p>\n<p>The ADS1115 perform conversions at data rates up to 860 samples per second (SPS). The PGA offers input ranges from \u00b1256 mV to \u00b16.144 V, allowing precise large- and small-signal measurements. The ADS1115 features an input multiplexer\u00a0 that allows two differential or four single-ended input measurements. Use the digital comparator in the ADS1115 for under- and overvoltage detection.<\/p>\n<p>The ADS1115 operates in either continuous-conversion mode or single-shot mode. The devices are automatically powered down after one conversion in single-shot mode; therefore, power consumption is significantly reduced during idle periods.<\/p>\n<p><strong>Features<\/strong><\/p>\n<p>Wide Supply Range: 2.0 V to 5.5 V<br \/>\nLow Current Consumption: 150 \u00b5A<br \/>\n(Continuous-Conversion Mode)<br \/>\nProgrammable Data Rate: 8 SPS to 860 SPS<br \/>\nSingle-Cycle Settling<br \/>\nInternal Low-Drift Voltage Reference<br \/>\nInternal Oscillator<br \/>\nI2C Interface: Four Pin-Selectable Addresses<br \/>\nFour Single-Ended or Two Differential Inputs (ADS1115)<br \/>\nProgrammable Comparator (ADS1114 and ADS1115)<br \/>\nOperating Temperature Range: \u201340\u00b0C to +125\u00b0C<\/p>\n<h2>Parts List<\/h2>\n<p>This module will cost less than $2<\/p>\n<table width=\"509\">\n<thead>\n<tr>\n<th>Amount<\/th>\n<th>Part Type<\/th>\n<th><\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>1<\/td>\n<td><a href=\"http:\/\/s.click.aliexpress.com\/e\/b7ZMAskg\" target=\"_blank\" rel=\"noopener noreferrer\">ADS1115<\/a><\/td>\n<td class=\"props\"><\/td>\n<\/tr>\n<tr>\n<td>1<\/td>\n<td><a href=\"http:\/\/s.click.aliexpress.com\/e\/3xflLfS\" target=\"_parent\" rel=\"noopener noreferrer\">Wemos D1 mini V2<\/a><\/td>\n<td class=\"props\"><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<h3>Schematics\/Layout<\/h3>\n<p>&nbsp;<\/p>\n<p>In the layout below we just show basic connection between Wemos Mini and ADS1115 \u2013 you can add a pot, connect an LDR to one of the A0 \u2013 A3 inputs of the ADS1115<\/p>\n<figure id=\"attachment_640\" class=\"wp-caption alignnone\" aria-describedby=\"caption-attachment-640\"><img loading=\"lazy\" decoding=\"async\" class=\"size-full wp-image-640\" src=\"https:\/\/i0.wp.com\/www.esp8266learning.com\/wp-content\/uploads\/2018\/09\/esp8266-and-ads1115_bb.jpg?resize=642%2C432\" sizes=\"auto, (max-width: 642px) 100vw, 642px\" srcset=\"https:\/\/i0.wp.com\/www.esp8266learning.com\/wp-content\/uploads\/2018\/09\/esp8266-and-ads1115_bb.jpg?w=642 642w,https:\/\/i0.wp.com\/www.esp8266learning.com\/wp-content\/uploads\/2018\/09\/esp8266-and-ads1115_bb.jpg?resize=300%2C202 300w,https:\/\/i0.wp.com\/www.esp8266learning.com\/wp-content\/uploads\/2018\/09\/esp8266-and-ads1115_bb.jpg?resize=150%2C101 150w,https:\/\/i0.wp.com\/www.esp8266learning.com\/wp-content\/uploads\/2018\/09\/esp8266-and-ads1115_bb.jpg?resize=400%2C269 400w\" alt=\"esp8266 and ads1115\" width=\"484\" height=\"326\" \/><figcaption id=\"caption-attachment-640\" class=\"wp-caption-text\">esp8266 and ads1115<\/figcaption><\/figure>\n<p>&nbsp;<\/p>\n<h3>Code<\/h3>\n<p>Again we use a library and again its an adafruit one \u2013\u00a0<a href=\"https:\/\/github.com\/adafruit\/Adafruit_ADS1X15\" target=\"_blank\" rel=\"noopener noreferrer\">https:\/\/github.com\/adafruit\/Adafruit_ADS1X15<\/a><\/p>\n<div id=\"wpshdo_1\" class=\"wp-synhighlighter-outer\">\n<div id=\"wpshdi_1\" class=\"wp-synhighlighter-inner\">\n<pre class=\"cpp\"><span class=\"co2\">#include &lt;Wire.h&gt;<\/span>\r\n<span class=\"co2\">#include &lt;Adafruit_ADS1015.h&gt;<\/span>\r\n\u00a0\r\nAdafruit_ADS1115 ads<span class=\"br0\">(<\/span>0x48<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\n\u00a0\r\n<span class=\"kw4\">void<\/span> setup<span class=\"br0\">(<\/span><span class=\"kw4\">void<\/span><span class=\"br0\">)<\/span>\r\n<span class=\"br0\">{<\/span>\r\nSerial.<span class=\"me1\">begin<\/span><span class=\"br0\">(<\/span>9600<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"Hello!\"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\n\u00a0\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"Getting single-ended readings from AIN0..3\"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"ADC Range: +\/- 6.144V (1 bit = 3mV\/ADS1015, 0.1875mV\/ADS1115)\"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\n\u00a0\r\nads.<span class=\"me1\">begin<\/span><span class=\"br0\">(<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\n<span class=\"br0\">}<\/span>\r\n\u00a0\r\n<span class=\"kw4\">void<\/span> loop<span class=\"br0\">(<\/span><span class=\"kw4\">void<\/span><span class=\"br0\">)<\/span>\r\n<span class=\"br0\">{<\/span>\r\nint16_t adc0, adc1, adc2, adc3<span class=\"sy4\">;<\/span>\r\n\u00a0\r\nadc0 <span class=\"sy1\">=<\/span> ads.<span class=\"me1\">readADC_SingleEnded<\/span><span class=\"br0\">(<\/span>0<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nadc1 <span class=\"sy1\">=<\/span> ads.<span class=\"me1\">readADC_SingleEnded<\/span><span class=\"br0\">(<\/span>1<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nadc2 <span class=\"sy1\">=<\/span> ads.<span class=\"me1\">readADC_SingleEnded<\/span><span class=\"br0\">(<\/span>2<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nadc3 <span class=\"sy1\">=<\/span> ads.<span class=\"me1\">readADC_SingleEnded<\/span><span class=\"br0\">(<\/span>3<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">print<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"AIN0: \"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span>adc0<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">print<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"AIN1: \"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span>adc1<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">print<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"AIN2: \"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span>adc2<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">print<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\"AIN3: \"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span>adc3<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\nSerial.<span class=\"me1\">println<\/span><span class=\"br0\">(<\/span><span class=\"st0\">\" \"<\/span><span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\n\u00a0\r\ndelay<span class=\"br0\">(<\/span>1000<span class=\"br0\">)<\/span><span class=\"sy4\">;<\/span>\r\n<span class=\"br0\">}<\/span><\/pre>\n<\/div>\n<\/div>\n<p>&nbsp;<\/p>\n<h3>Links<\/h3>\n<p><a href=\"http:\/\/www.ti.com\/lit\/ds\/symlink\/ads1115.pdf\" target=\"_blank\" rel=\"noopener noreferrer\">http:\/\/www.ti.com\/lit\/ds\/symlink\/ads1115.pdf<\/a><\/p>\n<p><a href=\"http:\/\/s.click.aliexpress.com\/e\/b7ZMAskg\" target=\"_parent\" rel=\"noopener noreferrer\">I2C ADS1115 16 Bit ADC 4 channel Module with Programmable Gain Amplifier 2.0V to 5.5V RPi<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>The ADS1115 device is a precision, low-power, 16-bit, I2C-compatible, analog-to-digital converters (ADCs) offered in an ultra-small, leadless, X2QFN-10 package, and a VSSOP-10 package. The ADS1115 device incorporates a low-drift voltage reference and an oscillator. The ADS1115 also incorporate a programmable gain amplifier and a digital comparator. These features, along with a wide operating supply range, &hellip; <a href=\"https:\/\/www.strongd.net\/?p=1549\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">ADS1115 analog-to-digital converter and ESP8266<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[236],"tags":[239,237,238],"class_list":["post-1549","post","type-post","status-publish","format-standard","hentry","category-iot","tag-ads1115","tag-esp8266","tag-iot"],"_links":{"self":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1549","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1549"}],"version-history":[{"count":1,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1549\/revisions"}],"predecessor-version":[{"id":1550,"href":"https:\/\/www.strongd.net\/index.php?rest_route=\/wp\/v2\/posts\/1549\/revisions\/1550"}],"wp:attachment":[{"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1549"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1549"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.strongd.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1549"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}