kizniche / Mycodo

An environmental monitoring and regulation system
http://kylegabriel.com/projects/
GNU General Public License v3.0
2.97k stars 495 forks source link

SHT35 Sensor #687

Closed chitters2004 closed 5 years ago

chitters2004 commented 5 years ago

Having difficulty adding SHT35 sensor. Added dependencies for SHT31 and grove.py, had it working for a while but no longer. Mycodo log v1.txt Mycodo log - grove.py.txt sht35v1.txt SHT35grove.txt

kizniche commented 5 years ago

It looks like the custom input you made wasn't modified enough to use the grove.py library. For the custom input I provided, do you have a log of any output after activating that one? Make sure to select the correct I2C address, as I believe 0x44 will be selected by default, but 0x45 is what should be selected, if I'm reading correctly.

Have you been able to get any [non-Mycodo] code to return a measurement, to verify you have it wired correctly and are using the correct I2C address?

kizniche commented 5 years ago

For reference, this is related to https://kylegabriel.com/forum/general-discussion/custom-inputs-and-pid-for-grow-tent/

Also, can you verify this is the board/sensor you have? http://wiki.seeedstudio.com/Grove-I2C_High_Accuracy_Temp&Humi_Sensor-SHT35/

kizniche commented 5 years ago

I see you mention it was working for a while, but not anymore. This is indeed strange. It indicates there may be a wiring issue. Is your sensor connected by a set of short wires and you're sure the connections are secure? Have you tried rebooting the Pi?

Also, just to make sure, you're adding the custom inputs to Mycodo through [Gear Icon] -> Configure -. Inputs?

chitters2004 commented 5 years ago

Sorry for late reply, the setup is offsite and have just managed to get up here. I have rewired the sensor and there must have been a dodgy connection as am now getting readings again using both custom inputs. Using the one you kindly wrote for me I am now getting the following in the log:

2019-09-16 15:09:17,136 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.817196917677578, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.63523308155948, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.587727541146577, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 649.2740030537091, 'timestamp_utc': None}}
2019-09-16 15:09:22,146 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.80117494468604, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.63981078812849, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.573011884479794, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 648.4967307004886, 'timestamp_utc': None}}
2019-09-16 15:09:27,155 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.83054856183719, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.75577935454338, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.625154872805414, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 645.2688328007195, 'timestamp_utc': None}}
2019-09-16 15:09:32,163 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.80117494468604, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.67795834287023, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.58073223776555, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 647.0717137129249, 'timestamp_utc': None}}
2019-09-16 15:09:37,174 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.817196917677578, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.69474326695659, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.59977192191627, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 647.0488988253177, 'timestamp_utc': None}}
2019-09-16 15:09:42,183 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.817196917677578, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.71305409323263, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.60347635941797, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 646.364251370428, 'timestamp_utc': None}}
2019-09-16 15:09:47,192 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.817196917677578, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.67338063630122, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.59544917091811, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 647.8476541893556, 'timestamp_utc': None}}
2019-09-16 15:09:52,207 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.80117494468604, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.69016556038758, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.583202092519564, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 646.6157082769045, 'timestamp_utc': None}}
2019-09-16 15:09:57,114 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.78782330052644, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.70542458228428, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.573252305024145, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 645.5428934670488, 'timestamp_utc': None}}
2019-09-16 15:10:02,120 - DEBUG - mycodo.controllers.controller_input_03a80cd6 - Adding measurements to InfluxDB with ID 03a80cd6-e70a-4a7a-90f7-9b3067a72988: {0: {'measurement': 'temperature', 'unit': 'C', 'value': 27.83054856183719, 'timestamp_utc': None}, 1: {'measurement': 'humidity', 'unit': 'percent', 'value': 82.78629739833677, 'timestamp_utc': None}, 2: {'measurement': 'dewpoint', 'unit': 'C', 'value': 24.631325153933123, 'timestamp_utc': None}, 3: {'measurement': 'vapor_pressure_deficit', 'unit': 'Pa', 'value': 644.1268651291847, 'timestamp_utc': None}}
2019-09-16 15:10:07,038 - ERROR - mycodo.inputs.sht35_03a80cd6 - InputModule.get_measurement() method raised IOError: [Errno 121] Remote I/O error
Traceback (most recent call last):
  File "/var/mycodo-root/mycodo/inputs/base_input.py", line 122, in read
    self._measurements = self.get_measurement()
  File "/home/pi/Mycodo/mycodo/inputs/custom_inputs/sht35.py", line 99, in get_measurement
    self.bus.write_i2c_block_data(self.i2c_address, 0x24, [0x00])
  File "/var/mycodo-root/env/lib/python3.7/site-packages/smbus2/smbus2.py", line 482, in write_i2c_block_data
    ioctl(self.fd, I2C_SMBUS, msg)
OSError: [Errno 121] Remote I/O error

I am indeed using http://wiki.seeedstudio.com/Grove-I2C_High_Accuracy_Temp&Humi_Sensor-SHT35/ and using 0x45.

kizniche commented 5 years ago

Are the measurements from both inputs returning similar values? If so, I will merely rename the SHT31 input to SHT31/35 as the Adafruit_SHT31 library appears to work with both. Looking at the datasheet, the SHT30 should also work, so it may be better to name it "SHT3x".

Now that we have this issue resolved, we can go back to the forum to discuss PID tuning and other setup considerations/configurations. I'll leave a longer reply on the forum later when I get home.

chitters2004 commented 5 years ago

They are indeed. Reverted to SHT31 Lib.