{"id":20989824,"url":"https://github.com/robtillaart/ltc2991","last_synced_at":"2026-01-17T18:10:37.914Z","repository":{"id":45329899,"uuid":"366112729","full_name":"RobTillaart/LTC2991","owner":"RobTillaart","description":"Arduino library for the Octal I2C Voltage, Current, and Temperature Monitor","archived":false,"fork":false,"pushed_at":"2024-04-13T09:05:35.000Z","size":50,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-07T18:27:20.549Z","etag":null,"topics":["arduino","current","sensor","temperature","voltage"],"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/RobTillaart.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"RobTillaart"}},"created_at":"2021-05-10T16:48:36.000Z","updated_at":"2023-10-13T20:18:00.000Z","dependencies_parsed_at":"2024-01-04T11:23:17.031Z","dependency_job_id":"723d1fe2-4bcc-4b56-a8f8-54946ebc9671","html_url":"https://github.com/RobTillaart/LTC2991","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FLTC2991","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FLTC2991/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FLTC2991/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RobTillaart%2FLTC2991/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RobTillaart","download_url":"https://codeload.github.com/RobTillaart/LTC2991/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225305681,"owners_count":17453429,"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":["arduino","current","sensor","temperature","voltage"],"created_at":"2024-11-19T06:26:20.994Z","updated_at":"2026-01-17T18:10:37.895Z","avatar_url":"https://github.com/RobTillaart.png","language":"C++","funding_links":["https://github.com/sponsors/RobTillaart"],"categories":[],"sub_categories":[],"readme":"\n[![Arduino CI](https://github.com/RobTillaart/LTC2991/workflows/Arduino%20CI/badge.svg)](https://github.com/marketplace/actions/arduino_ci)\n[![Arduino-lint](https://github.com/RobTillaart/LTC2991/actions/workflows/arduino-lint.yml/badge.svg)](https://github.com/RobTillaart/LTC2991/actions/workflows/arduino-lint.yml)\n[![JSON check](https://github.com/RobTillaart/LTC2991/actions/workflows/jsoncheck.yml/badge.svg)](https://github.com/RobTillaart/LTC2991/actions/workflows/jsoncheck.yml)\n[![GitHub issues](https://img.shields.io/github/issues/RobTillaart/LTC2991.svg)](https://github.com/RobTillaart/LTC2991/issues)\n\n[![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://github.com/RobTillaart/LTC2991/blob/master/LICENSE)\n[![GitHub release](https://img.shields.io/github/release/RobTillaart/LTC2991.svg?maxAge=3600)](https://github.com/RobTillaart/LTC2991/releases)\n[![PlatformIO Registry](https://badges.registry.platformio.org/packages/robtillaart/library/LTC2991.svg)](https://registry.platformio.org/libraries/robtillaart/LTC2991)\n\n\n# LTC2991\n\nArduino library for an LTC2991 temperature and voltage control IC.\n\n\n## Description\n\n**Experimental**\n\nLTC2991 is an experimental library for the LTC2991 IC which is typically used\nto monitor temperature and voltage. It also has a PWM out to control e.g. a fan.\n\nThe IC supports normal voltage measurement (8 lines), differential voltage\nmeasurements (4 pairs) and temperature measurements (4 pairs).\nThese can be combined in a mix.\nAs the IC has only 8 inputs available one has to choose what.\n\nRead the datasheet for the details.\n\nThe library is not tested by myself, (no hardware).\n\nFeedback as always is welcome.\n\n\n### Breaking change 0.3.0\n\nIn issue #14 it was reported that the negative values were not correct.\nThis is fixed in 0.3.0.\n\nAll pre-0.3.0 versions are obsolete now and should not be used.\n\n\n### Address\n\nFrom datasheet - table 1\n\nThe address template is   0  1  0  0  - 1 A2 A1 A0  ==\u003e  0x48 if all address pins are grounded,\n\n|  ADR0  |  ADR1  |  ADR2  |  address  |\n|:------:|:------:|:------:|:---------:|\n|   0    |    0   |    0   |    0x48   |\n|   1    |    0   |    0   |    0x49   |\n|   0    |    1   |    0   |    0x4A   |\n|   1    |    1   |    0   |    0x4B   |\n|   0    |    0   |    1   |    0x4C   |\n|   1    |    0   |    1   |    0x4D   |\n|   0    |    1   |    1   |    0x4E   |\n|   1    |    1   |    1   |    0x4F   |\n\n\n### Related\n\n- https://github.com/RobTillaart/LTC2991\n- https://github.com/RobTillaart/temperature converters\n\n\n## Interface\n\n```cpp\n#include \"LTC2991.h\"\n```\n\n### Constructor and setup\n\n- **LTC2991(const uint8_t address, TwoWire \\*wire = Wire)**\nThe address is 0x48..0x4F depending on the address pins.\nThe library does not check the range.\n- **bool begin()** UNO ea. initializes the class.\nReturns true if the LTC2991 address is on the I2C bus.  \nNote: do call **Wire.begin()** before **begin()**\n- **bool isConnected()** Returns true if the LTC2991 address is on the I2C bus.\n- **uint8_t getAddress()** Returns the address set in the constructor.\n\n\n### Status functions\n\n- **bool new_data(uint8_t channel)** true if there is a new **external** measurement available.\nThis can be a voltage or a temperature measurement.\n- **bool new_temperature()** true if there is a new **internal** temperature measurement available.\n- **bool new_voltage()** true, if there is a new **internal** voltage measurement available.\n- **bool is_busy()** true if the sensor is converting...\n\n\n### External measurements\n\nThe following functions work on pairs:  \nNote these functions do not use a zero based index.\n\n|  n  |   selected   |\n|:---:|:------------:|\n|  1  |  V1  V2  T1  |\n|  2  |  V3  V4  T2  |\n|  3  |  V5  V6  T3  |\n|  4  |  V7  V8  T4  |\n\n- **void trigger_conversion(uint8_t n)** wrapper around enable(n, true), better naming.\n- **void trigger_conversion_all()** triggers conversions for all 4 channels/pairs.\n- **void enable(uint8_t n, bool enable)** enable or disable an external line.\ndisable can be used to stop the repeat mode.\n- **bool is_enabled(uint8_t n)** idem\n- **void enable_filter(uint8_t n, bool enable)** enable filter - not investigated.\n- **bool is_enabled_filter(uint8_t n)** idem.\n\n#### Temperature scale\n\n- **void set_Kelvin(uint8_t n)** sets temperature mode to Kelvin,\nimplicit set_mode_temperature().\n- **void set_Celsius(uint8_t n)** sets temperature mode to Celsius,\nimplicit set_mode_temperature.\n- **void set_temp_scale(uint8_t n, bool Kelvin = true)** used to switch between Kelvin and Celsius.\n- **char get_temp_scale(uint8_t n)** returns 'K' or 'C'.\n\n#### Mode\n\n- **void set_mode_temperature(uint8_t n)** sets operational mode.\n- **void set_mode_voltage_differential(uint8_t n)** sets operational mode.\n- **void set_mode_voltage_normal(uint8_t n)** sets operational mode.\n- **uint8_t get_operational_mode(uint8_t n)** returns operational mode.\n- **uint8_t get_differential_mode(uint8_t n)** returns differential flag.\n\n#### GetValue\n\n- **float get_value(uint8_t channel)** channel = 1..8;\ndepending on the operational mode it returns the temperature or the\n(differential) voltage.\n\n\n### Internal measurements\n\n- **void enable_Tintern_Vcc(bool enable)** enable internal temperature measurements.\n- **bool is_enabled_Tintern_Vcc()** idem.\n- **void enable_filter_Tintern(bool enable)** enable filter - not investigated\n- **bool is_enabled_filter_Tintern()** idem.\n- **void set_Kelvin_Tintern()** use Kelvin.\n- **void set_Celsius_Tintern()** use Celsius.\n- **void set_temp_scale_Tintern(bool Kelvin = true)** Obsolete?.\n- **char get_temp_scale_Tintern()** returns 'K' or 'C'.\n- **float get_Tintern()** returns the internal temperature.\n- **float get_VCC()** returns the internal voltage.\n\n\n### Configuration\n\n- **void set_acquisition_repeat()** set continuous measurement mode.\n- **void set_acquisition_single()** set single shot mode.\nNote that before a measurement is made one needs to call **trigger_conversion(n)**\nor **trigger_conversion_all()**.\n- **uint8_t get_acquisition_mode()** return mode set (0,1).\n  - 1 = repeat\n  - 0 = single\n\n\n### PWM functions\n\n- **void set_PWM(uint16_t value = 0)** value is 0..511.\n- **void set_PWM_fast(uint16_t value = 0)** value is 0..511, less resolution (256 steps).\n- **uint16_t get_PWM()** returns the value from the PWM register, when using PWM_fast this can differ 1.\n- **void invert_PWM(bool invert)** idem.\n- **bool is_inverted_PWM()** idem.\n- **void enable_PWM(bool enable)** idem.\n- **bool is_enabled_PWM()** idem.\n\n\n### Performance\n\nNo data available yet.\nTo be measured when hardware is available...\nIf you happen to have performance figures, please share them in an issue.\n\n\n## Future\n\n#### Must\n\n- get hardware to test\n- improve documentation (a lot)\n\n\n#### Should\n\n- error handling\n- unit tests if possible?\n- remove magic numbers / masks from code\n  - some defines prepared in CPP file =\u003e to .h\n\n\n#### Could\n\n- cache registers (which) or ?\n- cache a number of flags to speed up retrieving data\n- optimizations\n  - code / math\n  - optimize multi-byte read / write\n- **void disable_PWM()** convenience, \n- **enable_PWM(bool)** default true flag\n- **void LTC2991::enable(uint8_t mask)** faster to set multiple.\n- add Current functions (page 14 data sheet)\n\n\n#### Wont\n\n- redo naming of some functions?\n  - first get hands on experience.\n- add Fahrenheit\n  - do low level in Kelvin and convert to KFC as needed.\n  - would simplify get_value\n  - need an enum\n  - would interface # functions increase too much?\n  - == \u003e Users can do this conversion.\n\n\n## Support\n\nIf you appreciate my libraries, you can support the development and maintenance.\nImprove the quality of the libraries by providing issues and Pull Requests, or\ndonate through PayPal or GitHub sponsors.\n\nThank you,\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Fltc2991","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobtillaart%2Fltc2991","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobtillaart%2Fltc2991/lists"}