{"id":26539758,"url":"https://github.com/styropyr0/ads111s","last_synced_at":"2025-07-06T22:33:32.472Z","repository":{"id":282699289,"uuid":"949391948","full_name":"styropyr0/ADS111S","owner":"styropyr0","description":"A library for interacting with the ADS111x series 16-bit ADCs over I2C.","archived":false,"fork":false,"pushed_at":"2025-03-25T17:56:14.000Z","size":9,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T18:37:50.990Z","etag":null,"topics":["adc","ads1113","ads1114","ads1115","arduino","arduino-ide","arduino-ide-library","arduino-library","esp32","esp32-library","i2c","sensor-inputs","sensor-library"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/styropyr0.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-16T11:04:24.000Z","updated_at":"2025-03-25T17:46:15.000Z","dependencies_parsed_at":"2025-03-16T12:21:29.360Z","dependency_job_id":"3eeb2680-0cac-427e-95ac-add00182cda6","html_url":"https://github.com/styropyr0/ADS111S","commit_stats":null,"previous_names":["styropyr0/ads111s"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/styropyr0/ADS111S","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FADS111S","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FADS111S/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FADS111S/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FADS111S/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/styropyr0","download_url":"https://codeload.github.com/styropyr0/ADS111S/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/styropyr0%2FADS111S/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263983749,"owners_count":23539570,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["adc","ads1113","ads1114","ads1115","arduino","arduino-ide","arduino-ide-library","arduino-library","esp32","esp32-library","i2c","sensor-inputs","sensor-library"],"created_at":"2025-03-22T00:18:51.008Z","updated_at":"2025-07-06T22:33:32.466Z","avatar_url":"https://github.com/styropyr0.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ADS111S Arduino Library\n\nThe **ADS111S** library provides an easy-to-use interface for interacting with the ADS111x series 16-bit Analog-to-Digital Converters (ADCs) over I2C. This library supports single-ended and differential analog input readings, configurable gain, data rate, operating mode, and comparator settings. It is designed to work seamlessly with the Arduino platform.\n\nSupported ADC modules: ADS1115, ADS1114, ADS1113\n\n## Features\n- Read single-ended or differential analog inputs.\n- Configure programmable gain amplifier (PGA) settings (e.g., 6.144V, 4.096V, etc.).\n- Set data rates from 8 SPS to 860 SPS.\n- Control operating modes (continuous or single-shot).\n- Configure the built-in comparator with threshold values, polarity, and latching options.\n- Check sensor connectivity over I2C.\n\n## Installation\n\n### Using the Arduino Library Manager\n1. Open the Arduino IDE.\n2. Go to **Sketch \u003e Include Library \u003e Manage Libraries**.\n3. Search for `ADS111S`.\n4. Click **Install** to download and install the library.\n\n### Manual Installation\n1. Download the latest release of this repository as a ZIP file.\n2. In the Arduino IDE, go to **Sketch \u003e Include Library \u003e Add .ZIP Library**.\n3. Select the downloaded ZIP file and click **Open**.\n4. The library will be installed and ready to use.\n\n### Dependencies\n- **Arduino.h**: Core Arduino library (included with the Arduino IDE).\n- **SensorHub.h**: A custom library for I2C communication (ensure it’s installed or included in your project).\n\n## Usage\n\n### Basic Example\n```cpp\n#include \u003cADS111S.h\u003e\n\nADS111S adc; // Create an ADS111S object with default configuration\n\nvoid setup() {\n  Serial.begin(115200);\n  \n  // Initialize the ADC\n  if (!adc.begin()) {\n    Serial.println(\"Failed to detect ADS111S ADC!\");\n    while (1);\n  }\n  \n  Serial.println(\"ADS111S ADC initialized successfully.\");\n}\n\nvoid loop() {\n  // Read single-ended analog input from pin A0\n  uint16_t value = adc.readFrom(0);\n  Serial.print(\"Analog Value (A0): \");\n  Serial.println(value);\n  \n  delay(1000); // Wait 1 second\n}\n```\n\n### Custom Configuration Example\n```cpp\n#include \u003cADS111S.h\u003e\n\nADS111SCONFIG config = {\n  .OS = ADS111S_OS_START_SINGLE,        // Single-shot mode\n  .PGA = ADS111S_PGA_2_048V,            // Gain of 2.048V\n  .MODE = ADS111S_MODE_SINGLE,          // Single-shot mode\n  .DR = ADS111S_DR_128SPS,              // 128 samples per second\n  .COMP_MODE = ADS111S_COMP_MODE_TRADITIONAL, // Traditional comparator\n  .COMP_POL = ADS111S_COMP_POL_ACTIVE_LOW,    // Active-low polarity\n  .COMP_LAT = ADS111S_COMP_LAT_NON_LATCHING,  // Non-latching\n  .COMP_QUE = ADS111S_COMP_QUE_DISABLE        // Disable comparator queue\n};\n\nADS111S adc; // Create an ADS111S object\n\nvoid setup() {\n  Serial.begin(115200);\n  \n  if (!adc.begin(config)) {\n    Serial.println(\"Failed to detect ADS111S ADC!\");\n    while (1);\n  }\n  \n  Serial.println(\"ADS111S ADC initialized with custom config.\");\n}\n\nvoid loop() {\n  // Read differential input between A0 and A1\n  uint16_t diffValue = adc.readFromDifferential(0);\n  Serial.print(\"Differential Value (A0-A1): \");\n  Serial.println(diffValue);\n  \n  delay(1000);\n}\n```\n\n## API Reference\n\n### Constructor\n- `ADS111S()`: Creates an ADS111S object with default configuration.\n- `ADS111S(ADS111SCONFIG config)`: Creates an ADS111S object with a custom configuration.\n\n### Methods\n- `bool begin()`: Initializes the ADC with the default configuration. Returns `true` if successful.\n- `bool begin(ADS111SCONFIG config)`: Initializes the ADC with a custom configuration. Returns `true` if successful.\n- `uint16_t readFrom(uint8_t pin)`: Reads a single-ended analog input from the specified pin (0-3).\n- `uint16_t readFromDifferential(uint8_t pin)`: Reads a differential analog input from the specified pin pair (0-3).\n- `bool isConnected()`: Checks if the ADC is detected over I2C.\n- `void setDataRate(uint8_t dataRate)`: Sets the data rate (e.g., `ADS111S_DR_128SPS`).\n- `void setGain(uint8_t gain)`: Sets the PGA gain (e.g., `ADS111S_PGA_2_048V`).\n- `void setMode(uint8_t mode)`: Sets the operating mode (e.g., `ADS111S_MODE_SINGLE`).\n- `void setComparatorMode(bool mode)`: Sets the comparator mode (traditional or window).\n- `void setComparatorPolarity(bool polarity)`: Sets the comparator polarity (active-low or active-high).\n- `void setComparatorLatching(bool latching)`: Enables or disables comparator latching.\n- `void setComparatorQueue(uint8_t queue)`: Sets the comparator queue behavior.\n- `void setThreshold(uint16_t low, uint16_t high)`: Sets the low and high threshold values for the comparator.\n- `float getVoltageGainInUse()`: Returns the current voltage gain in use.\n\n### Configuration Structure\nThe `ADS111SCONFIG` struct allows customization of the ADC settings:\n- `OS`: Operational status (e.g., `ADS111S_OS_START_SINGLE`).\n- `PGA`: Programmable gain amplifier setting (e.g., `ADS111S_PGA_2_048V`).\n- `MODE`: Operating mode (e.g., `ADS111S_MODE_SINGLE`).\n- `DR`: Data rate (e.g., `ADS111S_DR_128SPS`).\n- `COMP_MODE`: Comparator mode (e.g., `ADS111S_COMP_MODE_TRADITIONAL`).\n- `COMP_POL`: Comparator polarity (e.g., `ADS111S_COMP_POL_ACTIVE_LOW`).\n- `COMP_LAT`: Comparator latching (e.g., `ADS111S_COMP_LAT_NON_LATCHING`).\n- `COMP_QUE`: Comparator queue (e.g., `ADS111S_COMP_QUE_DISABLE`).\n\n### Predefined Constants\nConstants for configuration are defined in `ADS111SDEFS.h`. Examples include:\n- Gain options: `ADS111S_PGA_6_144V`, `ADS111S_PGA_4_096V`, etc.\n- Data rates: `ADS111S_DR_8SPS`, `ADS111S_DR_860SPS`, etc.\n- I2C address: `ADS111S_I2C_ADDR` (default: `0x48`).\n\n## Hardware Requirements\n- Compatible with ADS111x series ADCs (supported ADCs are ADS1113, ADS1114, ADS1115).\n- I2C interface (connect SDA and SCL to your Arduino’s I2C pins).\n- Power supply: 2.0V to 5.5V (check your specific ADS111x model).\n\n## License\nThis library is released under the [MIT License](LICENSE). Feel free to use, modify, and distribute it as needed.\n\n## Author\n- **Saurav Sajeev**\n\n## Contributing\nContributions are welcome! Please submit a pull request or open an issue on the [GitHub repository](https://github.com/styropyr0/ADS111S) for suggestions, bug reports, or improvements.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyropyr0%2Fads111s","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstyropyr0%2Fads111s","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstyropyr0%2Fads111s/lists"}