arrow left BLOG

NAVIO: Measuring voltage with ADS1115 [C++, Python]

ads1115

This document is not updated, please proceed to docs.blog.emlid.com for latest version!

The ADS1115 is a precision analog-to-digital converter (ADC) with 16 bits of resolution. The ADS1115 features an onboard reference and oscillator. Data is transferred via an I2C serial interface. The ADS1115 can perform conversions at rates up to 860 samples per second (SPS). Both large and small signals to be measured with high resolution ranging from 156mV to 3.3V. The ADS1115 also features an input multiplexer (MUX) that provides two differential or four single-ended inputs. The ADS1115 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.

[C++]

Move to the folder with the source code, compile and run the example:

cd Navio/C++/Examples/ADC
make
sudo ./ADC

In this example ADC continuously measures the voltage on P1 available on the DF13 connector marked “ADC”. Result in mV is printed to console. You can measure other channels in the same manner.

[Python]

Move to the folder with the source code and run the example:

cd Navio/Python/ADC
sudo python ads1x15_ex_singleended.py

The program performs measurement of all 4 ADC channels and outputs measured values in millivolts in four columns. When channels inputs are not connected to anything there would probably be a little bit of potential.

A0: 0.5731mV A1: 0.5709mV A2: 0.5717mV A3: 0.5715mV
A0: 0.5716mV A1: 0.5715mV A2: 0.5717mV A3: 0.5726mV
A0: 0.5717mV A1: 0.5709mV A2: 0.5724mV A3: 0.5713mV
A0: 0.5711mV A1: 0.5717mV A2: 0.5721mV A3: 0.5715mV
A0: 0.5707mV A1: 0.5715mV A2: 0.5715mV A3: 0.5715mV
A0: 0.5724mV A1: 0.5731mV A2: 0.5719mV A3: 0.5713mV
ADS1115

For more detailed information please refer to the ADS1115 datasheet.

Emlid Tech Korlátolt Felelősségű Társaság