Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add C02 Sensor as sensor 2 (C02 Ampel) // how to include a custom sensor #780

Closed
wants to merge 1 commit into from

Conversation

hansju-11
Copy link

As an example of "how to include a custom sensor" I will use an scd30 C02 sensor
https://github.com/sparkfun/SparkFun_SCD30_Arduino_Library
https://www.sensirion.com/de/umweltsensoren/kohlendioxidsensor/kohlendioxidsensoren-scd30/
https://www.sparkfun.com/products/15112

sensor is in parallel to the dispaly on i2c bus with address 0x61

  • in sensor.cpp

    • include scd30-master lib from sparkFun
    • in function void sensor_init(void) put one time inti code
    • in function uint8_t *sensor_read(uint8_t sensor) -> case 2: read our sensor
  • in payload.cpp
    -include sensor.h

  • in paxcounter.conf (define are still in use in some other parts of the code)

    • #define HAS_SENSOR_1 1
    • #define HAS_SENSOR_2 1
    • #define HAS_SENSOR_3 0
  • change js parser

    • I use payload encoder: 2=Packed
      if (port === 11) {
      // scd30 sensor data
      return decode(bytes, [uint16, ufloat, ufloat], ['C02', 'temp', 'humidity']);
      }
      return decoded;
      */

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant