Universal driver for I2C temperature/humidity sensors (AHT2x/CHT83xx/SHT3x/SHT4x)#2049
Open
MaxineMuster wants to merge 17 commits intoopenshwprojects:mainfrom
Open
Universal driver for I2C temperature/humidity sensors (AHT2x/CHT83xx/SHT3x/SHT4x)#2049MaxineMuster wants to merge 17 commits intoopenshwprojects:mainfrom
MaxineMuster wants to merge 17 commits intoopenshwprojects:mainfrom
Conversation
Change obk_config.h to disable the drivers xHTxx is replacing
if any of the contained drivers (AHT2x, CHT83XX or SHT3X) was defined, use xhtxx instead
smaller output if Tokenizer index is out of range
SHT3x: try up to 3 times to set alarm registers if setting fails (NAK)
Use "SHT_xy" command names as in drv_sht3x.c for SHT3x only commands Change GetSensors to accept a sensor family so it can return first sensor of this family if sensor index is ommited
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
To simplify temperature sensor usage, here's a combined AHT2x/CHT83xx/SHT3x/SHT4x driver.
Just provide with SDA and SCL pin and driver will try the default addresses and readings to auto-detect the sensors.
Here's my test board with BK7238 board with AHT10 - SHT31 - SHT40 - CHT3805 sensor
We have
AHT10 SDA=23 SCL=28
SHT31 SDA=24 SCL=16
SHT40 SDA=14 SCL=26
CHT3805 SDA=20 SCL=21
So I "simply" start
backlog startdriver XHTXX -SCL 26 -SDA 14; XHTXX_AddSensor -SCL 28 -SDA 23; XHTXX_AddSensor -SCL 16 -SDA 24; XHTXX_AddSensor -SCL 21 -SDA 20Log:
GUI:

Again (my observation) while temperatures are realistic, humidity values are more or less guesswork it seems ...
Size is about 5k - for sensor variants, size will reduce, if only xHTxx is selected, but the "replaced" drivers AHT2x/SHT3x/CHT38xx deselected:
Size +/- Filename 1.18.279 xHTxx_55bdcae3020e
-1452 OpenW800_XX.fls 708320 706868
-1392 OpenBK7231T_XX_sensors.bin 785521 784129
-1392 OpenBK7238_XX_battery.bin 733781 732389
-1368 OpenBK7231N_XX_battery.bin 731421 730053
-1120 OpenBK7231N_XX_sensors.bin 817889 816769
-352 OpenBK7231N_UG_XX_irRemoteESP.bin 580944 580592
-224 OpenBK7231N_UG_XX_battery.bin 472032 471808
-192 OpenBK7231T_UG_XX_irRemoteESP.bin 562352 562160
-128 OpenBK7231N_UG_XX_powerMetering.bin 519392 519264
-96 OpenBK7231T_UG_XX_powerMetering.bin 497712 497616
-64 OpenBK7231N_UG_XX_tuyaMCU.bin 518528 518464
-32 OpenBK7231T_UG_XX_sensors.bin 489280 489248
-16 OpenBK7231N_UG_XX_hlw8112.bin 459744 459728
0 OpenBK7231M_ALT_QIO_XX.bin 1253376 1253376
0 OpenBK7231M_ALT_QIO_XX_btproxy.bin 1253376 1253376
0 OpenBK7231M_QIO_XX.bin 1220464 1220464
...
256 OpenRTL87X0C_XX.bin 868868 869124
256 OpenRTL87X0C_XX_btproxy.bin 958404 958660
269 obkSimulator_XX.zip 2515785 2516054
2048 OpenBK7231N_UG_XX_berry.bin 585968 588016
2112 OpenBK7231T_UG_XX.bin 495632 497744
2192 OpenBK7231T_UG_XX_berry.bin 560576 562768
2400 OpenBK7231N_UG_XX.bin 520448 522848
2496 OpenRTL8720E_XX.bin 1303936 1306432
2512 OpenRTL8710A_XX.bin 690376 692888
2576 OpenRTL8710B_XX.bin 680260 682836
2608 OpenBK7231T_XX.bin 792753 795361
2616 OpenBK7231T_XX_berry.bin 895113 897729
2672 OpenESP32C2_XX_4M.factory.bin 1071408 1074080
2672 OpenESP32C2_XX_4M.img 1005872 1008544
2688 OpenESP32C2_XX_2M.factory.bin 934400 937088
2688 OpenESP32C2_XX_2M.img 868864 871552
2688 OpenESP32C3_XX_2M.factory.bin 1039024 1041712
2688 OpenESP32C3_XX_2M.img 973488 976176
2688 OpenESP32C3_XX_4M.factory.bin 1189392 1192080
2688 OpenESP32C3_XX_4M.img 1123856 1126544
2688 OpenESP32C5_XX_4M.factory.bin 1273520 1276208
2688 OpenESP32C5_XX_4M.img 1207984 1210672
2704 OpenESP32C61_XX_4M.factory.bin 1239456 1242160
2704 OpenESP32C61_XX_4M.img 1173920 1176624
2704 OpenESP32C6_XX_4M.factory.bin 1286128 1288832
2704 OpenESP32C6_XX_4M.img 1220592 1223296
2704 OpenESP32S2_XX_4M.factory.bin 1065536 1068240
2704 OpenESP32S2_XX_4M.img 1000000 1002704
2720 OpenESP32S3_XX_4M.factory.bin 1102544 1105264
2720 OpenESP32S3_XX_4M.img 1037008 1039728
2804 OpenBK7252N_XX.bin 750541 753345
2816 OpenESP32_XX_4M.factory.bin 1102816 1105632
2816 OpenESP32_XX_4M.img 1037280 1040096
2824 OpenBK7252_XX.bin 756545 759369
2832 OpenBK7231N_ALT_XX.bin 772033 774865
2856 OpenBK7231N_ALT_XX_btproxy.bin 926057 928913
2856 OpenBK7238_XX.bin 772289 775145
2860 OpenBK7238_XX_berry.bin 872917 875777
2864 OpenBK7231T_ALT_XX.bin 769573 772437
2876 OpenBK7231U_XX.bin 777949 780825
2880 OpenBK7231N_XX.bin 826601 829481
2880 OpenBK7238_XX_btproxy.bin 975105 977985
2912 OpenBK7231N_XX_berry.bin 928937 931849
4384 OpenRTL8721DA_XX.bin 1400992 1405376
4924 OpenECR6600_XX.bin 996785 1001709
5008 OpenBL602_XX_berry.bin 906428 911436
5040 OpenBL602_XX.bin 781092 786132
5068 OpenRDA5981_XX.bin 511516 516584
5120 OpenXR806_XX.img 883552 888672
5136 OpenTR6260_XX.bin 671716 676852
5152 OpenRTL8710B_UG_XX.img 1270464 1275616
256 OpenRTL87X0C_XX.bin 868868 869124
256 OpenRTL87X0C_XX_btproxy.bin 958404 958660
269 obkSimulator_XX.zip 2515785 2516054
2048 OpenBK7231N_UG_XX_berry.bin 585968 588016
2112 OpenBK7231T_UG_XX.bin 495632 497744
2192 OpenBK7231T_UG_XX_berry.bin 560576 562768
2400 OpenBK7231N_UG_XX.bin 520448 522848
2496 OpenRTL8720E_XX.bin 1303936 1306432
2512 OpenRTL8710A_XX.bin 690376 692888
2576 OpenRTL8710B_XX.bin 680260 682836
2608 OpenBK7231T_XX.bin 792753 795361
2616 OpenBK7231T_XX_berry.bin 895113 897729
2672 OpenESP32C2_XX_4M.factory.bin 1071408 1074080
2672 OpenESP32C2_XX_4M.img 1005872 1008544
2688 OpenESP32C2_XX_2M.factory.bin 934400 937088
2688 OpenESP32C2_XX_2M.img 868864 871552
2688 OpenESP32C3_XX_2M.factory.bin 1039024 1041712
2688 OpenESP32C3_XX_2M.img 973488 976176
2688 OpenESP32C3_XX_4M.factory.bin 1189392 1192080
2688 OpenESP32C3_XX_4M.img 1123856 1126544
2688 OpenESP32C5_XX_4M.factory.bin 1273520 1276208
2688 OpenESP32C5_XX_4M.img 1207984 1210672
2704 OpenESP32C61_XX_4M.factory.bin 1239456 1242160
2704 OpenESP32C61_XX_4M.img 1173920 1176624
2704 OpenESP32C6_XX_4M.factory.bin 1286128 1288832
2704 OpenESP32C6_XX_4M.img 1220592 1223296
2704 OpenESP32S2_XX_4M.factory.bin 1065536 1068240
2704 OpenESP32S2_XX_4M.img 1000000 1002704
2720 OpenESP32S3_XX_4M.factory.bin 1102544 1105264
2720 OpenESP32S3_XX_4M.img 1037008 1039728
2804 OpenBK7252N_XX.bin 750541 753345
2816 OpenESP32_XX_4M.factory.bin 1102816 1105632
2816 OpenESP32_XX_4M.img 1037280 1040096
2824 OpenBK7252_XX.bin 756545 759369
2832 OpenBK7231N_ALT_XX.bin 772033 774865
2856 OpenBK7231N_ALT_XX_btproxy.bin 926057 928913
2856 OpenBK7238_XX.bin 772289 775145
2860 OpenBK7238_XX_berry.bin 872917 875777
2864 OpenBK7231T_ALT_XX.bin 769573 772437
2876 OpenBK7231U_XX.bin 777949 780825
2880 OpenBK7231N_XX.bin 826601 829481
2880 OpenBK7238_XX_btproxy.bin 975105 977985
2912 OpenBK7231N_XX_berry.bin 928937 931849
4384 OpenRTL8721DA_XX.bin 1400992 1405376
4924 OpenECR6600_XX.bin 996785 1001709
5008 OpenBL602_XX_berry.bin 906428 911436
5040 OpenBL602_XX.bin 781092 786132
5068 OpenRDA5981_XX.bin 511516 516584
5120 OpenXR806_XX.img 883552 888672
5136 OpenTR6260_XX.bin 671716 676852
5152 OpenRTL8710B_UG_XX.img 1270464 1275616