ads1115

Interact with ADS1115 or ADS1015 Analog-to-Digital Chips


Keywords
a2d, analog-to-digital-converter, elixir, elixir-circuits, embedded, nerves
License
MIT

Documentation

ADS1115

An Elixir library for interacting with ADS1115 analog-to-digital chips. Please see the datasheet for details.

Usage

I'm using these chips to read moisture sensors. I wired the analog signal to AIN0 and I want to compare that to GND. For this use-case I can do the following:

{:ok, ref} = I2C.open("i2c-1")
addr = 72 # the default i2c address for my sensor
{:ok, reading} = ADS1115.single_shot_read(ref, addr, {:ain0, :gnd})
# reading will be between -32,768 and 32,767

Installation

If available in Hex, the package can be installed by adding ads1115 to your list of dependencies in mix.exs:

def deps do
  [
    {:ads1115, "~> 0.1"}
  ]
end

Documentation can be generated with ExDoc and published on HexDocs. Once published, the docs can be found at https://hexdocs.pm/ads1115.