ESP32-C3 i2c sensors weird behavior

xfarre
Posts: 1
Joined: Sun Jun 23, 2024 4:37 pm

ESP32-C3 i2c sensors weird behavior

Postby xfarre » Sun Jun 23, 2024 4:51 pm

Hello community!

I am working with a LOLIN ESP32-C3 pico connected to AHT20+BMP280 sensor via i2c interface.
Wiring is based on wemos website specifications, so:
VIN - 3V
GND - GND
SDA - GPIO08
SCL - GPIO10

I googled a lot, and I found default SCL pin for ESP-C3 is GPIO09 but this pin is solderd to button on this device, so it's unuseful.

My surprise is if I run i2c scanner it doesn't find anything but adding Wire(8,10), It find both sensors:

Code: Select all

18:46:10.717 -> Scanning...
18:46:10.717 -> I2C device found at address 0x38  !
18:46:10.717 -> I2C device found at address 0x77  !
18:46:10.717 -> done
So, I understand sensors are detected and ready... but I am unable to use them. I tried all libraries from these sensors in Arduino Ide but always get "I cannot find AHT20 / BMP280"...
My tests:
- Added / modified in code: Wire() --> Wire(8,10);
- Changed pins to 4,5
- Even adding scan i2c code at beggining of loop, scan found both sensors but libraries not.

My very very weird feeling is because I was running this code some time ago and it worked fine for several mounths. I don't remember why I tried upgrading code adding somethin and then, no sensors found anymore...
Just one last thing, I updated my IDE between working code and not, so I think some esp32 libraries update broke my program...

Anybody have same issues?

Thanks in advance.
Xavi.-
Last edited by xfarre on Mon Jun 24, 2024 2:35 pm, edited 1 time in total.

ESP_Sprite
Posts: 9577
Joined: Thu Nov 26, 2015 4:08 am

Re: ESP32-C3 i2c sensors weird behavior

Postby ESP_Sprite » Mon Jun 24, 2024 1:49 am

Probably a library issue. As you have found, the C3 doesn't have dedicated I2C pins; you can use any of them for I2C. However, libraries might make assumptions there.

Who is online

Users browsing this forum: No registered users and 126 guests