Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/greenponik/greenponik_onewire_ds18b20
Read DS18B20 OneWire through Python3 on raspberry pi
https://github.com/greenponik/greenponik_onewire_ds18b20
greenponik hydroponics i2c-sensors iot-device onewire raspberry-pi temperature
Last synced: about 1 month ago
JSON representation
Read DS18B20 OneWire through Python3 on raspberry pi
- Host: GitHub
- URL: https://github.com/greenponik/greenponik_onewire_ds18b20
- Owner: GreenPonik
- License: mit
- Created: 2019-12-20T14:35:42.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-08-05T14:30:10.000Z (over 4 years ago)
- Last Synced: 2024-11-08T12:16:27.651Z (2 months ago)
- Topics: greenponik, hydroponics, i2c-sensors, iot-device, onewire, raspberry-pi, temperature
- Language: Python
- Homepage: https://greenponik.github.io/GreenPonik_OneWire_DS18B20/
- Size: 194 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=alert_status)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)
[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=sqale_rating)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=ncloc)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)
[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)
[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=security_rating)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)
[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=GreenPonik_GreenPonik_OneWire_DS18B20&metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=GreenPonik_GreenPonik_OneWire_DS18B20)![Upload Python Package](https://github.com/GreenPonik/GreenPonik_OneWire_DS18B20/workflows/Upload%20Python%20Package/badge.svg?event=release)
## GreenPonik_OneWire_DS18B20.py Library for Raspberry pi
---------------------------------------------------------
This is the sample code for read temperature with DS18B20 sensor on One Wire bus.The script auto-detect the 1W file and parse it to find the temperature value.
## Table of Contents
- [GreenPonik_OneWire_DS18B20.py Library for Raspberry pi](#GreenPonikOneWireDS18B20py-library-for-raspberry-pi)
- [Table of Contents](#table-of-contents)
- [Installation](#installation)
- [Methods](#methods)
- [Examples](#examples)
- [Credits](#credits)## Installation
```shell
> git clone https://github.com/GreenPonik/GreenPonik_OneWire_DS18B20.git
cd GreenPonik_OneWire_DS18B20
pip3 install -r requirements.txtor
> pip3 install greenponik-onewire-ds18b20
```
```Pythonfrom GreenPonik_OneWire_DS18B20 import read_temps
```
## Methods
```python
"""
Get temperatues in celcius and fahrenheit
"""
def read_temps():```
## Example
```Python
from time import sleep
from GreenPonik_OneWire_DS18B20 import read_tempsif __name__ == "__main__":
try:
while True:
# read both celcius and fahrenheit temperatures
temperatures = read_temps()
print("celcius temp %.3f" % temperatures[0])
print("fahrenheit temp %.3f" % temperatures[1])
sleep(1)
except Exception as e:
print("Exception occured", e)
```## Credits
Write by Mickael Lehoux, from [GreenPonik](https://www.greenponik.com), 2019