Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please add SHT31 sensor #13

Open
gidhap opened this issue Dec 10, 2021 · 0 comments
Open

Please add SHT31 sensor #13

gidhap opened this issue Dec 10, 2021 · 0 comments

Comments

@gidhap
Copy link

gidhap commented Dec 10, 2021

I found the attached python script to test the sensor, but have no clue how to make it transferring data to luftdaten.info.
Any chance to get the SHT31 sensor covered ?

#------------------------------------------------------------------------

SHT31 abfragen

#------------------------------------------------------------------------
import os, sys, time
import smbus

I2C Bus festlegen

bus = smbus.SMBus(1)

SHT31 Adresse definieren, 0x44(68)

bus.write_i2c_block_data(0x44, 0x2C, [0x06])

time.sleep(0.5)

Daten lesen aus 0x00(00), 6 Bytes

Temp MSB, Temp LSB, Temp CRC, Humididty MSB, Humidity LSB, Humidity CRC

data = bus.read_i2c_block_data(0x44, 0x00, 6)

Daten konvertieren

temp = data[0] * 256 + data[1]
cTemp = -45 + (175 * temp / 65535.0)
fTemp = -49 + (315 * temp / 65535.0)
humidity = 100 * (data[3] * 256 + data[4]) / 65535.0

Daten anzeigen

print "Temperatur in Celsius: %.2f C" %cTemp
print "Temperatur in Fahrenheit: %.2f F" %fTemp
print "Relative Feuchtigkeit: %.2f %%RH" %humidity`

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant