Arduino library for the Texas Instruments ADS7828 12-bit, 8-channel I2C A/D converter
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
doc
examples Fix #17 remove extraneous #includes/whitespace Sep 27, 2016
extras
src Version bump to v2.0.2 Sep 27, 2016
.gitignore
.ruby-gemset Pin ruby version to 2.3.1 Sep 26, 2016
.ruby-version
.travis.yml Fix #1 add continuous integration testing Sep 26, 2016
CHANGELOG.md Version bump to v2.0.2 Sep 27, 2016
CODE_OF_CONDUCT.md Fix #15 add Code of Conduct Sep 27, 2016
LICENSE
Makefile
README.md Fix #25 Add README badge for CoC Sep 27, 2016
Rakefile Remove extraneous whitespace from Rakefile Sep 27, 2016
SCHEMATIC
VERSION
keywords.txt
library.properties

README.md

i2c_adc_ads7828

GitHub release Travis license code of conduct

Overview

This is an Arduino library for the Texas Instruments ADS7828 12-bit, 8-channel I2C A/D converter.

Features

The following features are available:

  • Up to (4) A/D converters can be used on the same I2C bus (hardware-addressable via pins A0, A1 and software-addressable via ID 0..3; address 0x48..0x4C)
  • A/D conversions may be initiated on a bus-, device-, or channel-specific level
  • Retrieve values as 16-period moving average or last sample
  • Built-in scaling function to return values in user-defined engineering units

Installation

Library Manager

Install the library into your Arduino IDE using the Library Manager (available from IDE version 1.6.2). Open the IDE and click Sketch > Include Library > Manage Libraries…

Scroll or search for i2c_adc_ads7828, then select the version of the library you want to install. Quit/re-launch the IDE to refresh the list; new versions are automatically added to the list, once released on GitHub.

Refer to Arduino Tutorials > Libraries Using the Library Manager.

Zip Library

Refer to Arduino Tutorials > Libraries Importing a .zip Library.

Manual

Refer to Arduino Tutorials > Libraries Manual Installation.

Schematic

This library has been tested with an Arduino Duemilanove and a Texas Instruments ADS7828 A/D converter.

Below is a simplified schematic diagram. Refer to the datasheet for specific requirements.

                               Arduino
                              .--------------------.
                              |Duemilanove         |
                              |                    |
   TI ADS7828        .-------o|5V                  |
  .--------------.   |        |                    |
-o|1 CH0   VDD 16|o--'   .---o|GND                 |
  |              |       |    |                    |
-o|2 CH1   SDA 15|o------)---o|A4 SDA              |
  |              |       |    |                    |
-o|3 CH2   SCL 14|o------)---o|A5 SCL              |
  |              |       |    '--------------------'
-o|4 CH3    A1 13|o------o
  |              |       |
-o|5 CH4    A0 12|o------o
  |              |       |
-o|6 CH5   COM 11|o-     |
  |              |       |
-o|7 CH6   REF 10|o-     |
  |              |       |
-o|8 CH7   GND  9|o------o
  '--------------'       |
                         |
                        ===
                        GND

Example

The library contains sketches that demonstrates use of the i2c_adc_ads7828 library. You can find these in the examples folder.

#include <i2c_adc_ads7828.h>


// device 0
// Address: A1=0, A0=0
// Command: SD=1, PD1=1, PD0=1
ADS7828 device(0, SINGLE_ENDED | REFERENCE_ON | ADC_ON, 0x0F);
ADS7828* adc = &device;
ADS7828Channel* ambientTemp = adc->channel(0);
ADS7828Channel* waterTemp = adc->channel(1);
ADS7828Channel* filterPressure = adc->channel(2);
ADS7828Channel* waterLevel = adc->channel(3);


void setup()
{
  // enable serial monitor
  Serial.begin(19200);

  // enable I2C communication
  ADS7828::begin();

  // adjust scaling on an individual channel basis
  ambientTemp->minScale = 0;
  ambientTemp->maxScale = 150;

  waterTemp->minScale = 0;
  waterTemp->maxScale = 100;

  filterPressure->minScale = 0;
  filterPressure->maxScale = 30;

  waterLevel->minScale = 0;
  waterLevel->maxScale = 100;
}


void loop()
{
  // update all registered ADS7828 devices/unmasked channels
  ADS7828::updateAll();

  // output moving average values to console
  Serial.print("\n Ambient: ");
  Serial.print(ambientTemp->value(), DEC);
  Serial.print("\n Water temp: ");
  Serial.print(waterTemp->value(), DEC);
  Serial.print("\n Filter pressure: ");
  Serial.print(filterPressure->value(), DEC);
  Serial.print("\n Water level: ");
  Serial.print(waterLevel->value(), DEC);
  Serial.print("\n- - - - - - - - - - - - - - - - - - - - \n");

  // delay
  delay(1000);
}

Caveats

Conforms to Arduino IDE 1.5 Library Specification v2.1 which requires Arduino IDE >= 1.5.

Support

Please submit an issue for all questions, bug reports, and feature requests. Email requests will be politely redirected to the issue tracker so others may contribute to the discussion and requestors get a more timely response.

License & Authors

Copyright:: 2009-2016 Doc Walker

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.