Is it possible to have two AHT2x compatible sensors on one XH-WB3S, Chipset BK7238 ? The AHT30 breakout boards I am using have no obvious way to change the I2C address. Intended measurement before and after a cooler.
This did not work as I hoped: backlog startdriver AHT2x 7 8 1 2; startdriver AHT2x 23 28 3 4;
It's not possible with the current driver. Enhancing it for multiple sensors (on different pins) might be possible. If you are willing to wait I can try, but it will take some time, I need to finish other tasks before starting a new one.
I really appreciate it if you give it a try. Don't know if this is a fringe application or if anyone else might find it useful. It is a hobby project, I have no time pressure from anyone.
All other commands have been extended to add an optional <Sensor number> as last argument to address it, as shown in code.
"Calibrate" will work on sensor 0 if only 1 or 2 arguments are given.
In order to change a sensor != 0, you must give temp-dalta AND humidity-delta AND sensor-number
Or has someone a better idea?
//cmddetail:{"name":"AHT2X_Calibrate","args":"<DeltaTemp> [DeltaHumidity - default 0] [Sensor - default 0]",
//cmddetail:"descr":"Calibrate the AHT2X Sensor as Tolerance is +/-2 degrees C.",
//cmddetail:"fn":"AHT2X_Calibrate","file":"driver/drv_aht2x.c","requires":"",
//cmddetail:"examples":"AHT2X_Calibrate -4 10 <br /> meaning -4 on current temp reading and +10 on current humidity reading for first sensor"}
CMD_RegisterCommand("AHT2X_Calibrate", AHT2X_Calibrate, NULL);
//cmddetail:{"name":"AHT2X_Cycle","args":"<IntervalSeconds> [Sensor - default: all sensors]",
//cmddetail:"descr":"This is the interval between measurements in seconds, by default 1. Max is 255.",
//cmddetail:"fn":"AHT2X_cycle","file":"drv/drv_aht2X.c","requires":"",
//cmddetail:"examples":"AHT2X_Cycle 60 <br /> measurement is taken every 60 seconds"}
CMD_RegisterCommand("AHT2X_Cycle", AHT2X_Cycle, NULL);
//cmddetail:{"name":"AHT2X_Measure","args":"[Sensor - default: all sensors]",
//cmddetail:"descr":"Retrieve OneShot measurement.",
//cmddetail:"fn":"AHT2X_Measure","file":"drv/drv_aht2X.c","requires":"",
//cmddetail:"examples":"AHT2X_Measure"}
CMD_RegisterCommand("AHT2X_Measure", AHT2X_Force, NULL);
//cmddetail:{"name":"AHT2X_Reinit","args":"[Sensor - default: all sensors]",
//cmddetail:"descr":"Reinitialize sensor.",
//cmddetail:"fn":"AHT2X_Reinit","file":"drv/drv_aht2X.c","requires":"",
//cmddetail:"examples":"AHT2X_Reinit"}
CMD_RegisterCommand("AHT2X_Reinit", AHT2X_Reinit, NULL);
//cmddetail:{"name":"AHT2X_Addsensor","args":"<CLK Pin> <DATA Pin> [Channel temperature] [Channel humidity]",
//cmddetail:"descr":"Add another AHT2X with CLK and DATA pin and (optional) channels for temp and hum",
//cmddetail:"fn":"AHT2X_Addsensor","file":"driver/drv_aht2x.c","requires":"",
//cmddetail:"examples":"AHT2X_Addsensor 10 11 4 5<br /> Sensor with CLK on pin 10 Data pin 11, channel for temp 4 channel for hum 5"}
CMD_RegisterCommand("AHT2X_Addsensor", CMD_AHT2X_AddSensor, NULL);
Added after 58 [minutes]:
I really had two AHTx based sensors around - sorry I didn't find them before, so @taggbricka had to do all the tests.
So it's working for me, too: