{"id":13802276,"url":"https://github.com/robert-hh/ADS7818","last_synced_at":"2025-05-13T13:30:25.699Z","repository":{"id":82726440,"uuid":"149987439","full_name":"robert-hh/ADS7818","owner":"robert-hh","description":"Python class interfacing the ADS7818 AD-converter","archived":false,"fork":false,"pushed_at":"2019-01-01T11:08:08.000Z","size":7,"stargazers_count":0,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-04-22T12:34:42.371Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/robert-hh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2018-09-23T13:34:01.000Z","updated_at":"2019-01-01T11:08:09.000Z","dependencies_parsed_at":"2023-03-22T16:32:25.472Z","dependency_job_id":null,"html_url":"https://github.com/robert-hh/ADS7818","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FADS7818","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FADS7818/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FADS7818/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/robert-hh%2FADS7818/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/robert-hh","download_url":"https://codeload.github.com/robert-hh/ADS7818/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253949901,"owners_count":21989269,"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":[],"created_at":"2024-08-04T00:01:40.906Z","updated_at":"2025-05-13T13:30:25.447Z","avatar_url":"https://github.com/robert-hh.png","language":"Python","readme":"# ADS8718: Python class for the ADS7818 AD-converter\n\nThis is a very short and simple class. It uses the SPI bus for the interface. That\nensures that the tight timing requirements of the ADS7818 are met.\n\n## Constructor\n\n### adc = ADS7818(spi, \\*, baudrate = 1000000, vref = 2.5, inverted = False)\n\n- spi is an SPI object which has to be created by the caller. Just the Pins have to be assigned by the caller.\nThe init method of the class sets baud rate, phase, polarity and word size.\n- baudrate defines the baud rate of the SPI. the default is 1000000.\nThe valid range is 200kHz through 4 MHz. These boundaries are silently enforced by the class.\n- vref is the reference voltage, used to calculate the voltage value. If the internal Vref is used, this allows small\ncorrections. If an external Vref is applied, it can be assigned here. Vref is only used for the calculation\nof the equivalent voltage.\n- inverted set True if an inverter is inserted between the MOSI output and CONV input\nin order to get an high CONV level during quiet times.\n\n## Methods\n\n### value = adc.value()\n\nRetrieves the adc raw value using the setting of the constructor. The returned\nvalue is in the range of 0 - 4095\n\n### volt = adc.voltage()\n\nReads the adc value and return the equivalent voltage. This is based on the vref\nvalue set in the constructor. The formula is:   \n    voltage = 2 * vref * value / 4096\n\n## Interface\n\nThe ADS7818 is connected to the SPI bus signals. There is no CS needed. The\nconnection consist of:\n\n|Micro|ADS7818|\n|:---|:---|\n|MOSI|CONV (5)|\n|MISO|DATA (6)|\n|CLK|CLK (7)|\n\nThe ADS7818 needs a Vcc of 5V. For connecting to a 3.3V device, insert a resistor\nof about 4.7 kOhm between MISO and DATA.\nDevice like those of Pycom have low MOSI level. This does not nicely match the\ninterface description of the ADS7818. In that is a problem, an inverter can be\nplaced between MOSI and CONV, and the flag inverted has to be set True when calling\nthe constructor.\n\n## Example\n\n```\n# Drive the ADS7818 ADC using SPI\n# Connections:\n# xxPy | ADS7818\n# -----|-------\n# P10  |  CLK\n# P11  |  CONV\n# P14  |  DATA add a series resistor of about 4.7k between DATA and P14\n#\nfrom machine import SPI\nfrom ads7818 import ADS7818\n\nspi = SPI(0, SPI.MASTER)\nvref = 2.493 # measured at the ADS7818\nads = ADS7818(spi)\n\nwhile True:\n    # start a conversion and get the result back\n    value = ads.value()\n    volt = 2.0 * vref * value / 4096\n\n    print(value, volt)\n    res= input(\"Next: \")\n    if res == \"q\":\n        break\n```\n","funding_links":[],"categories":["Libraries"],"sub_categories":["IO"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-hh%2FADS7818","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frobert-hh%2FADS7818","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frobert-hh%2FADS7818/lists"}