Share Octave applications - C02 alarm

Hi there,
I’m sharing a simple app to monitor the level of CO2 in the office during the day using mangOH Yellow and Octave. Feel free to try it and comment below!

Prerequisites

Before starting, make sure you already followed the getting started with mangOH Yellow and Octave: https://mangoh.io/mangoh-yellow-resources-getting-started

Octave concepts used

In this application, I’m using the following Octave components:

Implementation

1. Resources

Enable the 2 resources:

  • environment/ambientAirTemp: put a first value here, like 20 (in °C).
  • environment/enable: true
  • imu/temp/enable: true
  • imu/temp/period: 60 (we’ll be reading this value no more than once a minute)

2. Observations



3. Edge Action

 function(event) {
      // Check the CO2 in ambient air   (measured in ppm)
      // Threshold values are based on ANSES recommendations (https://www.anses.fr/fr/system/files/AIR2012sa0093Ra.pdf)
      //
      // LED is turned respectively:
      //        green: ideal conditions: CO2 < 600ppm
      //        blue : OK conditions:    CO2 < 1000ppm
      //        red  : warning:          CO2 > 1000ppm
      // The buzzer is turned respectively:
      //    ON   : critical:         CO2 > 1300ppm
      //        OFF  : not critical:     CO2 < 1300ppm
      var critical = event.value.co2EquivalentValue >= 1300;
      var warning = event.value.co2EquivalentValue >= 1000;
      var ideal = event.value.co2EquivalentValue < 600;
      return {
        "dh://leds/tri/green/enable": [ideal],
        "dh://leds/tri/blue/enable": [!ideal && !warning],
        "dh://leds/tri/red/enable": [warning],
        "dh://buzzer/enable": [critical],
        "dh://buzzer/percent": [critical ? 20 : 3],
        "dh://buzzer/period": [critical ? 2 : 10]
      }
    }

4. Device stream

Now you may receive events if co2 value is more than 1000 thanks to the observation created before.

Does this simple app run well for you? Let me know in the comments! Enhancement proposals are welcome too!

2 Likes

This post was flagged by the community and is temporarily hidden.