Wemos and ADS1015 example

The ADS1015 is a precision analog-to-digital converters (ADCs) with 12 bits of resolution offered in an ultra-small, leadless QFN-10 package or an MSOP-10 package. The ADS1015 are designed with precision, power, and ease of implementation in mind. The ADS1015 features an onboard reference and oscillator. Data are transferred via an I2C-compatible serial interface; four I2C slave addresses can be selected. The ADS1015 operate from a single power supply ranging from 2.0V to 5.5V.

The ADS1015-Q1 device can perform conversions at rates up to 3300 samples per second (SPS). An onboard PGA is available that offers input ranges from the supply to as low as ±256 mV, allowing both large and small signals to be measured with high resolution. The ADS1015-Q1 device also features an input multiplexer (MUX) that provides two differential or four single-ended inputs.

The ADS1015-Q1 device operates either in continuous conversion mode or a single-shot mode that automatically powers down after a conversion and greatly reduces current consumption during idle periods

ads1015

 

Schematics

 

wemos-ads1015_bb

Code

In this example you need the Adafruit ADS1015 library from https://github.com/adafruit/Adafruit_ADS1X15

 

 

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <Adafruit_ADS1015.h>

Adafruit_ADS1015 ads;     /* Use thi for the 12-bit version */

void setup(void) 
{
  Serial.begin(9600);
  Serial.println("Getting single-ended readings from AIN0..3");
  ads.begin();
}

void loop(void) 
{
  int16_t adc0, adc1, adc2, adc3;

  adc0 = ads.readADC_SingleEnded(0);
  adc1 = ads.readADC_SingleEnded(1);
  adc2 = ads.readADC_SingleEnded(2);
  adc3 = ads.readADC_SingleEnded(3);
  Serial.print("AIN0: "); 
  Serial.println(adc0);
  Serial.print("AIN1: "); 
  Serial.println(adc1);
  Serial.print("AIN2: "); 
  Serial.println(adc2);
  Serial.print("AIN3: "); 
  Serial.println(adc3);
  Serial.println(" ");
  
  delay(1000);
}

[/codesyntax]

 

Links

1pcs ADS1015 ADC ultra-compact 12-precision ADC module development board

2 COMMENTS