Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple AM2320 --> CRC FAILED #2942

Closed
airvb opened this issue Mar 14, 2020 · 32 comments
Closed

Multiple AM2320 --> CRC FAILED #2942

airvb opened this issue Mar 14, 2020 · 32 comments
Labels
Category: Plugin Related to supported sensors Type: Documentation Type: Not a bug Issues that later appeared not to be a bug (e.g. user error)

Comments

@airvb
Copy link

airvb commented Mar 14, 2020

Hello .
Tested with :
ESP_Easy_mega-20200310_dev_ESP8266_4M1M
ESP_Easy_mega-20200310_test_ESP8266_4M1M_VCC

What is expecting :
Having 2 AM2320 sensors on I2C line.

Each sensor has been tested individually
They are working properly

When I connect the second sensors, log message shows : AM2320: CRC failed
If i disconnect one sensors, values Temperature & Humidity goes with the same values to both device

Trying sensors connected with 10K pull-up resistors on SDA and SCL et +5V : same snag.

I have a LCD connected on I2C and it's working well.

I can help. I'm in the trial phase.
Thanks

@TD-er TD-er added Category: Plugin Related to supported sensors Type: Bug Considered a bug labels Mar 14, 2020
@TD-er TD-er added this to To do in Broken Sensors via automation Mar 14, 2020
@TD-er TD-er moved this from To do to Multiple Instances in Broken Sensors Mar 14, 2020
@TD-er
Copy link
Member

TD-er commented Mar 14, 2020

It is probably the same issue as for some other plugins when running multiple instances of the same plugin.

They probably share temp values which should not be shared.

@tonhuisman
Copy link
Contributor

Is it even possible to have more than 1 of these sensors on an I2C bus? It's address is fixed (0x5C), so it would need a separate I2C bus for each sensor, like done in this Arduino library https://github.com/lazyscheduler/AM2320 (comments in Russian...)
The CRC error makes sense in this context, IMHO...

@TD-er
Copy link
Member

TD-er commented Mar 14, 2020

If you cannot change the I2C address, then it is indeed not possible to use multiple instances as we don't support multiple I2C buses.

@uzi18
Copy link
Contributor

uzi18 commented Mar 14, 2020

But it is possible to use 1wire legacy mode, see datasheet

@TD-er
Copy link
Member

TD-er commented Mar 14, 2020

But it is possible to use 1wire legacy mode, see datasheet

Is that supported in our plugin?

@uzi18
Copy link
Contributor

uzi18 commented Mar 14, 2020

It should work, choose DHT11, we can add description/hint in plugin configuration

@uzi18
Copy link
Contributor

uzi18 commented Mar 14, 2020

connect SCL-GND and SDA to gpio

@airvb
Copy link
Author

airvb commented Mar 14, 2020

If you cannot change the I2C address, then it is indeed not possible to use multiple instances as we don't support multiple I2C buses.

What is the point of having I2C sensors if it is not possible to use them on the data bus?

@airvb
Copy link
Author

airvb commented Mar 14, 2020

connect SCL-GND and SDA to gpio

Will be ok only if you have only few sensors,

@TD-er
Copy link
Member

TD-er commented Mar 14, 2020

If you cannot change the I2C address, then it is indeed not possible to use multiple instances as we don't support multiple I2C buses.

What is the point of having I2C sensors if it is not possible to use them on the data bus?

Well you should ask the manufacturer that question, why it makes sensors that cannot have their address set.
There are lots of I2C sensors out there and it is quite common to have a "collision" in default addresses, so just for that reason alone you should have the option to set another I2C address.
Also if you need to have several on the same bus, you need to have a unique address on that bus or else you will run into issues like you're now experiencing.

@TD-er TD-er added Type: Not a bug Issues that later appeared not to be a bug (e.g. user error) and removed Type: Bug Considered a bug labels Mar 14, 2020
@airvb
Copy link
Author

airvb commented Mar 15, 2020

Is there good I2C temp & humidity sensors compatible with espeasy ?

@tonhuisman
Copy link
Contributor

A couple of BME280's work very good over here, and you can use 2 on the same bus, as the address is configurable (check out the images on Banggood or AliExpress to see if they have the address selection connections available on the board, not all have that!).

Check also that you receive actual BME280's, as the BMP280 has a lot of similarities but no humidity sensor, read this: https://goughlui.com/2018/08/05/note-bosch-sensortec-bmp280-vs-bme280-sensor-confusion/

@uzi18
Copy link
Contributor

uzi18 commented Mar 15, 2020

connect SCL-GND and SDA to gpio

Will be ok only if you have only few sensors,

@airvb but please try it, for other users.

how. many sensors you need to connect?

@TD-er
Copy link
Member

TD-er commented Mar 15, 2020

Is there good I2C temp & humidity sensors compatible with espeasy ?

See supported "environment" sensors

@uzi18
Copy link
Contributor

uzi18 commented Mar 16, 2020

@airvb did you tried to force 1wire mode?

@airvb
Copy link
Author

airvb commented Mar 17, 2020

@airvb did you tried to force 1wire mode?

sorry for the response delay.
Yes i tried the other sensor as legacy one , works well. Recognize as DHT11.

i"ll buy BME280's in my next ali 's command to test it .

Thanks all for yr response.

@TD-er
Copy link
Member

TD-er commented Mar 17, 2020

Just make sure you buy the correct ones.
There are units sold that have a regulator and only work (stable) on 5V.

@uzi18
Copy link
Contributor

uzi18 commented Mar 17, 2020

@TD-er so we can add AM2320 to be supported in 1wire mode (DHT plugin)

@TD-er
Copy link
Member

TD-er commented Mar 17, 2020

What is needed for that? Any change in the plugin code?

@uzi18
Copy link
Contributor

uzi18 commented Mar 17, 2020

nothing, just set it as DHT11, and hardware: connect SCL to GND and SDA to gpio with 10k pullup as usual with DHT sensors

@TD-er
Copy link
Member

TD-er commented Mar 17, 2020

So only documentation?

@airvb
Copy link
Author

airvb commented Mar 18, 2020

If you have to make a modification , it could be a good thing to inform than I2C sensors MUST have different addresses for multiple sensors ( thing that isn't possible on AM2380 and maybe other )
But it's not a ESPEASY failure !

@uzi18
Copy link
Contributor

uzi18 commented Mar 19, 2020

@airvb @TD-er another idea is to use I2C multiplexer module: Adafruit TCA9548A

@TD-er
Copy link
Member

TD-er commented Mar 19, 2020

@uzi18 Yep that's for sure a nice feature to have.
But it does require some added code to switch that multiplexer in the right mode before starting to query that plugin.
Shouldn't be too hard though, as it is known which plugin communicates via I2C.

@ghtester
Copy link

ghtester commented Jun 2, 2020

nothing, just set it as DHT11, and hardware: connect SCL to GND and SDA to gpio with 10k pullup as usual with DHT sensors

It's strange in my case this does not work as expected. All three sensors are at the same place, first one is connected to I2C bus and gives the correct data, remaining two connected as legacy in accordance the instructions above. I wonder if it's due to China's vendor or if there's another issue. There's no other plugin configured and no other device attached, HW is NodeMcu Lua ESP8266 CH340G.
The ESP firmware is recent:
Build:⋄ 20106 - Mega
System Libraries:⋄ ESP82xx Core 9c56ed1f, NONOS SDK 2.2.2-dev(38a443e), LWIP: 2.1.2 PUYA support
Git Build:⋄
Plugin Count:⋄ 84 [Normal] [Testing] [Development]
Build Origin: Travis
Build Time:⋄ May 16 2020 00:49:40
Binary Filename:⋄ ESP_Easy_mega_20200516_dev_ESP8266_4M1M
Build Platform:⋄ Linux-4.15.0-91-generic-x86_64-with-glibc2.27
Git HEAD:⋄ mega

AM2320LegacyError

@airvb
Copy link
Author

airvb commented Jun 3, 2020

Hello ,
I didn't try with two legacy sensors, but personally it works with one aslegacy mode, the other one in I2C , however I didn't put any pullup resistance.
Maybe you can try with only first

@uzi18
Copy link
Contributor

uzi18 commented Jun 3, 2020

check if they work correctly in i2c mode
pullup resistor is required

@ghtester
Copy link

ghtester commented Jun 3, 2020

@airvb Thanks for the hint, I have already tested but it's all the same, doesn't matter if there's one or two sensors in legacy wiring.
@uzi18 i2c mode works fine on the same sensor which returns nonsense values in legacy mode. Tried to decrease pullup resistor up to 5k but it's still the same. VCC=3,3V.

@airvb
Copy link
Author

airvb commented Jun 4, 2020

image

Just in case : Legacy mode you have to short scl and gnd .
You can try also with 5v VCC
image

@ghtester
Copy link

ghtester commented Jun 4, 2020

Yeah but there's also recommendation in datasheet to use VCC 3,3V in 1wire mode if the cable length is shorter than 1m (this is my case ) otherwise there may be troubles with communication.
It looks the DHT11 plugin does not check the parity as the AM2320 always send a (nonsense) data, it never reported a bad value.
Which firmware release are you using please? I could perhaps try the same or similar.

@airvb
Copy link
Author

airvb commented Jun 4, 2020

image

@tonhuisman
Copy link
Contributor

This seems to have been fixed some time ago. Can be closed.

@TD-er TD-er closed this as completed Sep 2, 2023
Broken Sensors automation moved this from Multiple Instances to Done Sep 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Plugin Related to supported sensors Type: Documentation Type: Not a bug Issues that later appeared not to be a bug (e.g. user error)
Projects
Development

No branches or pull requests

5 participants