CO2 Traffic Light

We have recently written about using the AirGradient PCB with an S8 CO2 sensor as a CO2 traffic light.

You can read the instructions here: https://www.airgradient.com/resources/co2-traffic-light-with-airgradient-diy-sensor/

In case you have any questions or suggestions, please discuss them here.

1 Like

We are also currently working on a larger LED matrix in the CO2 traffic light.

Here is a small preview:

Stay tuned.

1 Like

Nice Idea! Please keep us updated!

We just launched the official built for the CO2 traffic light.

Please let me know your thoughts, questions etc.

Hello, I tried to recreate the co2 traffic light. I don’t use a PCB though. That’s why I connect the cables directly. Unfortunately it doesn’t work yet because the SenseAir S8 doesn’t seem to deliver any values. I found the following entries in the Arduino IDE log file:

C02: CO2 read failed with -3
CO2 read failed with -3
CO2 read failed with -3
CO2 read failed with -3
CO2 read failed with -3
-5

I’m afraid it’s the wiring. Can anyone tell me which pins from the S8 need to be connected to which pins from the D1mini pro?

Incidentally, the wiring with the LED panel obviously worked. It lights up green permanently because no values are coming in from the S8.

I have to do the best I can with the photo from the AirGradient Basic documentation, but I’ve obviously done something wrong.

Can you post some images of your built so that we can look if we see an issue?

The S8 is connected wrongly.

Could you please tell me, what’s wrong? I even tried to change position of the blue und orange wire on D1 mini. But that didn’t work for me too.

I solved the problem myself.

Hey everybody, is there anyone who has integrated the CO2 Traffic Light in Home Assistant?

I tried with ESPhome and this yaml:

esphome:
  name: "co2-traffic-light"
  friendly_name: CO2_traffic_light

esp8266:
  board: d1_mini_pro

# Enable logging
logger:

# Enable Home Assistant API
api:
  encryption:
    key: "myKey"

ota:


wifi:
  ssid: !secret wifi_ssid
  password: !secret wifi_password

  # Enable fallback hotspot (captive portal) in case wifi connection fails
  ap:
    ssid: "myssid2"
    password: "mypassword2"

captive_portal:

# Define NeoPixelBus Light
light:
  - platform: neopixelbus
    type: GRB
    variant: WS2812
    pin: D8
    num_leds: 64
    name: "neopixel_square"
    id: neopixel_square
#    internal: true



uart:
    
  - rx_pin: D4
    tx_pin: D3
    baud_rate: 9600
    id: uart2
      


# Define sensor for CO2 measurement
sensor:
  - platform: senseair
    uart_id: uart2
    co2:
      id: co2
      name: "SenseAir CO2 Value"
    update_interval: 60s

My first result:

  1. S8 works fine and data is shown in HA
  2. Light named “Neopixel Square” is shown up in HA but if I try to turn it on nothing happens.

I would like to create an NodeRed workflow by reading data from S8 sensor and then turning on the neopiexel in different colors depending on S8 data.

Anyone an idea how to light up the neopixel square?

I realize this post is a few months old, so maybe you resolved the issue already. But just in case…

Your code worked for me–the light matrix shows up in HA and can be turned on/off and color changed. So it’s not a code issue. Maybe check your wiring (e.g. are you connecting to the DIN on the square rather than the DOUT)? Or it could be defective hardware?

For others who find this post in the future, I wrote some code to change the light’s color (green, orange, or red) based on the CO2 level. Works great:

captive_portal:

light:
  - platform: neopixelbus
    variant: WS2812
    pin: D8
    num_leds: 64
    type: GRB
    id: neopixel_light
    name: "NeoPixel Light"
    color_correct: [25%, 25%, 25%]

uart:
  - rx_pin: D4
    tx_pin: D3
    baud_rate: 9600
    id: uart_2
      
# Define sensor for CO2 measurement
sensor:
  - platform: senseair
    uart_id: uart_2
    co2:
      id: co2
      name: "SenseAir CO2 Value"
    update_interval: 60s

# Set light color based on CO2 reading
interval:
  - interval: 60sec
    then:
      - light.control: 
            id: neopixel_light
            red: !lambda |
              if ((id(co2).state) > 800) {
                return 1;
              } else {
                return 0;
              }
            green: !lambda |
              if ((id(co2).state) > 1000) {
                return 0;
              } else if ((id(co2).state) > 800) {
                return 0.65;
              } else {
                return 1;
              }
            blue: 0

Hello,
It seems the link to the 8x8 LED Matrix doesn’t work anymore.
Can someone confirm which model I should buy ?
I have the DIY Pro (pre-soldered), will this LED matrix fit the enclosure ?
Thanks a lot in advance,