mh-z14 co2 Sensor/Relay

Hey guys! Newbie here :slight_smile:

I’m trying to create a program to control air quality.

I use this tutorial: Link

It works so far.

Now, I want to install a relay. It should switch pin2 at 700ppm. (co2 unit)

I tried it with the function:

void loop() 
if (ppm > 700);
digitalWrite(2, HIGH);

But it does not switch…

What am I not doing right?

User’s manual

Many thanks in advance for any suggestion.


Thanks, but it still does not work.

Did I use the right unit? In the manual is written: Output signal: PWM, UART. The arduino translates it. But also no relay switch.