I’m creating a weather station with an esp32 (not one made by Seeed) to view its data on my website.
I would like to add a rain gauge with the Grove water level sensor. Connecting it via the I²C pins of the esp32 and it doesn’t work pretty well : sometimes the sensor wont be detected by the esp32, and sometimes (when it’s detected by the esp32), it send incorrect data.
I use the code on the Seeed wiki.
I tried to add pull-up resistors on the SCL and SDA pins but without success.
I, also, changed with a second sensor (same reference), and it didn’t changed the outcome. This is eliminating the sensor cause.
For information, I have a pressure sensor (BMP280) plugged on the same ESP32 with I²C bus and it works perfectly. So, I think I²C is working well also.
I got it. The current judgment should be the incompatibility caused by the library. The architecture of arduino UNO is different from that of ESP32, and the libraries of sensors used are also different. So if you need to use Grove module on ESP32, you may need to check and use it. Whether the library meets the requirements, otherwise you need to judge and modify the content of the library yourself. For the secondary development of ESP32 products, we cannot provide technical support for the time being.
Ok… But I don’t know how work the Wire.h library and there’s no library for the grove sensor. And the Wire.h library works perfectly with the BMP280. So what can I do ?
Maybe this is a complicated and huge job. You need to understand the code of the Wire.c/Wire.h file, it is best to be able to read it, and then compare and modify this file for the use of ESP32.