Sensirion SCD4X family modules

Moderators: grovkillen, Stuntteam, TD-er

Post Reply
Message
Author
sobolkz
Normal user
Posts: 37
Joined: 12 Sep 2019, 16:30

Sensirion SCD4X family modules

#1 Post by sobolkz » 14 Jun 2022, 07:09

Hi all! Is here anybody, who does testing new Sensirion SCD4X modules with ESPEasy? As I understand new sensors are photoacoustic instead SCD30, which NDIR. Is new one using same data protocols?

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#2 Post by TD-er » 14 Jun 2022, 09:12

Have not used those myself, but seeing the price I'm not sure I will soon.
Are there boards available with this sensor? It seems to be hard to solder by hand.
Only to be soldered using reflow oven or hot air I guess, since the pads are below the package.

But I guess someone might easily compare the commands and conversion formulas of both to see if they are the same and if not, the plugin can probably be easily adapted to support the sensor.
Sensirion SCD40 on Mouser (datasheet page 7 & 9)

What is nice however is that this sensor apparently allows for altitude and ambient pressure to compensate the measurements for these environmental parameters in the sensor.
Also it has a temp/humidity sensor inside which can be tuned with some temperature offset to show the correct relative humidity.
Nice sensor, really small for a CO2 sensor and also a low average current consumption.

sobolkz
Normal user
Posts: 37
Joined: 12 Sep 2019, 16:30

Re: Sensirion SCD4X family modules

#3 Post by sobolkz » 14 Jun 2022, 11:18

TD-er wrote: 14 Jun 2022, 09:12 Are there boards available with this sensor? It seems to be hard to solder by hand.
There is many more sellers at Aliexpress, which offers SCD4X as sensor amd ready to use modules:
https://a.aliexpress.com/_9fPZY5
https://a.aliexpress.com/_Aqnk9b
Price is equal for Senseair S8.
Sparkfun offering module too
https://www.sparkfun.com/products/18366
As I understand it's cost also equal to Senseair S8 from EU sellers.

sobolkz
Normal user
Posts: 37
Joined: 12 Sep 2019, 16:30

Re: Sensirion SCD4X family modules

#4 Post by sobolkz » 26 Jun 2022, 17:28

I'm accepting congratulations, just received SCD41 module.
SCD41.jpeg
SCD41.jpeg (133.54 KiB) Viewed 3456 times
TD-er, seems that SCD30 plugin doesn't support SCD4x. I2C scanner report only device at 0x62 addres without definitions.
I'll check with Arduino IDE and inform here.

UPD:
Module are working, Sparkfun SCD4x library was used https://github.com/sparkfun/SparkFun_SC ... no_Library.
Result is:
22:21:31.127 -> CO2(ppm):584 Temperature(C):29.5 Humidity(%RH):51.4
22:21:31.596 -> ........
22:21:35.629 -> CO2(ppm):584 Temperature(C):29.4 Humidity(%RH):52.2
22:21:36.131 -> .........
22:21:40.668 -> CO2(ppm):589 Temperature(C):29.4 Humidity(%RH):52.5
22:21:41.137 -> ........
22:21:45.174 -> CO2(ppm):586 Temperature(C):29.4 Humidity(%RH):53.0
22:21:45.678 -> ........
22:21:49.684 -> CO2(ppm):609 Temperature(C):29.3 Humidity(%RH):53.8
22:21:50.187 -> .........
22:21:54.721 -> CO2(ppm):725 Temperature(C):29.2 Humidity(%RH):55.0
22:21:55.223 -> ........
22:21:59.253 -> CO2(ppm):907 Temperature(C):29.1 Humidity(%RH):56.2
22:21:59.723 -> ........
22:22:03.765 -> CO2(ppm):1022 Temperature(C):29.0 Humidity(%RH):57.2
22:22:04.270 -> .........
22:22:08.769 -> CO2(ppm):1182 Temperature(C):29.0 Humidity(%RH):57.6
22:22:09.272 -> ........
22:22:13.306 -> CO2(ppm):1204 Temperature(C):28.9 Humidity(%RH):58.5
22:22:13.812 -> ........
22:22:17.841 -> CO2(ppm):1237 Temperature(C):28.8 Humidity(%RH):58.8
22:22:18.312 -> .........
22:22:22.847 -> CO2(ppm):1246 Temperature(C):28.9 Humidity(%RH):58.6
CO2 and humidity increasing is reaction to breathing to sensor.
UPD2
Also Sensirion library https://github.com/Sensirion/arduino-i2c-scd4x
was successfully tested. Same result.

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#5 Post by Ath » 26 Jun 2022, 19:53

I have received a SCD40 module this week, will reserve a new plugin id for this, as it doesn't seem feasible to integrate with existing SCD30 code.
Edit: Reserved P135 Environment - SCD4x CO2, Temp, Hum.
/Ton

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#6 Post by TD-er » 26 Jun 2022, 21:15

Ah good to know that the implementation is apparently not too complex to add with the available libraries :)

sobolkz
Normal user
Posts: 37
Joined: 12 Sep 2019, 16:30

Re: Sensirion SCD4X family modules

#7 Post by sobolkz » 27 Jun 2022, 05:26

Ath wrote: 26 Jun 2022, 19:53 I have received a SCD40 module this week, will reserve a new plugin id for this, as it doesn't seem feasible to integrate with existing SCD30 code.
Edit: Reserved P135 Environment - SCD4x CO2, Temp, Hum.
Ton, perfect. I can help with testing.

sobolkz
Normal user
Posts: 37
Joined: 12 Sep 2019, 16:30

Re: Sensirion SCD4X family modules

#8 Post by sobolkz » 30 Jun 2022, 12:49

After few days of testing I can say, that SCD41 CO2 measurements are equal with Senseair S8. But SCD41 more compact and can work directly with I2C at 3.3V instead separate MODBUS for S8 and 5V. It can help with sizie of final devices.

chemmex
Normal user
Posts: 74
Joined: 15 Feb 2019, 16:18

Re: Sensirion SCD4X family modules

#9 Post by chemmex » 03 Aug 2022, 18:23

Ath wrote: 26 Jun 2022, 19:53 I have received a SCD40 module this week, will reserve a new plugin id for this, as it doesn't seem feasible to integrate with existing SCD30 code.
Edit: Reserved P135 Environment - SCD4x CO2, Temp, Hum.
Hi Ton, any chance P135 is ready for testing?

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#10 Post by Ath » 03 Aug 2022, 19:00

I have actually been working on P135 since yesterday, and expect to create a PR tomorrow or the day after, it is working fine already, just adding some features, testing and to write documentation :D

Any specific feature you're looking for?
/Ton

chemmex
Normal user
Posts: 74
Joined: 15 Feb 2019, 16:18

Re: Sensirion SCD4X family modules

#11 Post by chemmex » 03 Aug 2022, 20:01

Well, I am looking especially at the SCD41's single shot mode, so it would be nice to have respective settings for that. I have SCD40 for now, but SCD41 is on the way

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#12 Post by Ath » 03 Aug 2022, 22:50

sobolkz wrote: 30 Jun 2022, 12:49 After few days of testing I can say, that SCD41 CO2 measurements are equal with Senseair S8. But SCD41 more compact and can work directly with I2C at 3.3V instead separate MODBUS for S8 and 5V. It can help with sizie of final devices.
chemmex wrote: 03 Aug 2022, 20:01 Well, I am looking especially at the SCD41's single shot mode, so it would be nice to have respective settings for that. I have SCD40 for now, but SCD41 is on the way
I've made good progress, so created PR #4171.

Changed the category from Environment to Gases, to group it with (most) other CO2 sensors.

The Single-shot measurements is part of the feature set (had it already in before you mentioned it here 8-))

Please provide any feedback via comments in the PR :idea:
/Ton

Haldi_2
Normal user
Posts: 49
Joined: 24 Aug 2020, 18:10

Re: Sensirion SCD4X family modules

#13 Post by Haldi_2 » 18 Aug 2022, 21:51

Ohoooo
Optional Single-shot measurements (take 5 seconds) (only with an SCD41)
Does that mean a battery powered device would actually be feasible with this thingy?
Or does it need a "pre-heating" time of 15-120 seconds when disconnected from power?


Just ordered one and gonna join the fun :)

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#14 Post by Ath » 18 Aug 2022, 22:00

From what I understood from the documentation, it should stay powered on. But the ESP can go in deep sleep mode, and start a measurement at wake-up, wait for the result to arrive (~5 sec.), transmit that, and go back to sleep again.
The Single Shot mode is especially designed for applications like that, AFAICS.
/Ton

chemmex
Normal user
Posts: 74
Joined: 15 Feb 2019, 16:18

Re: Sensirion SCD4X family modules

#15 Post by chemmex » 18 Aug 2022, 23:41

Taking into account the fact that SCD4x stores calibration data in its internal NVRAM, there might be no reason to keep it powered while ESP sleeps. However, I discovered huge (more than 4°C) difference in temperature and humidity readings between first and second samples with SCD40, so would wait until SCD41 arrives and check which mode is better

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#16 Post by Ath » 19 Aug 2022, 09:12

The first reading might indeed be unreliable, have to check the datasheet to be sure. Might need to discard the first read value if that is true. I'll check.
/Ton

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#17 Post by TD-er » 19 Aug 2022, 10:21

Some sensors also use some IIR filter to reduce noise.
This also delays the signal responsiveness a bit.

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#18 Post by Ath » 24 Aug 2022, 10:27

I think development of this plugin is completed.
Wether to add an IIR filter we can decide later, IMHO.

I've updated the PR with some minor code updates, and removed the [TESTING] tag. Any testing feedback is still welcome, of course.
/Ton

chemmex
Normal user
Posts: 74
Joined: 15 Feb 2019, 16:18

Re: Sensirion SCD4X family modules

#19 Post by chemmex » 25 Aug 2022, 01:19

Yes, I think it's time to go to the main repo.

I will do some more tests when SCD41 arrives.

Now, just for curiosity, current consumption graph of SCD40's single measurement
IMG_20220825_020229.jpg
IMG_20220825_020229.jpg (81 KiB) Viewed 2225 times

Haldi_2
Normal user
Posts: 49
Joined: 24 Aug 2020, 18:10

Re: Sensirion SCD4X family modules

#20 Post by Haldi_2 » 21 Sep 2022, 19:11

Does anyone have a Testbuild for EPS32 laying around ? :)
last nightly is from early august.

I know there once was a webpage that let you build a ESP easy build with a webinterface for configuration which plugins you want included... but i cant find it anymore :(

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#21 Post by TD-er » 21 Sep 2022, 19:27

Haldi_2 wrote: 21 Sep 2022, 19:11 [...]

I know there once was a webpage that let you build a ESP easy build with a webinterface for configuration which plugins you want included... but i cant find it anymore :(
If you found it, please let me know :)
That way I don't have to make it myself as that's (still) the plan to do.

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#22 Post by Ath » 21 Sep 2022, 19:27

Haldi_2 wrote: 21 Sep 2022, 19:11 Does anyone have a Testbuild for EPS32 laying around ? :)
last nightly is from early august.
The plugin was merged quite recently, any updated build from the Github actions can be used, I'd suggest to use the latest mega merge build: https://github.com/letscontrolit/ESPEas ... 3095834710

Haldi_2 wrote: 21 Sep 2022, 19:11 I know there once was a webpage that let you build a ESP easy build with a webinterface for configuration which plugins you want included... but i cant find it anymore :(
You must be having predictive dreams, as that page has been mostly in our thoughts, but not materialized yet... :lol:
/Ton

Haldi_2
Normal user
Posts: 49
Joined: 24 Aug 2020, 18:10

Re: Sensirion SCD4X family modules

#23 Post by Haldi_2 » 22 Sep 2022, 20:18

Ath wrote: 21 Sep 2022, 19:27 I'd suggest to use the latest mega merge build: https://github.com/letscontrolit/ESPEas ... 3095834710
You must be having predictive dreams, as that page has been mostly in our thoughts, but not materialized yet... :lol:
Oh... that's pretty cool. Didn't know you had auotmated builds.

I kid you not! I Sweat i once used that thingy to create a 1M esp8266 build with BME680 included. Might have been a Tasmota build though....
You first had to start some kind of online docker thingy that then pulls the code from github, then you get a webppage that is run inside the VM to select your configuration then it builds and you can download the Bin.
Was fkn Awesome. No need to install all that build tools on your local machine.

P.S Collection E is the one we want...

Haldi_2
Normal user
Posts: 49
Joined: 24 Aug 2020, 18:10

Re: Sensirion SCD4X family modules

#24 Post by Haldi_2 » 02 Oct 2022, 17:31

@Ath doesn't seem to be working...

Image
Image

no matter what i don't get an Co2 value.
Tried the scd4x,selftest[,selftestcode] (with the generated code) while Serial connected but nothing shows up.
949201 : Info : SCD4x: SingleShot measurement started.
949202 : Info : SCD4x: READ Scheduler started: +5000 ms.

Did you use your device on 3.3V or 5V?

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#25 Post by Ath » 02 Oct 2022, 18:55

The sensor is 3.3V only, and mine has been working great on the regular I2C clock speed of 400 kHz (as you have ticked the Force Slow I2C speed checkbox)

It looks like you will have to look into the mounting of the sensor, did you remove anything of the white sticker/tape from the sensor, as AFAIK, that's not the intention, the sensor should be used as-is when removed from the packaging.
Also, ESD-measures should be taken, as with any electronic components, when handling the sensor. I assume you have taken care of that.

If all of that is in order, then the last cause I can think of is that your sensor is just broken.
/Ton

Haldi_2
Normal user
Posts: 49
Joined: 24 Aug 2020, 18:10

Re: Sensirion SCD4X family modules

#26 Post by Haldi_2 » 02 Oct 2022, 19:01

Ath wrote: 02 Oct 2022, 18:55 If all of that is in order, then the last cause I can think of is that your sensor is just broken.
That's what i was afraid of :(

chemmex
Normal user
Posts: 74
Joined: 15 Feb 2019, 16:18

Re: Sensirion SCD4X family modules

#27 Post by chemmex » 03 Oct 2022, 22:30

Ath wrote: The sensor is 3.3V only
Datasheet says it's 2.4~5.5V

Haldi_2
Normal user
Posts: 49
Joined: 24 Aug 2020, 18:10

Re: Sensirion SCD4X family modules

#28 Post by Haldi_2 » 19 Oct 2022, 18:34

Got another one...
Recognized By i2c but no values :(
Screenshot_20221019_182340_Firefox.jpg
Screenshot_20221019_182340_Firefox.jpg (121.12 KiB) Viewed 876 times
Always shows 0 in all values.

Code: Select all

836469: SCD4x: READ Scheduler started: +5000 ms.
841474: SCD4x: READ Scheduler started: +5000 ms.
842212:  Webserver 1 Arguments: 0: 'cmd' length: 28
842213: HTTP: scd4x,selftest,Scd4x0A20SelF
842219: SCD4x: Selftest starting... (may take up to 11 seconds!)
854225: SCD4x: Sensor self-test failed!
854274: WD   : Uptime 14 ConnectFailures 0 FreeMem 196128 WiFiStatus WL_CONNECTED 3 ESPeasy internal wifi status: Conn. IP Init
Does anyone have a working Build for ESP32?

User avatar
Ath
Normal user
Posts: 2115
Joined: 10 Jun 2018, 12:06
Location: NL

Re: Sensirion SCD4X family modules

#29 Post by Ath » 19 Oct 2022, 20:19

Haldi_2 wrote: 19 Oct 2022, 18:34 Got another one...
...

Code: Select all

842219: SCD4x: Selftest starting... (may take up to 11 seconds!)
854225: SCD4x: Sensor self-test failed!
Does anyone have a working Build for ESP32?
Not worried about the build, that does look to be OK, but more about the sensor quality, as the self-test fails...

Assuming your wiring is short (< 50 cm), and you didn't add any additional I2C pull-up resistors (they are included on all boards I've seen available), I have no clue what's going on here, my SCD40 sensor worked at first try.
/Ton

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#30 Post by TD-er » 20 Oct 2022, 00:11

Short checklist for I2C debugging:

- Do not use long cables
- Check total pull-up resistance value (typically 4k7 - 10k is needed, when using several boards they all may have pull-up resistors which makes it too strong)
- Check wiring quality (I know some people even get offended when it is mentioned, but please double-check)
- Test with only 1 sensor connected and/or with 1 known to be working sensor on the same bus (to make sure it isn't a pull-up resistor issue)
- Test at lower I2C clock speed (setting on Hardware tab)
- Try using different pins (default pins 4 & 5 was just about the worst possible choice for ESP32 boards) For example pin 13 & 16 often work just fine on ESP32. See: https://espeasy.readthedocs.io/en/lates ... e-on-esp32

rado
Normal user
Posts: 3
Joined: 24 Nov 2022, 07:26

Re: Sensirion SCD4X family modules

#31 Post by rado » 24 Nov 2022, 07:30

guys how accurate readings are getting you from this sensor? I've received it yesterday and I'm trying it but it gives suspicious values. When I open the window it drops as low as 210 ppm (maybe even lower but I'm sampling at 1 min rate) which is nonsense and then slowly climbs up after few minutes

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#32 Post by TD-er » 24 Nov 2022, 09:35

I have not yet had a chance to play with this sensor.
So I don't know if it needs some parameters to setup some kind of compensation for various use case specifics.
Things like humidity, air pressure and perhaps voltage of the sensor maybe have some impact? Have to read the datasheet for these.

I do know that those sensors may be affected by some kinds of packaging materials.
Not sure what the actual effect is. So I don't know whether it is a temporary effect or permanent.
Maybe the sensor can compensate for it when left in a well ventilated room for a few days?

rado
Normal user
Posts: 3
Joined: 24 Nov 2022, 07:26

Re: Sensirion SCD4X family modules

#33 Post by rado » 25 Nov 2022, 20:20

I've found out there is altitude or pressure settings, so I've ordered barometric pressure sensor and will play with it later. Also when I compare data with SI7021, the temperature is off by 2 degrees and humidity by 10% :?

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#34 Post by TD-er » 25 Nov 2022, 20:57

If temperature readings are off, then obviously the humidity is also off.

chemmex
Normal user
Posts: 74
Joined: 15 Feb 2019, 16:18

Re: Sensirion SCD4X family modules

#35 Post by chemmex » 26 Nov 2022, 00:02

I have a pair of SCD40 and SCD41 on the bench working for over a month. Both were initially reset to defaults and had the same settings - periodic measurements with autocalibration enabled. During 3 weeks SCD40 was showing 200 ppm less than SCD41 until one day both were taken to the fresh air. After that they aligned the readings to the level of SCD41.

Now they are accompanied by the S8 and, as you may see, the curves are absolutely identical although S8 definitely shows understated values and I cannot re-calibrate it.

You may see from the graph that calibration by offset is no good since SCD40 and SCD41 most likely have different slopes.

I am waiting for some more breakout boards to check the value spread within the same model
Attachments
IMG_20221126_013849.jpg
IMG_20221126_013849.jpg (119.29 KiB) Viewed 40 times

rado
Normal user
Posts: 3
Joined: 24 Nov 2022, 07:26

Re: Sensirion SCD4X family modules

#36 Post by rado » 26 Nov 2022, 21:12

Here are my readings (green is the temperature).
I've set correct altitude and today I've still got readings around 200ppm:
co2.png
co2.png (33.46 KiB) Viewed 21 times
there is also lot of sudden drops for short time (although home was empty for most of the day).
I'll try to bring it outside when I'll have more time.

TD-er
Core team member
Posts: 6902
Joined: 01 Sep 2017, 22:13
Location: the Netherlands
Contact:

Re: Sensirion SCD4X family modules

#37 Post by TD-er » 26 Nov 2022, 21:34

Sudden drop of temperature is really strange.
Is it possible the connections to the chip are flaky?
For example unstable power supply?

Post Reply

Who is online

Users browsing this forum: No registered users and 3 guests