Closed solarslurpi closed 2 years ago
I've also seen SCD30 not being detected for power-up boot with ESP8266, but only after a restart. Maybe the sensor is slow to boot till ready on the I2C bus. Saw no similar trouble with ESP32.
I'm concerned that the "fix" suggested here is not good, as I suspect that it will work badly in case of the driver being included in a build where no SCD30 sensor is present. Has this been tested?
This issue has been automatically marked as stale because it hasn't any activity in last few weeks. It will be closed if no further activity occurs. Thank you for your contributions.
This issue was automatically closed because of being stale. Feel free to open a new one if you still experience this problem.
I also experience this issue. When power cycle a D1 mini connected to a SCD30 I have to reset the device once to get it recognize the SCD30.
From the datasheet it needs 2 seconds to power up. The current code doesn't allow this.
I'll order one and rewrite the setup code once received.
@arnowelzel could you pls try to change
bool Xsns42(byte function)
{
if (!I2cEnabled(XI2C_29)) { return false; }
bool result = false;
if (FUNC_INIT == function) {
Scd30Detect();
}
else if (scd30Found) {
into
bool scd30InitOnce = false;
bool Xsns42(byte function)
{
if (!I2cEnabled(XI2C_29)) { return false; }
bool result = false;
/*
if (FUNC_INIT == function) {
Scd30Detect();
}
*/
if (!scd30InitOnce && (FUNC_EVERY_SECOND == function) && (TasmotaGlobal.uptime > 2)) {
scd30InitOnce = true;
Scd30Detect();
}
else if (scd30Found) {
and report back.
@sfromis if you can find the time could pls try the above code change to see if it fixes the power on SCD30 detection?
@arnowelzel could you pls try to change
[...] into
bool scd30InitOnce = false; bool Xsns42(byte function) { if (!I2cEnabled(XI2C_29)) { return false; } bool result = false; /* if (FUNC_INIT == function) { Scd30Detect(); } */ if (!scd30InitOnce && (FUNC_EVERY_SECOND == function) && (TasmotaGlobal.uptime > 2)) { scd30InitOnce = true; Scd30Detect(); } else if (scd30Found) {
and report back.
Just tried that change and looks good so far. Even after a power cycle the SCD30 was detected properly and everything is fine:
The code makes sense as well - wait until the global uptime is more than 2 seconds before trying to detect the SCD30.
Thanks for the quick fix!
Just for completeness - after I let some fresh air in, the readings also got down:
I can also see it working after a power cycle restart.
00:00:01.925 I2C: SCD30 found at 0x61
Thx. Integrated just now.
Has this issue been fixed in the Tasmota-Sensors.bin (12.1.1) file. If I load the latest release of the bin file I still have the issue of the SCD30 not being detected after a power cycle. Only when I restart from the web interface it detects the SCD30. I'm a bit of a newbie so I apologies if this has been addressed somewhere else.
Should have been fixed in 12.1.1
If not try latest dev release (available in an hour) which has an additional waiting second before initializing
Thank I loaded the new Dev file . Stupid question. Think I might be missing something. With the Dev Release I'm still experiencing the power cycle issue. Do I need to build my own bin file where I #define USE_SCD30? Currently I'm just flashing my D1 Mini with the Tasmota-sensor.bin file and then just assigning the I2C ports. Doing it this way gives me the issue with the power cycle . Like I said Newbie here 🤦🏻♂️
It looks like the Wemos devices are a problem regarding power up.
On another device it works fine after power up and v12.1.1
I changed the power up init time to 5 seconds and it still fails to see the SCD30 on my wemos D1 too.
I guess you can forget to make this work due to I2C bus noise during Wemos power up. Just make a good rule to do a restart after initial power up to solve this issue.
As I thought. The Wemos D1 is flakey at power on.
I just included a wait for a second before init I2C. Than it works.
I will need time to find a solution.
OK.
In latest dev there is a new command called SetOption46 0..255
allowing you to stall initialization for 0..255 * 10 milliseconds to let stabilize the local Wemos power.
You might want to experiment with values like SO46 10
os SO46 20
for a 100mSec or 200mSec delay.
If you own the Adafruit SCD30 you might also want to power the device from 5V as it draws a lot of power when measuring (notice the fainting power led because the wemos LDO just cannot provide enough power for the device.
YMMV.
Apologies for the late response. So I tried the suggestion you said with the new Dev firmware Tasmota-Sensor.bin file and SetOption46 0-255. I still can't get the scd30 to work on power up. No matter the value I set. I will either move to a different MCU or perhaps try running a rule for the device to restart after a Power cycle. Thanks
Okay so I tried another D1 mini and the SetOption46 200 does work. Think there might have been an issue with the one I initially tested on. So every time I power cycle the SCD30 comes online . Thanks for the assistance in getting this too function. Much Appreciated
I have exactly the same behavior with esp32 (esp32 wroom-32 development board). Tested at 13.2.0, 13.2.0.2 and older 13.1.0 with no success. Each (100%) power recycle leads to unrecognized sensor with empty sensor details etc. Sensor is a genuine Sensirion SCD30, supplied with 5V. Only after restart is OK
Did you try tweaking SetOption46 as suggested by arendst?
Thanks I saw the possible solution. Didn't tried yet, (I'm out of office) and I have no physical access to it. I am panning to do it tomorrow morning and I will report back.
Did a small test hooking up a SCD30 to an ESP32, and can confirm that it was not found on first boot after power up. When restarting, it was found, but I notice that other I2C sensors on same board were found less than 0.3 seconds after boot, while the SCD30 was only found nearly 2.7 seconds later. So there is already a delay for SCD30.
When using SetOption46 255
(the max of 2.55 secs), the whole I2C initialization was delayed by that time, and SCD30 was found at first boot after power up. It may be feasible with a shorter delay than 255, if you want to make boot a bit faster.
SO46 seems to work. In any case, as a failsafe action I am detecting tasmota restart season as "Vbat power on reset" at node red and publish a restart 1 mqtt message after 5 sec.
I think this issue should be opened again. I am facing the same issue with an ESP32 C3 and the SCD30 sensor. Even SO46 255 does not fix the issue. Only a software restart allows the sensor to be recognized.
With ESP32-C3, Tasmota 13.4.1.2 dev build and SetOption46 255
, right after power on:
"SCD30":{"CarbonDioxide":769,"eCO2":798,"Temperature":26.54,"Humidity":38.42,"DewPoint":11.20,"HeatIndex":26.48},"TempUnit":"C"}
I am running a pre compiled binary from the web flasher: Tasmota 13.4.1.2 (5ecd45e-tasmota32). The board I am using is an ESP32 c3 super mini. I2C is connected to gpio 3 (SDA) and 4 (SCL).
It is definitely not recognized on every normal boot.
PROBLEM DESCRIPTION
scd30 sensor with ESP826 Wemos is not detected on Power cycle. The scd30 sensor is detected and readings are available on
restart 1
REQUESTED INFORMATION
Make sure your have performed every step and checked the applicable boxes before submitting your issue. Thank you!
Backlog Template; Module; GPIO 255
:Status 0
:TO REPRODUCE
Steps to reproduce the behavior: Power cycle an ESP826 (wemos - not sure that matters).
EXPECTED BEHAVIOUR
A clear and concise description of what you expected to happen. I expected to see CO2 readings.
This is what I did to fix it for me:
ie.: Not running I2cSetDevice() if the chipset is 8266. This is not a robust way. However, I take it the scd30 needs more time to get back to Tasmota than Tasmota is giving it...I don't want to introduce a delay. But I do not have enough context in the code to fix timing of loading i2c drivers.
SCREENSHOTS
If applicable, add screenshots to help explain your problem.
ADDITIONAL CONTEXT
Add any other context about the problem here.
(Please, remember to close the issue when the problem has been addressed)