https://github.com/efesto/ccs811
Driver for CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality
https://github.com/efesto/ccs811
elixir i2c-sensors nerves
Last synced: 6 months ago
JSON representation
Driver for CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality
- Host: GitHub
- URL: https://github.com/efesto/ccs811
- Owner: Efesto
- License: apache-2.0
- Created: 2021-01-03T14:23:22.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-12-11T15:05:37.000Z (almost 2 years ago)
- Last Synced: 2025-03-24T18:12:57.265Z (7 months ago)
- Topics: elixir, i2c-sensors, nerves
- Language: Elixir
- Homepage:
- Size: 49.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ccs811

[](https://hex.pm/packages/ccs811)
[](https://hexdocs.pm/ccs811/)Driver for CCS811 Ultra-Low Power Digital Gas Sensor for Monitoring Indoor Air Quality
[Datasheet](https://cdn.sparkfun.com/assets/learn_tutorials/1/4/3/CCS811_Datasheet-DS000459.pdf)
## Installation
The package can be installed by adding `ccs811` to your list of dependencies in `mix.exs`:
```elixir
def deps do
[
{:ccs811, "~> 0.3.0"}
]
end
```## Usage
### Standalone
```elixir
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
```elixir
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()`](https://hexdocs.pm/ccs811/Ccs811.html#initialize/1) and [`Ccs811.initialize()`](https://hexdocs.pm/ccs811/Ccs811.html#initialize/1) 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)