You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Benefits
I previously used DHT sensors, but they quickly failed in my application (greenhouse) due to humidity issues. This sensor seems to be more reliable and accurate. I am simplifying my install and would like to move this sensor to pi-mqtt-gpio if possible.
I do not know how to program in Python, but I was able to scrap together a script that pulls the data from the sht31 and publishes via mqtt. Right now, the script is outside pi-mqtt-gpio and is being run via Crontab (I know ugly, but getting the job done). Not sure if it would help. (Sorry about formatting, not sure how to fix or to publish code.
#!/usr/bin/env python3importsmbusimportpaho.mqtt.clientasmqttimportosimporttime# Start the i2c bus and label as 'bus'bus=smbus.SMBus(1)
# Send the start conversion command to the SHT31bus.write_i2c_block_data(0x44, 0x2C, [0x06])
time.sleep(0.5)
# SHT31 address, 0x44(68)# Read data back from 0x00(00), 6 bytes# Temp MSB, Temp LSB, Temp CRC, Humididty MSB, Humidity LSB, Humidity CRCdata=bus.read_i2c_block_data(0x44, 0x00, 6)
# Convert the datatemp=data[0] *256+data[1]
cTemp=round(-45+ (175*temp/65535.0),2)
fTemp=round(-49+ (315*temp/65535.0),2)
humidity=round(100* (data[3] *256+data[4]) /65535.0,2)
# This is the Publisherclient=mqtt.Client()
client.username_pw_set("user", "password")
client.connect("broker",1883,60)
client.publish("sensor/fTemp", fTemp);
client.publish("sensor/cTemp", cTemp);
client.publish("sensor/humidity", humidity);
client.disconnect();
Thanks, we'll get that module built at some point, but it'll only be on the new version that we're testing at the moment. I'll respond back to this issue once the module's built.
Hardware details
Is it possible to add support for the SHT31 Temp/Humidity Sensor, it is an i2c sensor.
https://www.adafruit.com/product/2857
Benefits
I previously used DHT sensors, but they quickly failed in my application (greenhouse) due to humidity issues. This sensor seems to be more reliable and accurate. I am simplifying my install and would like to move this sensor to pi-mqtt-gpio if possible.
Python library
Adafruit python library
https://github.com/adafruit/Adafruit_CircuitPython_SHT31D
Context
Thanks. The project is great.
The text was updated successfully, but these errors were encountered: