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))
Release files for micropython-dftds 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| micropython-dftds-0.0.2.tar.gz | 4.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| micropython_dftds-0.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.7 kB
Release files / micropython-dftds-0.0.2.tar.gz
| Download URL | micropython-dftds-0.0.2.tar.gz |
|---|---|
| Size | 4.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
52790f7bbb817434401d5cd5fb8e76761d121f6f3079486699d10bf5cf1daf43
|
|
BLAKE2b-256 checksum How to use checksums |
29c24e78aa859faad164e49aea0aa556e97417de2f9a01af9f42403c7d3bfa22
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|
Release files / micropython_dftds-0.0.2-py3-none-any.whl
| Download URL | micropython_dftds-0.0.2-py3-none-any.whl |
|---|---|
| Size | 4.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
bfdf12dac83843f3c2d68c0054cdfa4ed775b40a20c5a266762ca811919c9ee3
|
|
BLAKE2b-256 checksum How to use checksums |
528a0ab615e7053ea97dff8a8fdb4e50e7a6756cc230e499345b73a610880999
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.17
|