Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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

Awesome Lists containing this project

README

        

Qwiic_Soil_Moisture_Sensor_Py
===============















follow on Twitter

SparkFun Qwiic Soil Moisture Sensor

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 Installation

This 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_sensor

def 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)
return

mySoilSensor.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)

```


SparkFun - Start Something