letscontrolit / ESPEasy

Easy MultiSensor device based on ESP8266/ESP32
http://www.espeasy.com
Other
3.28k stars 2.22k forks source link

ADS1115 value are 0.00 #4768

Closed mpl1337 closed 1 year ago

mpl1337 commented 1 year ago

Hello,

im trying to read a pressure transducer on my ADS115 with ESP32. Iv got only 0.00 as Value. Whats wrong with my Setup?. Iv tryed allready a Sample Sketch on Arduino IDE and it works. The hardware is working.

Build: ESP_Easy_mega_20230623_normal_ESP32_4M316k Jun 23 2023 1 2 3 4

TD-er commented 1 year ago

I will take a quick look at their differences, to see how much it will take to support both.

The main differences seem to be 12 bits vs. 16 bit for the ADS111x And the ADS101x does have different sample rates.

mpl1337 commented 1 year ago

sounds good :)

have order 3 new devices. Hope no fakes :/

TD-er commented 1 year ago

I can't seem to find in the datasheet why the ADS101x isn't working with the current code. Could you perhaps (if you live in NL) send me one of those boards via mail? I looked at various ADS1x15 boards offered on AliExpress and the blue ones specifically have either ADS1015 or ADS1115 written on them. So I wonder what might be wrong with your specific board.

I will order a few ADS1015 boards myself, but that may also take a while for those to arrive. But as I said, I'm not sure your board may be an ADS1015. Maybe it is a clone chip?

mpl1337 commented 1 year ago

I should get today my new order.

I'm from Germany. I will send you two chips. I have 5 from this Fakes.

TD-er commented 1 year ago

That would be great. Can you email me, so I can give you my address.

uzi18 commented 1 year ago

Try to add debug into I2C_read16_reg

TD-er commented 1 year ago

Yep, that's the plan, but since it is rather tedious for me to make a test build, others to test and report etc., he agreed to send me one of his modules.

uzi18 commented 1 year ago

If Addressing is issue here, than you need to fight with logic analyser. But first you can test if you read specifiec ADS, by for example write something into known register like lo/hi threshold.

uzi18 commented 1 year ago

@TD-er by lo/hi threshold registers you can Also try to detect 1015 vs 1115 ADS. eg. Write there 0x8001 and 0x7ffe if they are same after read it is 1115. Edit: In fact it is not clear in datasheet, but one can try it.

TD-er commented 1 year ago

One of the things I was thinking of to detect whether it was an ADS1115 or 1015 was to check the least significant bits. If they are always 0, we're dealing with an ADS1015.

The only real difference in config seems to be the data rate. The default data rate for the 1115 is 128 samples per sec (thus a little less than 8 msec to take a sample) However for the 1015 this is 1600 samples per sec. So it should be ready long before this timeout of 10 msec used for the 1115.

The user has replied via email to tell me the newly arrived ADS1115 boards work just fine, so he will send me one of those non working boards. Like I mentioned, I can't explain why it should not work with this code on 1015 boards, so I guess those specific ones could be buggy clones, or maybe a different silicon revision of the 1115. So this does require hands on testing, like with the logic analyser and also putting them under the microscope to see what might be the actual chip being used.

mpl1337 commented 1 year ago

I delivered the package to the post office today. I think you should get it in 3-4 days

mpl1337 commented 1 year ago

Did you get the package?

TD-er commented 1 year ago

Yep got it yesterday. I have just looked at it under the microscope and the chip surface has indeed been sanded off. The one with the pins soldered on was pressed through the enveloppe and all pins were bent flat, so I have turned them 'up' again so it fits in a breadboard, ready to test.

mpl1337 commented 1 year ago

ok, the soldered and the chip in the ESD bag are the same. When the pressed chip is broken, can you take the other one

TD-er commented 1 year ago

Today I got the ADS1015 and the ADS1115 I ordered so I may have some reference material.

I just inserted my freshly bought ADS1015 module, which clearly states on the PCB as such and found that it was working just fine. Given it should only output values shifted 4 bits, it should only show multiples of 16 when looking at the raw values.

See here the really strange looking multiples of 16: image

Then looked at the numbering on the chips and I see "BOGI" which is an ADS1115 based on the datasheet. The ADS1015 should have either one of these: (Last column) image

The ADS1115: image

So I guess I have been duped also. IMG_20230831_203002284_HDR N.B. this is a picture taken with my phone, so the entire board can also be seen.

mpl1337 commented 1 year ago

Have you try my chip?

TD-er commented 1 year ago

I just messaged the seller, got some new beer and was just about to test your modules :)

mpl1337 commented 1 year ago

I needed five beers to accept that I get scammed :-D

TD-er commented 1 year ago

OK, I have spent almost the entire day today looking into this and I think I am quite sure it isn't even an ADS1015. So I'm not even sure whether we're setting the chip to a mode we're expecting. If I ignore the 'ready' bit and just output whatever is read, I seem to get measurements from other pins, indicating the MUX may not be set how I expect it to be set.

I even thought I may have some ADS1018, but later found this is a SPI chip, not I2C.

tonhuisman commented 1 year ago

We have an open PR #4009 that's explicitly intended to be used with an ADS1015. Maybe that can work with this chip? Haven't looked at the code for this though... 😊

TD-er commented 1 year ago

Also the PR for P130, which was specifically written for ADS1015, was not able to perform consistent reads from the module you sent me. I also searched a bit and apparently there are really "fake" versions of this chip. One of the symptoms of those fakes is that reading is slow and stops working for a while after just a few reads. Which is what I also observe.

So I will try to make the plugin reject stuff which is not working and document it as "very likely a fake module, claim your money back".

I'm still waiting for a resolution of the seller on AliExpress who sent me ADS1115 (or at least units which cannot read at higher samplerates) while the silkscreen on the PCBs mentioned ADS1015.