Closed RichJ123 closed 11 months ago
Quite busy, will follow up asap
Had to look into the softwire library and found this issue
https://github.com/stevemarple/SoftWire/issues/29
The third post mentions the Softwire library works on ESP32, so my assumption is it should work with the SHT31 too on the ESP32. Be aware that the Softwire probably cannot make very high clock speeds, so you might begin with 50K or so.
The discussion also mention more interesting details for the ESP32 like
If the drive capability of the ESP32 is weak you might find a I2C driver specifically designed for I2C helpful. I used a PCA9517A which is sold as a level-translating I2C bus repeater.
I adjusted the clock speed to 50000 and 30000 via sw.setClock(30000); but nothing changed, still getting -45 and 0. I guess the softwire library itself may not be esp32-compatible. Anyway this is just for your info and thanks to you for the Twowire sht31 I am using. Cheers.
Thanks for the follow up.
Did you have pull up resistors in place?
Can you try it one more time and use the esp32 wire pins for the test. 21 and 22 from my head.
I leave the issue open for a few more days. If time permits and I have hardware available I will investigate.
Did a first test, which failed
15364 -45.0 0.0 130
15362 -45.0 0.0 130 // 82 hex
367 -45.0 0.0 129 // 81 hex
15362 -45.0 0.0 130
15361 -45.0 0.0 130
363 -45.0 0.0 129
15361 -45.0 0.0 130
15364 -45.0 0.0 130
the last number is getError() =>
Error | Symbolic | Description |
---|---|---|
0x00 | SHT31_OK | no error |
0x81 | SHT31_ERR_WRITECMD | I2C write failed |
0x82 | SHT31_ERR_READBYTES | I2C read failed |
0x83 | SHT31_ERR_HEATER_OFF | Could not switch off heater |
0x84 | SHT31_ERR_NOT_CONNECT | Could not connect |
0x85 | SHT31_ERR_CRC_TEMP | CRC error in temperature |
0x86 | SHT31_ERR_CRC_HUM | CRC error in humidity |
0x87 | SHT31_ERR_CRC_STATUS | CRC error in status field |
0x88 | SHT31_ERR_HEATER_COOLDOWN | Heater need to cool down |
0x88 | SHT31_ERR_HEATER_ON | Could not switch on heater |
So the low level I2C seems to fail. So I'm on par wit you now :)
Have tried different pins and settings and did not get it working, So far I can only get SHT31_SWW on AVR (UNO) working.
If time permits I will do some more tests this weekend.
The Softwire library has an example listDevices but it did not work.
As this is a problem of the Softwire library used I will close the issue. Feel free to add comments as I am always interested however I will not spend time to this issue at the moment. (other priorities)
sorry I didn't login to github for long time. I have worked around the problem by using twowire with no problem. Thanks for your effort and MerryXmas and happy new year.
On Sat, Dec 16, 2023 at 7:24 PM Rob Tillaart @.***> wrote:
Closed #11 https://github.com/RobTillaart/SHT31_SW/issues/11 as completed.
— Reply to this email directly, view it on GitHub https://github.com/RobTillaart/SHT31_SW/issues/11#event-11265672262, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUNK4FQ3EUFQDVLG6BGAKXLYJWHGJAVCNFSM6AAAAABARY73F6VHI2DSMVQWIX3LMV45UABCJFZXG5LFIV3GK3TUJZXXI2LGNFRWC5DJN5XDWMJRGI3DKNRXGIZDMMQ . You are receiving this because you authored the thread.Message ID: @.***>
@RichJ123 Best wishes to you too!
Does this lib work with esp32? I passed the compile and upload but temperature and humidity showed -45 and 0. Pin 26 27 were used instead of 6,7 as shown in your code. Thanks for any help. Richj