Sensirion / arduino-i2c-scd4x

Arduino library for Sensirion SCD4x sensors
BSD 3-Clause "New" or "Revised" License
48 stars 19 forks source link

Integration issue of SCD41 with ESP32 board from Heltec #5

Closed peterhsi75 closed 2 years ago

peterhsi75 commented 2 years ago

The exampleUsage.ino code supplied by Sensirion works perfectly on the Heltec WiFi Kit 32 (ESP32) board. I can receive correct sensor data via COM port.

However, when I tried to display the sensor reading on the local OLED display by adding a few line of the code in the setup: Heltec.display->init(); Heltec.display->flipScreenVertically();
Heltec.display->setFont(ArialMT_Plain_10); Heltec.display->clear();
Heltec.display->drawString(0, 0, "SCD41 CO2 V100"); Heltec.display->display();

The OLED shows the correct display, but I can no longer receive correct data on my COM port. Instead I got the following error message: Error trying to execute readMeasurement(): Received NACK on transmit of address_

The IIC address of SCD41 is 0x62. The IIC address for SSD1306 OLED is 0x3C. No conflict here.

Any ideas or suggestions on how to resolve this problem?

peterhsi75 commented 2 years ago

The support staff Shaffer at Heltec provided me with a utility code to scan the IIC bus, and provide two functions to communicate with the sensor and OLED. I used wire1.xxxx functions to communicate with sensor and wire.xxxx functions to communicate with OLED display, everything works now. Thank you very much for Heltec's quick help!!