pmodhygro is python library to read PmodHYGRO that is relative humidity sensor with integrated temperature sensor on a Raspberry Pi
Project description
pmodhygro
pmodhygro is python library to read PmodHYGRO that is relative humidity sensor with integrated temperature sensor on a Raspberry Pi
-> Reference page of PmodHygro sensor : https://digilent.com/reference/pmod/pmodhygro/start?redirect=1
Installing
Install with pip
Use pip to install from PyPI.
Python 2:
sudo pip install pmodhygro
Python 3:
sudo pip3 install pmodhygro
Compile and install from the repository
Download library for ZIP file from GitHub, unzipping the archive, and execute:
Python 2:
cd pmodhygro
sudo python setup.py install
Python 3:
cd pmodhygro
sudo python3 setup.py install
You may also git clone the repository:
git clone https://github.com/devpola/pmodhygro.git
Usage
from pmodhygro import PmodHygro
# Create i2c bus
sensor = PmodHygro()
sensor.begin_i2c()
# Read data from Pmod HYGRO
temp = sensor.get_temperature()
temp_f = sensor.get_temperature_f()
hum = sensor.get_humidity()
You have to run program with 'sudo' command for avoiding permission error
Check list before using library
Check for I2C
Raspbian:
- Using “Raspi-config” on Command Line
sudo raspi-config
- Enable I2C Interface
Ubuntu(20.04):
- Open '/boot/firmware/syscfg.txt' file
- Check if there are contents below. If not, add it.
dtparam=i2c_arm=on, dtparam=spi=on
Check the connection
-
Check port sensor is connected using command below.
ls /dev/*i2c*
-
You can get /dev/i2c-0 or /dev/i2c-1
- In case of Raspberry Pi B model, there are two i2c ports, 0 and 1.
-
Remember whether the port number is 0 or 1
-
-
Check device address is 0x40
-
Install i2c-tools package for checking connected devices to i2c interface
sudo apt-get install i2c-tools
-
Check device address at the port is 0x40 using command below.
sudo i2cdetect -y 0 (or 1)
-
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Hashes for pmodhygro-1.0.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e121e36b0c097f2b44db73fe4f89132694dfe6ee738bdc017052488344eb137 |
|
MD5 | 758e0fc9ef56540d3251c242b8cceb0b |
|
BLAKE2b-256 | 76053ca6e9cd8f25dc90e7a957907313ee0ee8652729025d28119d775c1cc318 |