GithubHelp home page GithubHelp logo

Comments (5)

maarten-pennings avatar maarten-pennings commented on September 26, 2024

The raw calculation is explained in the datasheet but you have to know what they say. Here is the explaining fragment:

RAW_DATA Register (0x03)
Two byte read only register which contains the latest readings from the sensor. The most significant 6 bits of the Byte 0 contain the value of the current through the sensor (0μA to 63μA). The lower 10 bits contain (as computed from the ADC) the readings of the voltage across the sensor with the selected current (1023 = 1.65V).

One thing they don't tell you is that you want the resistance, which is R= V/I. Also implicit is that V scales linearly: 0..1023 ~ 0..1.65V

from ccs811.

maarten-pennings avatar maarten-pennings commented on September 26, 2024

Could you explain how I should change the lib to support both wires on the esp32?

from ccs811.

ullix avatar ullix commented on September 26, 2024

I suggest to refer to e.g. this lib: https://github.com/adafruit/Adafruit_BME280_Library , where this dual option is used.

And note that in the Wire lib you find this in Wire.cpp:

    TwoWire::TwoWire(uint8_t bus_num)
        :num(bus_num & 1)
    ...
        
    TwoWire Wire = TwoWire(0);
    TwoWire Wire1 = TwoWire(1);

So, only 2 bus numbers are supported, 0 and 1, and they can be called as Wire and Wire1.

In the Adafruit_BME280.h header file you find the overloaded begin definitions:

      bool begin();
      bool begin(TwoWire *theWire);
      bool begin(uint8_t addr);
      bool begin(uint8_t addr, TwoWire *theWire);       

In my sketch I then start this lib with:

        // setting Wire1 to pins sda, scl
        Wire1.begin(sda, scl);
       ...
        #define BME280_ADDRESS      (0x76) 
        ...
        // Initializing Sensor BME280
        bool status = bme.begin(BME280_ADDRESS, &Wire1);
        if (!status) {
        ...

I use Wire1 for time critical readings of sensors on a separate task, and Wire for devices that allow a more leisurely pace in the main loop task. Works well on all ESP32s that I have used (ESP32-WROOM, -WROVER, -PICO).

Your lib has now mastered an overnight run, and all went as expected. (Though the data remain puzzling :-/)

from ccs811.

ullix avatar ullix commented on September 26, 2024

OK, found the quoted fragment, thanks. The public code goes up to calculating the mox resistance, and ends there. The calculation of eco2 and tvoc seems confidential and hidden in the firmware. The firmware is not disclosed, just this binary blob is available?

This is a similar approach to what Bosch is doing with their sensor BME680. The public code goes up to resistance. For their much PRed "air quality number" you need to register with name, address, ... so that you can download a binary blob fitting to the CPU you are using. It still gives you a single number only; I have not seen any published data supporting their claims. Too bad.

For the CCS811 I find it particular strange, that from one single variable - resistance - you calculate two variables, which are correlated to a degree, but also widely different, and are claimed to be two different things.

I am having some doubts!

from ccs811.

maarten-pennings avatar maarten-pennings commented on September 26, 2024

The CCS811 is a so-called MOX sensor. This class of sensors has a chemical reaction with the gases (an oxidation/reduction). But not all gasses react with the sensors. Most "Volatile organic compounds" react. This is the TVOC reading. My guess: the firmware controls the current through the MOX paste, and measures the voltage (ADC). Then computes the MOX resistance, and that is an indication for VOC concentration.

But the sensor is insensitive for CO2. The trick is that the CO2 reading assumes the sensor is inside a building (iAQ - indoor air quality), and that humans are the (only) producer of CO2. So the gas sensor measures VOCs, assumes they are from humans, maps that to the amount of humans, and then maps that to the CO2 they would produce.

from ccs811.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.