Home CodeEspruino Espruino and ADS1015 12 bit adc

Espruino and ADS1015 12 bit adc

by shedboy71

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

This example shows how to connect the module to an Espruino, we also added a potentiometer which can be used to test.

espruino-and-ads1015_bb

Code

This is the basic example from the Espruino web site, modified to keep looping and display the value

If you wanted to use ADC channel 1 to 3 you need to change the following

ads.getADC(0, function(val)

[codesyntax lang=”javascript”]

require("ADS1X15");

I2C1.setup({scl:B6,sda:B7});
var ads = require("ADS1X15").connect(I2C1);

ads.setGain(256); // +/- 0.256mV

setInterval(function() {
ads.getADC(0, function(val) {
  console.log("Read ADC value: "+val);
});
}, 1000);

[/codesyntax]

 

 

Links

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

Share

You may also like