Open gidhap opened 2 years ago
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 ?
import os, sys, time import smbus
bus = smbus.SMBus(1)
bus.write_i2c_block_data(0x44, 0x2C, [0x06])
time.sleep(0.5)
data = bus.read_i2c_block_data(0x44, 0x00, 6)
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
print "Temperatur in Celsius: %.2f C" %cTemp print "Temperatur in Fahrenheit: %.2f F" %fTemp print "Relative Feuchtigkeit: %.2f %%RH" %humidity`
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`