sgp30

Interface with SGP30 gas sensor with elixir.

For more info on the sensor, see the datasheet.

Currently tested with the Adafruit breakout board, but others should work as well.

Installation

def deps do
{:sgp30, "~> 0.1"}
end

Usage

According to the datasheet, the sensor must be initialized and the caller must start a measurement every second. Sgp30 handles this for you once initialized it will take a measurement every second and you would simply call Sgp30.state to get the most current results.

iex()> {:ok, sgp} = Sgp30.start_link()
iex()> Sgp30.state
%Sgp30{
address: 88,
eco2: 421,
ethenol_raw: 17934,
h2_raw: 13113,
i2c: #Reference<0.7390235.92137012.02842>,
serial: <<0, 0, 0, 253, 127, 15>>,
tvoc: 17
}

TODO