Possible issue with ADS1115 plugin?

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
User avatar
enesbcs
Normal user
Posts: 559
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Possible issue with ADS1115 plugin?

#1 Post by enesbcs » 04 Dec 2017, 21:17

I'am using an ADS1015 DAC with the ESPEasy P025_ADS1115 plugin.
It looks fine when starting, but when i added Task1 to a Moisture sensor (AIN0-GND) and Task2 a Water level sensor (AIN1-GND) after some time, their values are going to be the same... after double checked the wiring, removed the moisture sensor from soil/changing the water level, the results are the same, they differ at startup, but after some time, they value seems equal. Looks like the plugin mixing the results, if the timing coincide?
In the plugin code:

Code: Select all

Wire.endTransmission();
String log = F("ADS1115 : Analog value: ");
delay(8);
int16_t value = readRegister025((address), (0x00));
Maybe when delay(8) is in progress, the other ADS1115 plugin task grabs the same value from I2C bus? Currently i am trying with a global variable/semaphore to indicate if the other task is in read state.
Nobody experienced anything like that?

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

Re: Possible issue with ADS1115 plugin?

#2 Post by Shardan » 04 Dec 2017, 22:05

Which ESPEasy version are you using?
I've a ADS1115 running for some days now without any problem on a selfcompiled 2.0.0-12.

There was a bug in the R120 version and within the 147 version that was fixed later.

I'm not sure if the ADS1015 is fully compatible with the 1115 as it is a 12bit chip and the ADS1115 is a 16bit chip

Regards
Shardan
Regards
Shardan

papperone
Normal user
Posts: 497
Joined: 04 Oct 2016, 23:16

Re: Possible issue with ADS1115 plugin?

#3 Post by papperone » 04 Dec 2017, 22:23

I can confimr ADS1115 works flawlessly with ESPEasy, I've two of them running on R148 and 2.0-dev10
My TINDIE Store where you can find all ESP8266 boards I manufacture --> https://www.tindie.com/stores/GiovanniCas/
My Wiki Project page with self-made PCB/devices --> https://www.letscontrolit.com/wiki/inde ... :Papperone

TD-er
Core team member
Posts: 4246
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Possible issue with ADS1115 plugin?

#4 Post by TD-er » 04 Dec 2017, 23:14

The start post mentions the ESP is configured to use 2 of these DAC's.
Since there were more plugins having trouble when used with >1 device at the same ESP module, it is possible this plugin has similar issues.
Worth having a look at.

User avatar
enesbcs
Normal user
Posts: 559
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Possible issue with ADS1115 plugin?

#5 Post by enesbcs » 04 Dec 2017, 23:20

ESPEasy dev11 with Core 2_4_0_RC2.

As i see the differences between ADS1015 and ADS1115 is not so much: (except 12-16bit range)
https://github.com/soligen2010/Adafruit ... DS1015.cpp

I found a thread about this problem:
https://github.com/adafruit/Adafruit_ADS1X15/issues/14

Maybe the ADS1015 is slower? :)
Anyway, i modified the ADS1115 plugin with a semaphore variable, and now i got stable readings from both analog channels.
This:

Code: Select all

        Wire.beginTransmission(address);
        Wire.write((uint8_t)(0x01));
        Wire.write((uint8_t)(config >> 8));
        Wire.write((uint8_t)(config & 0xFF));
        Wire.endTransmission();

        String log = F("ADS1115 : Analog value: ");

        delay(8);
        int16_t value = readRegister025((address), (0x00));
        UserVar[event->BaseVarIndex] = (float)value;
        log += value;
To This:

Code: Select all

        byte count = 0;
        boolean plugin165_success = false;
        int16_t value = 0;
        String log = F("ADS1115 : Analog value: ");
        while ((count < 10) && (plugin165_success == false)) { 
          if (Plugin_025_reading == false) {
            Plugin_025_reading = true;
            Wire.beginTransmission(address);
            Wire.write((uint8_t)(0x01));
            Wire.write((uint8_t)(config >> 8));
            Wire.write((uint8_t)(config & 0xFF));
            Wire.endTransmission();
            delay(8);
            value = readRegister025((address), (0x00));
            Plugin_025_reading = false;
            plugin165_success = true;
          } else {
            delay(8);
          }
          count++;
        }

        UserVar[event->BaseVarIndex] = (float)value;
        log += value;  

User avatar
enesbcs
Normal user
Posts: 559
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Possible issue with ADS1115 plugin?

#6 Post by enesbcs » 04 Dec 2017, 23:21

TD-er wrote: 04 Dec 2017, 23:14 The start post mentions the ESP is configured to use 2 of these DAC's.
Nope, i am using only one ADS1015 at address 0x48. AIN0 is Task1 and AIN1 is Task2.

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

Re: Possible issue with ADS1115 plugin?

#7 Post by Shardan » 05 Dec 2017, 12:49

TD-er wrote: 04 Dec 2017, 23:14 The start post mentions the ESP is configured to use 2 of these DAC's.
Since there were more plugins having trouble when used with >1 device at the same ESP module, it is possible this plugin has similar issues.
Worth having a look at.
I can confirm that this works flawlessly.
On my power management i use 8 current transformers and two ADS1115 so i have 8 ADS1115 tasks.
Regards
Shardan

User avatar
enesbcs
Normal user
Posts: 559
Joined: 18 Jun 2017, 11:02
Location: Békéscsaba, Hungary
Contact:

Re: Possible issue with ADS1115 plugin?

#8 Post by enesbcs » 05 Dec 2017, 23:40

Shardan wrote: 04 Dec 2017, 22:05 I'm not sure if the ADS1015 is fully compatible with the 1115 as it is a 12bit chip and the ADS1115 is a 16bit chip
I'm afraid you are right. The ADS1115 plugin is not so good for the ADS1015 module. :( I've run it for all day, and saw some strange spikes, possibly overflowing... now i checked out soligen2010/Adafruit_ADS1X15 library and running tests.
I'am the only one who is trying to use cheap purple ADS1015 modules from ebay? :)

TheTrumpeter
Normal user
Posts: 11
Joined: 02 Dec 2020, 15:30

Re: Possible issue with ADS1115 plugin?

#9 Post by TheTrumpeter » 03 Dec 2020, 08:14

enesbcs wrote: 05 Dec 2017, 23:40
Shardan wrote: 04 Dec 2017, 22:05 I'm not sure if the ADS1015 is fully compatible with the 1115 as it is a 12bit chip and the ADS1115 is a 16bit chip
I'm afraid you are right. The ADS1115 plugin is not so good for the ADS1015 module. :( I've run it for all day, and saw some strange spikes, possibly overflowing... now i checked out soligen2010/Adafruit_ADS1X15 library and running tests.
I'am the only one who is trying to use cheap purple ADS1015 modules from ebay? :)
I'm very sorry for digging out that old thread.
As I have seen that you modded the module to work with an ADS1015 you might have an answer to my problem.

I've bought a ADS1115-module from Chinese shop, unfortunately it turned out to be a ADS1015 only. Nevertheless I was expecting that it would work with ADS1115-plugin and I only have to divide the values by 8 as discussed also here: https://github.com/letscontrolit/ESPEasy/issues/1677
This works for A0, the result is as expected, but A1-A3 are always "-32768" (without dividing).

Is this an expected behavior due to usage of ADS1115-plugin our do I have a problem somewhere else?
(I have ordered another module with "real ADS1115", but in the meantime I would like to use the existing ADS1015.)

TD-er
Core team member
Posts: 4246
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Possible issue with ADS1115 plugin?

#10 Post by TD-er » 03 Dec 2020, 10:58

I looked through both datasheets and there is barely any difference between them.
As enesbcs mentioned, maybe the ADS1015 is slower?

The main difference appears to be the sample rate.
The default value of `100` for the DR register is 128 samples/sec for the ADS1115 and 1600 SPS on the ADS1015.
This would mean the read time is lower on the ADS1015.

Here was a discussion on adding a slight delay between initiating the sampling and reading the result:
https://github.com/letscontrolit/ESPEasy/issues/3159

I've now re-read both datasheets several times and I don't have a clue what may cause this issue.

TheTrumpeter
Normal user
Posts: 11
Joined: 02 Dec 2020, 15:30

Re: Possible issue with ADS1115 plugin?

#11 Post by TheTrumpeter » 03 Dec 2020, 11:21

TD-er wrote: 03 Dec 2020, 10:58 I looked through both datasheets and there is barely any difference between them.
As enesbcs mentioned, maybe the ADS1015 is slower?
I'm not sure if I got your point, but switching to 100kHz does not solve the problem.
TD-er wrote: 03 Dec 2020, 10:58 Here was a discussion on adding a slight delay between initiating the sampling and reading the result:
https://github.com/letscontrolit/ESPEasy/issues/3159
I use an official build which is not older than maybe 1 month. Then this fix should already be included there, correct?



Sorry, forget all that I said.
Now it's working, I was mixing up the address of the ADS1015 for A2, now it works as expected.

TD-er
Core team member
Posts: 4246
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Possible issue with ADS1115 plugin?

#12 Post by TD-er » 03 Dec 2020, 11:27

Yep that added delay has been merged months ago.

And I was not talking about the I2C clock frequency, but more about the needed delay between starting a sample and reading the measured value.

At 128 samples/second, you need to wait at least 1/128th of a second (= roughly 8 msec) and some time to wake the sensor => 9 msec
However the ADS1015 is sampling at a much higher rate, so it should be ready way before the 9 msec we wait.
So that's why I don't expect the ADC1015 to be slower as was implied in an earlier reply.

Ergo: I have no idea why it is not working as we would expect.

TheTrumpeter
Normal user
Posts: 11
Joined: 02 Dec 2020, 15:30

Re: Possible issue with ADS1115 plugin?

#13 Post by TheTrumpeter » 03 Dec 2020, 11:41

TD-er wrote: 03 Dec 2020, 11:27 Ergo: I have no idea why it is not working as we would expect.
You're too fast...

I've already found the root cause and updated my posting.

TD-er
Core team member
Posts: 4246
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Possible issue with ADS1115 plugin?

#14 Post by TD-er » 03 Dec 2020, 11:50

Great :)

TheTrumpeter
Normal user
Posts: 11
Joined: 02 Dec 2020, 15:30

Re: Possible issue with ADS1115 plugin?

#15 Post by TheTrumpeter » 13 Jan 2021, 09:46

Unfortunately I've still an issue with the module.

I now bought another one and connected it. A2C-scan says "PCF8591 ADS1115 LM75A" on address 0x48, but still I have to divide the raw-value by 8 to get the expected result.

First I thought I got another ADS1015 although it was sold as ADS1115, so I had a detailed look on the chip. It's labelled as "BOGI" which should be a ADS1115 as per datasheet https://www.ti.com/lit/ds/symlink/ads11 ... 0526984558.
ADS1015 would be "BRPI".

It is connected to a ESP32, the other devices on I2C expect as expected (eg. PCF8574).

Any idea?

EDIT: I had a deeper look into the datasheet, but could not find any configuration register to switch to 16bit?

TD-er
Core team member
Posts: 4246
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Possible issue with ADS1115 plugin?

#16 Post by TD-er » 13 Jan 2021, 10:57

Can you add an issue for it on Github?
Issues here are always hard to find back.

TheTrumpeter
Normal user
Posts: 11
Joined: 02 Dec 2020, 15:30

Re: Possible issue with ADS1115 plugin?

#17 Post by TheTrumpeter » 13 Jan 2021, 11:11

I will do so, but it would be surprisingly if that would really be a bug? The module would be in use by lots of other people I would expect?

EDIT: Eventually I found the reason, there is no bug. I just did not consider the gain-values. As I use -4.096/+4.096V it's 125µV per bit. Multiplication by 125 is giving the same result as dividing by 8, just the unit is different than.

TD-er
Core team member
Posts: 4246
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Possible issue with ADS1115 plugin?

#18 Post by TD-er » 13 Jan 2021, 12:47

Check :)

Post Reply

Who is online

Users browsing this forum: No registered users and 23 guests