Skip to content

Elixir Circuit Library for Interacting with an ADS1115 or ADS1015 Analog-to-Digital Chip

Notifications You must be signed in to change notification settings

mmmries/ads1115

Folders and files

NameName
Last commit message
Last commit date

Latest commit

7181117 · Feb 2, 2022

History

13 Commits
May 18, 2019
Jan 30, 2022
Jan 30, 2022
May 18, 2019
May 18, 2019
Feb 2, 2022
Feb 2, 2022
Feb 2, 2022

Repository files navigation

ADS1115

An Elixir library for interacting with ADS1115 and ADS1015 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

You can similarly use this library to interact with ADS1015 chips like this:

{:ok, ref} = I2C.open("i2c-1")
addr = 72 # the default i2c address for my sensor
{:ok, reading} = ADS1015.single_shot_read(ref, addr, {:ain0, :gnd})

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.

About

Elixir Circuit Library for Interacting with an ADS1115 or ADS1015 Analog-to-Digital Chip

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages