ADS1115 - multiple devices possible?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

ADS1115 - multiple devices possible?

#1 Post by Shardan » 05 Sep 2016, 00:54

Hello all,

is it possible to use two or more ADS1115 with ESPEasy?
At the descripption i don't see an "Address" field. The ADS1115 is able to use p to four different i2c addresses.

If not, would it be possible to add an address choice in a future release?

Background:
I'm using "Power Manager" Boxes, 8 switches in the front, 8 outlets at the rear side in a quite big steel case.
I want to switch them remotely using a PCF 8574 as a relay driver and check the current on the single outlets.

Greetings
Thomas
Regards
Shardan

Ger
Normal user
Posts: 71
Joined: 05 Sep 2015, 18:09

Re: ADS1115 - multiple devices possible?

#2 Post by Ger » 05 Sep 2016, 16:43

The port setting should be the offset to the default address (0x48)

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: ADS1115 - multiple devices possible?

#3 Post by Shardan » 05 Sep 2016, 23:02

I see..

Thanks, i'll do a breadboard test as soon as the ADS arrive
Regards
Shardan

groovy
Normal user
Posts: 39
Joined: 14 Oct 2016, 11:32
Location: Chemnitz, Germany

Re: ADS1115 - multiple devices possible?

#4 Post by groovy » 11 Nov 2016, 14:25

Ger wrote:The port setting should be the offset to the default address (0x48)
How can one reflect this in ESPEasy? The datasheet gives these informations:

Code: Select all

Table 5. ADDR Pin Connection and
Corresponding Slave Address
ADDR PIN SLAVE ADDRESS
Ground 1001000
VDD 1001001
SDA 1001010
SCL 1001011
which leads to the addresses 0x48, 0x49, 0x4a and 0x4b.

In the source it seems, that 0x48 is hardcoded, but I might be wrong, as I'm not a programmer:

Code: Select all

uint8_t address = 0x48 + unit;
What Is "unit" here? It seems to be added to the address? I'm a bit confused :?

Wouldn't it be better to get a dropdown for device selection like for a DS18b20?

User avatar
costo
Normal user
Posts: 500
Joined: 21 Nov 2015, 15:03
Location: NL, zw-NB

Re: ADS1115 - multiple devices possible?

#5 Post by costo » 12 Nov 2016, 12:10

groovy wrote:
Ger wrote:The port setting should be the offset to the default address (0x48)
How can one reflect this in ESPEasy? The datasheet gives these informations:

Code: Select all

Table 5. ADDR Pin Connection and
Corresponding Slave Address
ADDR PIN SLAVE ADDRESS
Ground 1001000
VDD 1001001
SDA 1001010
SCL 1001011
which leads to the addresses 0x48, 0x49, 0x4a and 0x4b.

In the source it seems, that 0x48 is hardcoded, but I might be wrong, as I'm not a programmer:

Code: Select all

uint8_t address = 0x48 + unit;
What Is "unit" here? It seems to be added to the address? I'm a bit confused :?

Wouldn't it be better to get a dropdown for device selection like for a DS18b20?
The DS18b20 is a 1 wire protocol device which doesn't need any hardwired address selection because each DS18b20 has an unique 64 bit ID burned into chip.
So ID selection must solely be done in the software.

ADS1115 is a 2-wire I2C protocol device which can only have a selectable address of 4 possibilities. Each possibility has to be hardwire coded onto the chip/module itself by connecting the ADDR selection pin to VDD,GND,SCL or SDA.
In table 5 you see the 7bit address selection ranging from 1001000/48 up to 1001011/4B

For every I2C device ESPEasy uses the same uniform way for software address selection, which is done by a port number, usually a number smaller than 8.

So it seems, like you suggested, unlogical to use a ADS1115 device selection like for DS18b20

Shardan
Normal user
Posts: 1156
Joined: 03 Sep 2016, 23:27
Location: Bielefeld / Germany

Re: ADS1115 - multiple devices possible?

#6 Post by Shardan » 12 Nov 2016, 16:54

Hello Groovy,

i've tested some ADS1115 meanwhile.

I used two ADS1115-boards, wired to 0x48 und 0x49.

Just in the task setup i can select all 8 analog input via the "Port" field.
Did not read the sourcecode yet, but i guess the "0x48 + unit" just calculates the "unit" by dividing the port number by 4 and taking the integer result as "unit".

So as 0x48 is the lowest address, unit calculates to 1 if you select port 7 for an example.

7 / 4 = 1,75, interger is 1, so port 7 resides on 0x48 +1.
Regards
Shardan

groovy
Normal user
Posts: 39
Joined: 14 Oct 2016, 11:32
Location: Chemnitz, Germany

Re: ADS1115 - multiple devices possible?

#7 Post by groovy » 13 Nov 2016, 11:21

Thank you booth for clarification. So then I will order some :)

Post Reply

Who is online

Users browsing this forum: No registered users and 51 guests