ADS1115 16 bit ADC on ESP8266?

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
User avatar
rcolistete
Posts: 352
Joined: Thu Dec 31, 2015 3:12 pm
Location: Brazil
Contact:

Re: ADS1115 16 bit ADC on ESP8266?

Post by rcolistete » Fri Dec 02, 2016 4:09 pm

weldeng wrote:1. After trying various gains it appears the max value when reading a channel is 32767 not 65535?
ADS1115 has 15 bits in single-ended mode [0-32767]. 16 bits is for differential mode, with signed values [-32768, +32767]. This issue about 15 bits for single-ended mode is a little bit hidden in the data sheet, see page 26 :
http://www.ti.com/lit/ds/symlink/ads1115.pdf
My "MicroPython Samples". My "MicroPython Firmwares" with many options (double precision, ulab, etc).

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: ADS1115 16 bit ADC on ESP8266?

Post by deshipu » Mon Dec 05, 2016 3:57 pm

weldeng wrote:deshipu - Nice driver! I have a few questions:
1. After trying various gains it appears the max value when reading a channel is 32767 not 65535?
That's correct.
weldeng wrote: 2. Does the driver support use of more than one ADS 1115 module? I have a single module on address 0x49. I could add up to three more using addresses 0x48 (1001000), 0x4A (1001010), and 0x4B (1001011).
Yes, when you are creating the object, you can pass the address as a second, optional, parameter.
weldeng wrote: 3. Is it possible to set a separate gain for each channel.
You can set the gain just before making a measurement. The module only has a single ADC anyways, and can only be doing a single measurement at a time.

mohpor82
Posts: 3
Joined: Wed Feb 22, 2017 5:48 am
Location: Tehran
Contact:

Re: ADS1115 16 bit ADC on ESP8266?

Post by mohpor82 » Sat Mar 04, 2017 9:39 am

I have looked around and I haven't found any Micropython driver for ADS1110. Now I've tried to use the ADS1115's as a reference and tried to port it for ADS1110 with no luck (mainly because I don't understand I2C that much).
Do you guys have any idea what's the best approach?

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ADS1115 16 bit ADC on ESP8266?

Post by Roberthh » Sat Mar 04, 2017 8:56 pm

Looking at the data sheet, the communication to the ADS1110 is simpler than that for the ADS1115.

You always write just one byte to the device, which is the command/config byte, and read three bytes back, of which the first two bytes are the samples data, and the third the config register with the status bit in d7. And you can redo the read any time.

I do not have an ads1110 at hand, otherwise I could try to adapt/write the driver.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ADS1115 16 bit ADC on ESP8266?

Post by Roberthh » Sun Mar 05, 2017 2:28 pm

Hello @mophor82. I used the ads1115 script to make the skeleton of an ads1110 script. I do not know if it works, since I do not own an ads1110, but at least it compiles well. Maybe that is of help for you. If you attach the ADC, check first the connection with i2c.scan(). It's address in the range 144...151 (decimal) should be returned. If not, you have a connection problem, most likely missing pull-up resistors. The weak pull-up of the micro may not be sufficient.
ads1110.zip
(1.5 KiB) Downloaded 308 times

User avatar
deshipu
Posts: 1388
Joined: Thu May 28, 2015 5:54 pm

Re: ADS1115 16 bit ADC on ESP8266?

Post by deshipu » Sun Mar 05, 2017 3:45 pm

Roberthh wrote:It's address in the range 144...151 (decimal) should be returned.
ads1110.zip
Um, I2C uses 7 bits for the address, so the absolute maximum value is 127.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ADS1115 16 bit ADC on ESP8266?

Post by Roberthh » Sun Mar 05, 2017 4:00 pm

You're right. The data sheet had the bits grouped strange. The addresses are in the range 72 .. 79

User avatar
dhylands
Posts: 3821
Joined: Mon Jan 06, 2014 6:08 pm
Location: Peachland, BC, Canada
Contact:

Re: ADS1115 16 bit ADC on ESP8266?

Post by dhylands » Sun Mar 05, 2017 6:21 pm

Its quite common for datasheets to specify the address as the whole byte, and not just the 7 address bits, so you need to be careful.

mohpor82
Posts: 3
Joined: Wed Feb 22, 2017 5:48 am
Location: Tehran
Contact:

Re: ADS1115 16 bit ADC on ESP8266?

Post by mohpor82 » Mon Mar 06, 2017 9:06 am

[quote="Roberthh"]Hello @mophor82. I used the ads1115 script to make the skeleton of an ads1110 script. I do not know if it works, since I do not own an ads1110, but at least it compiles well. Maybe that is of help for you. If you attach the ADC, check first the connection with i2c.scan(). It's address in the range 144...151 (decimal) should be returned. If not, you have a connection problem, most likely missing pull-up resistors. The weak pull-up of the micro may not be sufficient.

ads1110.zip[/quote]

Thanks Robert, I couldn't wait longer so I have purchased a few ADS1115s, they are in fact better suit my needs as they have 4 channels and I can use more A2Ds any time.

I will be testing your codes soon though.

User avatar
Roberthh
Posts: 3667
Joined: Sat May 09, 2015 4:13 pm
Location: Rhineland, Europe

Re: ADS1115 16 bit ADC on ESP8266?

Post by Roberthh » Mon Mar 06, 2017 7:56 pm

The ads1115 is better in various aspects. Especially since it keeps the bit size at faster sampling speeds, even with larger noise.

Post Reply