Skip to content
/ ccs811 Public

Driver for CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality

License

Notifications You must be signed in to change notification settings

Efesto/ccs811

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

39 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Ccs811

Elixir CI Hex pm Hexdocs.pm

Driver for CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality

Datasheet

Installation

The package can be installed by adding ccs811 to your list of dependencies in mix.exs:

def deps do
  [
    {:ccs811, "~> 0.3.0"}
  ]
end

Usage

Standalone

iex(1)> Ccs811.initialize
iex(2)> Ccs811.read_alg_result_data
%{
  eco2: 1529,
  error_id: %{
    heater_fault: false,
    heater_supply: false,
    max_resistance: false,
    measmode_invalid: false,
    red_reg_invalid: false,
    write_reg_invalid: false
  },
  status: %{app_valid: true, data_ready: true, error: false, fw_mode: true},
  tvoc: 191
}
iex(23)> Ccs811.read_status
%{app_valid: true, data_ready: true, error: false, fw_mode: true}

With Telemetry

Add to your application initialization

  Ccs811.start_polling()

Which will set the driver to periodically execute a telemetry event named [:ccs811, :read] with a new data map containing values for eCO2 :eco2 and TVOC tvoc

Initialization

both Ccs811.start_polling() and Ccs811.initialize() supports additional configuration parameters that can be passed as a keyword list

Missing features

  • Interrupt based data reading instead of polling
  • Configuration for Bus-name (currently it uses the first available I2C bus)

About

Driver for CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality

Topics

Resources

License

Stars

Watchers

Forks

Languages