Environmental sensors (SCD41 CO₂)

Some time ago I made environmental sensors - we have them in every room here and the office. They only do CO₂, temperature, and humidity. They talk MQTT and control various things (ventilation, heating, etc). All on GitHub (boards and code).

There are a lot of cheap CO₂ sensors, but they measure something else as a proxy for CO₂, and not actual CO₂. A proper CO₂ sensor is not cheap. One such module was the SCD30, which is a rather fun module. It looks more like "the most important device in the universe" than an electronic component.

However, there is now an SCD41, which is much smaller, and neater. It talks a similar but different protocol - slightly more sane in providing simple integer values (with a scale+offset for temperature) rather than actual "floats" in 32 bit words. They use I²C protocol with CRC checks on each 2 bytes - yeh, special!

The SCD41 is cheaper too, £40+VAT rather than £48+VAT for the SCD30. I said not cheap!

However, it is rather nice, especially being so small, so I decided to make a new version of the board. It does have pads underneath to not really hand solder - but I am getting adept at the solder paste and oven.

The small cuboid silver box on the top left is the new SCD41. I also used a newer ESP32-PICO-MINI-02 as a controller.

However, apart from CO₂, I want temperature (and humidity). The SCD30 has temperature, as does the SCD41, but they pick up the temperature of the PCB rather too much, so I used a separate DS18B20 on a lead (you can buy from Amazon cheaply). This can then be placed in free air next to the module, or nearly if you want to use temperature at a specific point such as by a bed.

I decided to try integrating this on to the board (bottom left) using a DS18B20 component (looks like a transistor). I have tried this before without much luck.

I made the PCB with a gap and a slot so as to avoid heat getting to it, but sadly I was unlucky. Every time I try and use a simple DS18B20 component it is pretty crap - temp all over the place (±1C variations) and also reading too high even on that board. The modules you can get are in a metal tube with leads, and they tend to be much more stable and easier to use - I suspect the metal tube is a factor.

So, try again (I also missed one of the power pins on the SCD41). So new board design time, show here with the OLED display position on the top.

This time I have gone for the SCD41 sticking out the side. I can try a case design with this sticking out, or inside a slightly larger case, and see how it goes. The side rather than the top as heat rises. I also have a connector to allow an external DS18B20.

However, when testing the SCD41 module I found the temperature to be very stable and accurate, so you will note this board has lots of holes and thin bits to try and thermally isolate the SCD41. The plan is, if reliable, to use it for temperature as well. If all else fails the external DS18B20 can be used anyway.

Why does it stick out? Well apart from temperature in open air outside the case, it is also too high to fit between the PCB and the display board (only just). The old unit has the SCD30 on the back making for a much thicker overall unit, so this will actually be a lot thinner and neater, I hope.

We'll see when I get boards in a couple of weeks.

The next challenge after that is to try and code Matter so it can natively work with HomeKit and the like. At present it works via HomeAssisstant on a Raspberry pi which is, shall we say flaky.


  1. Not to detract from your worthwhile efforts to thermally isolate the sensor from the rest of the board, but if your circuit's average power consumption is quite stable and you have a fixed physical installation, then the error is just a simple constant offset (effectively it's power x thermal resistance to ambient) which is easy to calibrate out.

    1. Thanks, yes, that too. The temp offset controls on the SCD41 are slightly odd as they seem to kick in after start up and it gradually moves to right temp over a minute or two...


Comments are moderated purely to filter out obvious spam, but it means they may not show immediately.

NOTSCO (Not TOTSCO) One Touch Switching test platform (now launched)

I posted about how inept TOTSCO seem to be, and the call today with them was no improvement. It seems they have test stages... A "simul...