-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
scd30 sensor not recognized when Power Cycle of ESP8266 (Wemos) #15438
Comments
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
into
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? |
[...]
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! |
I can also see it working after a power cycle restart. |
Fix SCD30 power on detection (#15438)
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. |
Increase power on wait time for SCD30 (#15438)
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. |
Add command ``SetOption46 0..255`` to add 0..255 * 10 milliseconds power on delay before initializing I/O (#15438)
OK. In latest dev there is a new command called You might want to experiment with values like 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. |
* Zigbee update ZCL * Berry more automated solidification * windows-2019 as Os for GH runner * Fix ADE7953 apparent and reactive power calibration * Fix support of more touch pins (arendst#16518) * Increase power on wait time for SCD30 Increase power on wait time for SCD30 (arendst#15438) * Add command ``SetOption46 0..255`` Add command ``SetOption46 0..255`` to add 0..255 * 10 milliseconds power on delay before initializing I/O (arendst#15438) Co-authored-by: Stephan Hadinger <stephan.hadinger@gmail.com> Co-authored-by: s-hadinger <49731213+s-hadinger@users.noreply.github.com> Co-authored-by: Theo Arends <11044339+arendst@users.noreply.github.com>
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. |
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. |
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 |
SO46 seems to work. |
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
|
I am running a pre compiled binary from the web flasher: Tasmota 13.4.1.2 (5ecd45e-tasmota32). It is definitely not recognized on every normal boot. |
I am running 14.2.0 with an SCD30 on this board: https://wiki.luatos.org/chips/esp32c3/board.html I2CScan detects the device, and I see the following detection on startup:
But it rarely goes through with the reading of the device and instead I get the amber light stuck on/off. I have two identical setups, and both exhibit the same behaviour. I have tried |
The SCD30 driver was already changed to delay detection after boot, instead of needing Testing a SCD30 with another ESP32-C3 board, I saw no trouble. Maybe your board is not able to supply the needed power, the SCD30 may need a spike of 75 mA during measurement, which is a lot more than most sensors. |
I have just tried adding 4.7k hardware pullups - no change I will leave the devices running overnight. Though interestingly one of the two units is much worse than the other. Also, I did observe it not being detected on startup once or twice, even though |
OK, sadly no this did not fix this issue. |
So I read the SCD30 datasheet and it recommends running the I2C interface at 50kHz clock, not 100kHz. Lo and behold, I recompiled tasmota32c3 with a 50kHz SCL frequency and now all of my SCD30 devices are working after a software reset with The datasheet says the absolute maximum clock rate is 100kHz but also states that you should run at 50kHz. I guess it is possible if different ESP32C3 boards have their base clock frequency slightly high/low this could cause some to work better or worse than others (which is what I observed). Or it may be true that different SCD30 units have a better ability to work closer to 100kHz. Ultimately, the sensor itself is running the I2C slave in software via a STM32 MCU, so it will be quite sensitive to this timing being too fast I imagine. I think this issue maybe needs to be reopened? There definitely seems to be something here, though I don't think tasmota has any support for changing the I2C clock speed at runtime. |
Thx for testing. From your comments I can deduct two actions:
I will implement both options in due time as I'm currently working on I2C implementation changes anyway. |
Both of these sound great, thank you. I also am going to try to do some more testing at 100kHz to see if I can actually observe the problem occurring with the logic analyser, because sometimes it doesn't come up at physical power on. Maybe it is a case of needing a soft reboot if it is stuck in this state. |
At power on I merely suspect the slow start of the STM32. As said, I noticed the same on the M5Unit scales where the STM32 needed almost 900msec to respond to first I2C command. This was too late for Tasmota's initial I2C detection leaving the device undetected. |
Ah, I see the SCD30 driver already has the power-on delay (as suggested earlier in this threat).
I also see it uses a patched library with specific ESP8266 code:
So I'll focus on setting the SCD30 clockspeed to 50k |
Try latest dev branch. This lowers I2C clock for SCD30 only from 100k to 50k. At least on my ESP8266 it still works fine. |
Thanks. Works well on my latest version. I have narrowed down the reboot problem further I think, it seems that the the sensor gets stuck reporting "no data" sometimes. Since the device is supposed to sample at 2Hz and there is a "no data" counter in the code, I think the sensor should probably be soft-reset or similar if the counter reaches 5, since that will correspond to 2.5 failed measurements. |
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
:Backlog Rule1; Rule2; Rule3
:Status 0
:weblog
to 4 and then, when you experience your issue, provide the output of the Console log: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)
The text was updated successfully, but these errors were encountered: