Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sparkfun/qwiic_soil_moisture_sensor_py
Python module to interface with the Qwiic Soil Moisture Sensor Board
https://github.com/sparkfun/qwiic_soil_moisture_sensor_py
python python3 qwiic sensor sparkfun
Last synced: about 1 month ago
JSON representation
Python module to interface with the Qwiic Soil Moisture Sensor Board
- Host: GitHub
- URL: https://github.com/sparkfun/qwiic_soil_moisture_sensor_py
- Owner: sparkfun
- License: mit
- Created: 2021-02-08T18:45:03.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-12-23T00:01:13.000Z (almost 1 year ago)
- Last Synced: 2024-04-15T00:11:19.516Z (8 months ago)
- Topics: python, python3, qwiic, sensor, sparkfun
- Language: Python
- Homepage:
- Size: 47.9 KB
- Stars: 3
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Qwiic_Soil_Moisture_Sensor_Py
===============
Python module for the [SparkFun Qwiic Soil Moisture Sensor](https://www.sparkfun.com/products/17731)
This python package is a port of the existing [SparkFun Soil Moisture Sensor Arduino Examples](https://github.com/sparkfun/Zio-Qwiic-Soil-Moisture-Sensor/tree/master/Firmware/Qwiic%20Soil%20Moisture%20Sensor%20Examples)
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
## Contents
* [Supported Platforms](#supported-platforms)
* [Dependencies](#dependencies)
* [Installation](#installation)
* [Documentation](#documentation)
* [Example Use](#example-use)Supported Platforms
--------------------
The qwiic Soil Moisture Sensor Python package current supports the following platforms:
* [Raspberry Pi](https://www.sparkfun.com/search/results?term=raspberry+pi)
* [NVidia Jetson Nano](https://www.sparkfun.com/products/15297)
* [Google Coral Development Board](https://www.sparkfun.com/products/15318)Dependencies
--------------
This driver package depends on the qwiic I2C driver:
[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py)Documentation
-------------
The SparkFun qwiic Soil Moisture Sensor module documentation is hosted at [ReadTheDocs](https://qwiic-soil-moisture-sensor-py.readthedocs.io/en/latest/?)Installation
---------------
### PyPi InstallationThis repository is hosted on PyPi as the [sparkfun-qwiic-soil-moisture-sensor](https://pypi.org/project/sparkfun-qwiic-soil-moisture-sensor/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
For all users (note: the user must have sudo privileges):
```sh
sudo pip install sparkfun-qwiic-soil-moisture-sensor
```
For the current user:```sh
pip install sparkfun-qwiic-soil-moisture-sensor
```
To install, make sure the setuptools package is installed on the system.Direct installation at the command line:
```sh
python setup.py install
```To build a package for use with pip:
```sh
python setup.py sdist
```
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
```sh
cd dist
pip install sparkfun-qwiic-soil-moisture-sensor-.tar.gz
```Example Use
-------------
See the examples directory for more detailed use examples.```python
from __future__ import print_function
import qwiic_soil_moisture_sensordef runExample():
print("\nSparkFun qwiic soil moisture sensor Example 1\n")
mySoilSensor = qwiic_soil_moisture_sensor.QwiicSoilMoistureSensor()if mySoilSensor.connected == False:
print("The Qwiic Soil Moisture Sensor device isn't connected to the system. Please check your connection", \
file=sys.stderr)
returnmySoilSensor.begin()
print("Initialized.")
while True:
mySoilSensor.read_moisture_level()
print (mySoilSensor.level)
mySoilSensor.led_on()
time.sleep(1)
mySoilSensor.led_off()
time.sleep(1)if __name__ == '__main__':
try:
runExample()
except (KeyboardInterrupt, SystemExit) as exErr:
print("\nEnding Example 1")
sys.exit(0)```