Easy CO2 Meter with ESP8266 (NodeMCU) and Senseair S8 sensor

Last modified 4 months

Let's see how to assemble the Easy CO2 meter with a sensor Senseair S8 LP.

This will be a very short articleonly with the important differences compared to mounting with the MH-Z19B or MH-Z19C sensor. Let's go "to the point".

If you haven't seen the article "A homemade CO2 meter with Wifi against the coronavirus"you should see it now because this montage is based on it. Almost everything is the same, and here we will only deal with the differences.

Why use the Senseair S8 sensor?

I think the right question would be, why mount the Easy CO2 meter with another sensor?

There is several important reasons I can think of to use this sensor instead of the MH-Z19B or MH-Z19C.

  • The NDIR Senseair S8 NDIR sensor is a better qualityof a Swedish company
  • Provides more precise measurements
  • It has longer duration
  • For the time being no counterfeits
  • Da fewer problems with food

Similarities in assembly

The construction of the meter with this sensor is almost identical. The sensor is very similar, it has almost the same physical form and the connections are the same.

For the whole assembly part, you can follow the tutorial "A homemade CO2 meter with Wifi against the coronavirus". The connections are exactly the same.

Connection diagram NodeMCU to Senseair S8

As in other cases, I recommend that you if your NodeMCU board has a VU pin (not all of them have it), connect the positive of the Senseair S8 LP (VCC) to that pin, instead of Vin.

Differences

The differences in the mounting of the meter are centred on the firmware, as the communication with this sensor is different, although the configuration, in general, is basically the same as with the MH-Z19B or MH-Z19C sensors.

Configuring ESP Easy for the Senseair S8

The major difference is that we have to choose the correct device in the "Devices" menu.

You will then be taken to the ESPEasy web page where you will make the sensor configuration.

We simply need to enter the information as shown below.

Where to buy the Senseair S8 sensor?

Here is the link to where I bought it: Senseair S8 LP. It arrived very quickly (one week):

It costs about 24 Euros here: Senseair S8 LP

It is a shop with many positive reviews and shipping is by AliExpress Standard ShippingYou should have it at home in about two weeks.

Be careful because there are other versions of the Senseair S8 sensor that are not valid. for the purpose we want (there are similar ones, e.g. for the automotive sector).

Senseair S8 LP CO2 sensor calibration

The Senseair S8 LP has a very good automatic calibration system (ABC, Automatic Baseline Correction), which means that the Senseair S8 LP is able to calibrate itself automatically, under normal conditions, you will not have to do manual calibration. and you can disengage from it.

The ABC algorithm permanently monitors the minimum CO2 reading over a pre-set period and slowly corrects for any drift over the long term compared to the concentration of 400 ppm (or 0.004%vol) of CO2 expected in open air.

The maximum setting allowed by the ABC algorithm of the Senseair S8 is 30-50 ppm per ABC period.

The factory-set ABC period is 8 days.

Due to a bug in the Senseair S8 sensor itself, avoid problems and mismatch a sensor, ESPEasy does not allow to start sensor calibration by software. (see below how to calibrate it using an ESPEasy ruler).

If you want to manually calibrate the sensor you will need to do the following:

You have to connect pin bCAL_in to GND for a minimum of 4 seconds and a maximum of 8 seconds and initiate a manual calibration.

Before starting the manual calibration, the sensor should be at about 400 ppm for a few minutes (I suggest a minimum of 15 minutes) for the sensor to stabilise. That is: you will have to leave the sensor operating outdoors for at least 15 minutes before starting the sensor. calibration.

The procedure is very easy:

  • You leave the sensor running outdoors, at least 15 minutes
  • You connect the bCAL_in pin to GND during more than 4 seconds and less than 8 seconds
  • Keep the sensor outside for about 5 minutes to complete its calibration and stabilise.
  • That's it. The sensor will assume the current concentration as 400 ppm.

It is important that do not leave the bCAL_in pin connected to GND for more than 8 seconds.because if 13 seconds are exceeded, the sensor starts a different calibration mode.which is not the one you are interested in (it is a calibration mode with a concentration of 0 ppm CO2, for which you would have to immerse the sensor in nitrogen, for example).

In my experience, if the sensor receives outside air from time to time, manual calibration is completely unnecessary.

However, if the sensor is placed at a location which is rarely well ventilated with outside airI recommend calibrating it manually outdoors from time to time.

Calibration of the Senseair S8 CO2 sensor with an ESPEasy ruler

Having to manually jumper the bCal_in pin to GND every time you want to calibrate it can be inconvenient, so here's how to do the calibration using an ESPEasy ruler conveniently and without having to access the meter directly.

What we are going to do is to tell ESPEasy to control the bCal_in pin and to set the PIN to GND for 5 seconds when we want to calibrate by means of a command.

To do this we will need to do two things:

  • Connect the bCal_in pin of the Senseair S8 to a pin of the ESP8266.
  • Include a rule that connects bCal_in to GND for 5 seconds

The first step is to connect bCal_in to an ESP8266 pin using a small wire. I have used pin D5 (GPIO14).

In the "Rules" tab of ESPEasy we will have to include the following:

On CalibrateS8 do
  GPIO,14,0
  TimerSet,1,5
EndOn

On rules#timer=1 do
  GPIO,14,2
endon

On System#Boot do
  GPIO,14,2 // Sets GPIO14 (calibration PIN) to high impedance
EndOn

The first block "On CalibrateS8" to "EndOnThe timer is set to "low", sets the GPIO14 pin (D5) to logic low (ties it to GND) and sets timer number 1 to run five seconds later.

The second block "On rules#timer=1 do" to "EndOn"is executed when timer number 1 reaches zero (after five seconds) and sets the GPIO14 (D5) pin to high impedance logic level (as if it were "loose" again, disconnecting it from GND).

The third block "On System#Boot do" to "EndOn"It is automatically executed every time ESPEasy is started (when it is turned on or restarted) and ensures that the GPIO14 (D5) pin is set to high impedance logic level (as if it were "loose") every time the meter is started.

Image of the rules using timer number 2 instead of 1 (you can use any timer you want, that you are not using for something else).

That's it. Now all we have to do when we want to calibrate our Senseair S8 is to enter the following line in our browser (replacing 192.168.1.77 with the IP of your CO2 meter):

 http://192.168.1.77/control?cmd=event,CalibrateS8  

You will see the browser load an "OK" page and the sensor will be calibrated.

15 thoughts on “Medidor CO2 Easy con ESP8266 (NodeMCU) y sensor Senseair S8”

  1. Hello again.
    Yesterday I got the Sensair s8, today the screen and tomorrow I'm expecting the ESP, so I'll start the assembly work at the weekend. I've just had a bit of a scare when I read in the specs of the S8 https://rmtplusstoragesenseair.blob.core.windows.net/docs/publicerat/PSP126.pdf which warns NEVER TOUCH THE SENSOR WITH BARE HANDS (ESD gloves should be used, I think a latex one will do) and I was already handling it yesterday to take a look at it.... As it seems to me that you don't say anything about it in this and other tutorials, do you know if the fact of having touched it for a few minutes could have really screwed it up? With my boldness and your permission...when I get down to the task, if I have any stumbling blocks that I can't solve, I'll drop by here to ask.
    Greetings.

    Reply
    • Hello Llorinte.

      The datasheet you put the link to does not correspond to this sensor but to another model and is linked to a website that is not the official one. With your permission I have edited your message to put the correct one and not to confuse any user.

      The correct, official one from the manufacturer is the one linked in this blog (which is this one: https://rmtplusstoragesenseair.blob.core.windows.net/docs/publicerat/PSP126.pdf).

      That said: Such components are generally sensitive to electrostatic discharges and should therefore be handled with some care. Another thing is that they are easily damaged by this, which is not so easy. I don't know of a single case of users of this blog who have assembled the meter (and believe me, there are many) who have damaged the sensor by touching it with their hands.

      The possibility, strictly speaking, is there, but it is quite small. I myself have had several sensors of this type from different manufacturers here for years and I don't just touch them with my hands, I have them piled up on the table with things on top of them...

      However, I will put a warning in the tutorial just in case.

      Reply
      • Perfect. Thanks for the correction, I had taken it from a Russian youtube without noticing that the link was of another model different from the one you put, and I only kept that warning that I had also seen in another series of videos on calibration of the S8 that I handled it with gloves and that if it is the same as the one in your tutorial (https://www.youtube.com/watch?v=n059hQpybsE) ,
        Greetings.

        Reply
  2. Hello Mariete. Thanks for this tutorial. I already have the sensor and today I get the plate. I have a doubt, how to attach the sensor correctly? I have bought the plastic box that you recommend, with the plate I suppose there will be no problem to screw it but the sensor I don't know how to place it to fix it well. Thanks!
    Best regards.

    Reply
      • I think it's a good idea. I just got the rest of the parts a while ago. The box looks great, I'll have to do some DIY with it too.
        Thank you! Best regards.

        Reply
  3. Hello.
    Nothing...I'm getting a bit desperate about this...after the war I had soldering the cables to the Senseair, the installation of the firmware was impossible. I get an error that I don't see reported by anyone in the main tutorial. It's the second Nodemcu Lolin V3 I've tried and I get the same error when flashing it. It does load the project's particle meter firmware. https://sensor.community/fr/sensors/airrohr/ which I already have working perfectly.
    I get the following error and a log that I don't understand (I tried with the 2 COM3 and COM4 ports that I can select. On another PC it won't let me load the CH341 drivers...I don't know why, tonight I'll try with another PC, see ....):
    Flash didn't complete due to error [3], please read log file:
    20210209194252.txt
    (or try pressing reset on the unit)
    Start flashing on COM3 (approx 105 seconds).
    _______________________________________________________________
    The log you refer to reads:

    ######2021-02-09######
    #######0.04.007#######
    ######FLASH INFO######
    BIN file: ESP_Easy_mega_20201130_normal_ESP8266_4M1M.bin
    COM port: (COM3) USB-SERIAL CH340 (Port_#0001.Hub_#0001)
    Baud rate: 115200
    ######POST FLASH######
    No post flash information entered...
    ######FLASH LOG######
    [esptool.exe -vv -cd nodemcu -cb 115200 -cp COM3 -ca 0x00000 -cf "C:\Usersersmeteo2DownloadsSpyeasy Meter CO2 Meter CO2 "bin"]
    [09/02/2021 19:42:53] esptool v0.4.12 - (c) 2014 Ch. Klippel
    [09/02/2021 19:42:53] setting board to nodemcu
    [09/02/2021 19:42:53] setting baudrate from 115200 to 115200
    [09/02/2021 19:42:53] setting port from to COM3
    [09/02/2021 19:42:53] setting address from 0x0000000000 to 0x0000000000
    [09/02/2021 19:42:53] espcomm_upload_file
    [09/02/2021 19:42:53] espcomm_upload_mem
    [09/02/2021 19:42:53] error: Failed to open COM3
    [09/02/2021 19:42:53] error: espcomm_open failed
    [09/02/2021 19:42:53] error: espcomm_upload_mem failed
    [2021-02-09 19:42:53] STOPPED due to 3 errors! (try reset on the unit, then start a new flash attempt)

    (I reset a few times with the left button of nodemcu.... but nothing, I get an error and a new log).
    Sorry for the length of the message...once you read it you can delete everything you see unnecessary.
    Thank you and Greetings.

    Reply
    • Hello Llorinte.

      Wow, sorry you are having problems and sorry for your frustration. 😞

      What the log tells you is only that it cannot open the COM3 port.

      Check these points:

      1. Don't you have any other programs that are using COM3?
      2. Make sure that the NodeMCU is really connected to COM3.
      3. Try to run the recording programme as administrator (right click on the icon and "Run as administrator").
      4. Another option is to load the firmware file with the same recording program that you are using with the other project and it doesn't give you any problems.
      5. Uninstall the drivers and install them again.
      6. Make sure you don't have the CO2 sensor (and better yet, no other sensor) connected when flashing.

      Anyway, I suggest you go to the Telegram group: https://t.me/emariete_chat I am sure that together we can find a solution.

      Best regards.

      Reply
  4. I really liked this project!
    Can you also get the sensor readings with a voltmeter? If yes can you explain how and how to convert them to ppm?

    Reply
  5. Hello,

    I know nothing about electronics.

    I just received the Senseair S8 sensor and am waiting for the NodeMCU CP2102 kit that includes a SSD1306 OLED.

    The diagrams above don't show how to build a CO2 detector with those two parts, and how to power them.

    Should I use those:
    OLED VDD → NMCU VIN
    Senseair G+ → NMCU VU
    ?

    Thank you.

    Reply
  6. Hi Mariete,
    thanks for your "bring it on the point" tutorial. Everything works well with a little exception. It is not possible to calibrate the sensor, when I connect the bcal pin to the GND pin. May be I made something wrong. My question is, should I connect both pins during running or should I disconnect the GND pin first before the bcal pin get in touch with the GND pin? And whats about restart the sensor?
    Thanks a lot
    Dirk

    Reply
    • Hi Dirk.

      Please, review the procedure for calibration.

      You should have no problem calibrating the Senseair S8 if you follow the procedure described in "Senseair S8 LP CO2 Sensor Calibration". to the letter (pay attention to details, such as pin connection times and stabilisation).

      You must connect the bCAL and GND pins while the sensor is running (this causes the Senseair S8's internal processor to run a calibration program, so it must be powered on).

      You do not need to reset the Senseair S8 to calibrate it.

      Best regards.

      Reply

Leave a comment