0

Example of WiringOther view of wiring

I've been trying to set up the SHT10 sensor from adafruit.com and have been having problems. I think I have the sensor connected properly to my raspberry pi 3 through a breadboard, however, when I run my python code I get error codes.

from pi_sht1x import SHT1x
import RPi.GPIO as GPIO

GPIO.setwarnings(False)

with SHT1x(11, 7, gpio_mode=GPIO.BOARD) as sensor:
    temp = sensor.read_temperature()
    humidity = sensor.read_humidity(temp)
    sensor.calculate_dew_point(temp, humidity)
    print("sensor")

This is the error code I get:

pi@raspberrypi:~ $ sudo python3 garden.py Traceback (most recent call last): File "garden.py", line 7, in temp = sensor.read_temperature() File "/usr/local/lib/python3.4/dist-packages/pi_sht1x/sht1x.py", line 166, in read_temperature self._send_command() File "/usr/local/lib/python3.4/dist-packages/pi_sht1x/sht1x.py", line 254, in _send_command self._get_ack(command_name) File "/usr/local/lib/python3.4/dist-packages/pi_sht1x/sht1x.py", line 397, in _get_ack raise SHT1xError(message) pi_sht1x.sht1x.SHT1xError: SHT1x failed to properly receive command [['Temperature'] - 00000011]

I'm pretty new to coding etc. So I imagine the solution is probably easy... Thanks!

  • 1
    I was just reading your post, and it was updated. Apparently you replaced the error messages with an illegible screen shot. DO NOT paste images, copy the text and paste. – Milliways Oct 4 '16 at 3:45
  • 1
    @gbredo, can you post a photo of your wiring ? Assuming the wiring is correct (no shorts, no loose connections etc) I have a hunch it might be a simple case naming convention for the pins - BCM vs BOARD. – Shreyas Murali Oct 4 '16 at 3:50
  • Hi Shreyas, I added on photo of my wiring but couldn't get another one attached as my reputation is too low. I'll try BCM later today and see if that fixes the problem! – gbredo Oct 4 '16 at 13:28
  • You could perhaps remove the screenshot and replace it with the error text instead. That might allow you do add a photo of the connections. – joan Oct 4 '16 at 14:01
  • Thanks for the suggestion. I've now got both pictures of my wiring (hopefully they help!) and my error code. – gbredo Oct 5 '16 at 3:00
0

I got the sensor working. Re did the wiring and used the following code:

from time import sleep
import RPi.GPIO as GPIO
from pi_sht1x import SHT1x

DATA_PIN = 21
SCK_PIN = 23

with SHT1x(DATA_PIN, SCK_PIN, gpio_mode=GPIO.BOARD) as sensor:
    temp = sensor.read_temperature()
    humidity = sensor.read_humidity(temp)
    sensor.calculate_dew_point(temp, humidity)
    print (sensor)
    sleep(2)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.