drohm / pi-sht1x

Python library for the Sensirion SHT1x series of temperature and humidity sensors to work on the Raspberry Pi. This includes the SHT10, SHT11, and SHT15 sensors.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SHT1x failed to properly receive command

revelinux opened this issue · comments

I got the following error when running examples.py

pi@raspidoko:~/pysuhu/pi-sht1x $ sudo python3 examples/examples.py Test: using default values: 3.5V, High resolution, no heater, otp_no_reload off, CRC checking enabled... Traceback (most recent call last): File "examples/examples.py", line 140, in <module> main() File "examples/examples.py", line 13, in main temp = sensor.read_temperature() File "/usr/local/lib/python3.5/dist-packages/pi_sht1x/sht1x.py", line 166, in read_temperature self._send_command() File "/usr/local/lib/python3.5/dist-packages/pi_sht1x/sht1x.py", line 254, in _send_command self._get_ack(command_name) File "/usr/local/lib/python3.5/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 buy the sensor from my local store as following.
https://www.bukalapak.com/p/elektronik/elektronik-lainnya/9pm7s-jual-sensirion-temperature-humidity-sensor-sht11?product_sku=24100907

this is my board

https://cloud.githubusercontent.com/assets/184959/7376782/26e48554-edb0-11e4-9cd9-d0196abe4c00.png

I've check my cable and seem nothing wrong. I connect the sensor directly to the Pi board

is there anything wrong?

Can you check those links, they're not working for me.

I just realize, I can't click it either. but, copy pasting the url will work.

anyway, I'm using parallax sht11. googling parallax sht11, will give you the same image as first link
2015-06-14t23 56 15 07 00
I'm using raspberry pi B+ board, with raspbian stretch
26e48554-edb0-11e4-9cd9-d0196abe4c00 2

I've check other issue that have same error message with mine. all off the seem have cabling problem. I've double check my cable. it seem nothing wrong. I'm wondering if my sensor is broken.

I'm using physical pin 18 (GPIO 24) connected to pin 2 on the sensor
physical pin 23 (GPIO 11) connected to pin 3 on the sensor.
according to https://www.parallax.com/sites/default/files/downloads/28018-Temperature-Humidity-Manufacturer-Datasheet.pdf
sht1x

When I wrote this library I was using the SHT15 sensor. Based on the Sensirion documentation it should work with the SHT11, but again I haven't actually used that sensor with this library.

What version of RPi.GPIO do you have installed? Paste the output for pip list --format columns here.

they share the same data sheet. so i think it should work to.

I'm using the default python version that came with raspbian stretch. and I think it install RPi.GPIO when I run pip3 install pi-sht1x

Package Version


automationhat 0.0.4
blinker 1.3
blinkt 0.1.0
Cap1xxx 0.1.3
chardet 2.3.0
click 6.6
colorama 0.3.7
cryptography 1.7.1
drumhat 0.0.5
enum34 1.1.6
envirophat 0.0.6
ExplorerHAT 0.4.2
Flask 0.12.1
fourletterphat 0.0.2
gpiozero 1.4.0
idna 2.2
ipaddress 1.0.17
itsdangerous 0.24
Jinja2 2.8
keyring 10.1
keyrings.alt 1.3
lxkeymap 0.1
MarkupSafe 0.23
mcpi 0.1.1
microdotphat 0.1.3
mote 0.0.3
motephat 0.0.2
numpy 1.12.1
oauthlib 2.0.1
phatbeat 0.0.2
pianohat 0.0.5
picamera 1.13
picraft 1.0
piglow 1.2.4
pigpio 1.35
Pillow 4.0.0
pip 9.0.1
pyasn1 0.1.9
pycrypto 2.6.1
pygame 1.9.3
pygobject 3.22.0
pyinotify 0.9.6
PyJWT 1.4.2
pyOpenSSL 16.2.0
pyserial 3.2.1
pyxdg 0.25
rainbowhat 0.0.2
requests 2.12.4
requests-oauthlib 0.7.0
RPi.GPIO 0.6.3
RTIMULib 7.2.1
scrollphat 0.0.7
scrollphathd 1.0.1
SecretStorage 2.3.1
sense-emu 1.0
sense-hat 2.2.0
setuptools 33.1.1
simplejson 3.10.0
six 1.10.0
skywriter 0.0.7
sn3218 1.2.7
spidev 3.0
touchphat 0.0.1
twython 3.4.0
urllib3 1.19.1
Werkzeug 0.11.15
wheel 0.29.0

Problem solved. I read the wrong guide, resulting I connect the wrong pin. I should refer to pharallax guide, instead of sensirion datasheet, since pharallax that made the board. below is the data sheet

sht1x

my second problem is I run the sensor.py as is. it worked after I change to parameter to BOARD.

what is the different between BOARD and BCM?
when should I use resolution HIGH or LOW ?

@revelinux Thanks for getting back, thats great you figured it out.

GPIO.BOARD vs GPIO.BCM refers to the pin numbering system you want to use when referring to the pins on the raspberry pi. BOARD signifies using the physical pin numbers on the Pi connector. BCM signifies using the Broadcom SOC channel designation. You can find more information here:

https://learn.sparkfun.com/tutorials/raspberry-gpio/python-rpigpio-api

In regards to the sensor resolution, thats totally up to you. I tend to always use the HIGH resolution if I remember correctly (it's been a while). It refers to the measurement resolution and the number of bits used during measurement. I believe the default resolution is HIGH: 12bit for RH and 14bit Temp. You can change this to use LOW: 8bit RH and 12bit Temp. The difference between the two boils down to the size in bits and the speed of how long it takes to make the measurement. It mentions in the spec sheet that using LOW is especially useful in high speed or extreme low power applications.

thanks for the answer :)