Skip to main content

MicroPython library for the TDS meter sensor

Project description

micropython-dftds

This repository reproduces the C++ implementation of the DFRobot Gravity TDS sensor with micropython. With this repository, I hope to be able to use a TDS sensor on a Raspberry Pico W.

Installing

micropython -m mip install github:WendelHime/micropython-dftds

If you're installing through thonny or developing something with another IDE, the package is also available on pypi:

pip install micropython-dftds

Testing

micropython -m unittest tests/*

Usage

from machine import ADC

import dftds

# must be an analog pin
TDS_PIN = 28
# create TDS object remembering to set the values according to your device. On raspberry pico the ADC range is 65535.
# another thing to observe, on rasberry pico we have memory flash available, if you need this code to work on another storage device such as EEPROM you might need to create another implementation of KValueRepository. Feel free to open an PR and contribute.
tds_sensor = dftds.GravityTDS(TDS_PIN, adc_range=65535, k_value_repository=dftds.KValueRepositoryFlash('tds_calibration.json'))
tds_sensor.begin()

# you can read the temperature using a dht22 or other device
tds_sensor.temperature = 25.0
tds_value = tds_sensor.update()
print("TDS: {}ppm, EC: {} mS/cm".format(tds_value, tds_value*2))

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

micropython-dftds-0.0.2.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

micropython_dftds-0.0.2-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file micropython-dftds-0.0.2.tar.gz.

File metadata

  • Download URL: micropython-dftds-0.0.2.tar.gz
  • Upload date:
  • Size: 4.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.17

File hashes

Hashes for micropython-dftds-0.0.2.tar.gz
Algorithm Hash digest
SHA256 52790f7bbb817434401d5cd5fb8e76761d121f6f3079486699d10bf5cf1daf43
MD5 689e9a42eedfefc7a3943457cfa6a1af
BLAKE2b-256 29c24e78aa859faad164e49aea0aa556e97417de2f9a01af9f42403c7d3bfa22

See more details on using hashes here.

File details

Details for the file micropython_dftds-0.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for micropython_dftds-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bfdf12dac83843f3c2d68c0054cdfa4ed775b40a20c5a266762ca811919c9ee3
MD5 bc0bb1a1be69bdab3314ccaf79018a82
BLAKE2b-256 528a0ab615e7053ea97dff8a8fdb4e50e7a6756cc230e499345b73a610880999

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page