<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Wer hat den Sensor SHT20 oder SHT21 erfolgreich an laufen?]]></title><description><![CDATA[<p dir="auto">Ich versuche es noch mal in Deutsch, vielleicht habe ich es in einen anderen Post schlecht übersetzen lassen.<br />
Wer arbeitet mit den folgenden SHT20 SHT21 Sensoren und kann mir dabei mit einem Code Snippet helfen wie man sie in Dezimalzahlen auslesen kann. Oder wer kennt eine Seite wo Infos darüber stehen.<br />
Ich bin für jede Hilfe dankbar.<br />
Bis jetzt habe ich immer Hilfe bekommen, hoffe auch diesmal darauf.</p>
]]></description><link>https://forum.pycom.io/topic/4696/wer-hat-den-sensor-sht20-oder-sht21-erfolgreich-an-laufen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 15 Oct 2026 23:17:54 GMT</lastBuildDate><atom:link href="https://forum.pycom.io/topic/4696.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 14 Apr 2019 07:36:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Wer hat den Sensor SHT20 oder SHT21 erfolgreich an laufen? on Sun, 14 Apr 2019 07:36:11 GMT]]></title><description><![CDATA[<p dir="auto">Ich versuche es noch mal in Deutsch, vielleicht habe ich es in einen anderen Post schlecht übersetzen lassen.<br />
Wer arbeitet mit den folgenden SHT20 SHT21 Sensoren und kann mir dabei mit einem Code Snippet helfen wie man sie in Dezimalzahlen auslesen kann. Oder wer kennt eine Seite wo Infos darüber stehen.<br />
Ich bin für jede Hilfe dankbar.<br />
Bis jetzt habe ich immer Hilfe bekommen, hoffe auch diesmal darauf.</p>
]]></description><link>https://forum.pycom.io/post/27239</link><guid isPermaLink="true">https://forum.pycom.io/post/27239</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Sun, 14 Apr 2019 07:36:11 GMT</pubDate></item><item><title><![CDATA[Reply to Wer hat den Sensor SHT20 oder SHT21 erfolgreich an laufen? on Sun, 14 Apr 2019 14:09:26 GMT]]></title><description><![CDATA[<p dir="auto">Probieren Sie diesen Ausschnitt aus.</p>
<p dir="auto">Es läuft auf der neuesten Version mit Erweiterungskarte v2.1a</p>
<p dir="auto">Pycom MicroPython 1.18.2.r4 [v1.8.6-849-ba178ae] am 2019-04-01; WiPy mit ESP32</p>
<pre><code>from machine import I2C
#import array
import time
#import binascii
import math

#Init bus
#remove jumper from led
#SDA=P9 aka G16 aka GPIO12  SCL=P10 aka G17 aka GPIO13
#expansionboard v2.1a
i2c = I2C(0, I2C.MASTER,  baudrate=100000)

i2c.scan()

i2cadr = 0x40
A = 8.1332;
B = 1762.39;
C = 235.66

def crc8(raw):
  check = raw[0] &lt;&lt; 16 | raw[1] &lt;&lt; 8 | raw[2]
  #print(check)
  #print(raw[0], ' ', raw[1], ' ', raw[2])

  check1 = check

  divsor = 0x988000 # 1 0011 0001 0x131

  for i in range(0, 16):
    if( check &amp; 1 &lt;&lt; (23 - i) ):
      check ^= divsor

    divsor = divsor &gt;&gt; 1

  if not check == 0:
    #print('True')
  #else:
    print('False')


while 1:
  ## read Temperature, hold
  #i2c.writeto(i2cadr, b'\xE3')
  ## read Temperature, no hold
  dummy = i2c.writeto(i2cadr, b'\xF3')
  time.sleep(0.1)
  raw = i2c.readfrom(i2cadr, 3)

  crc8(raw)
  raw = raw[0] &lt;&lt; 8 | raw[1]
  #raw = raw &amp; 0xFFFC;
  #tempV = -46.85 + (175.72 * raw / 65536)
  raw = raw &gt;&gt; 2;
  tempV = -46.85 + (175.72 * raw / 16384)

  ## read Humidity, hold
  #i2c.writeto(i2cadr, b'\xE5')
  ## read Humidity, no hold
  dummy = i2c.writeto(i2cadr, b'\xF5')
  time.sleep(0.1)
  raw = i2c.readfrom(i2cadr, 3)
  raw = raw[0] &lt;&lt; 8 | raw[1]	
  #raw = raw &amp; 0xFFFC;
  #humdV = -6 + (125.0 * raw / 65536)
  raw = raw &gt;&gt; 2;
  humdV = -6 + (125.0 * raw / 16384)

  ## compute dewpoint
  pp = math.pow(10, A - B / (tempV + C))  
  tm = math.log(humdV * pp / 100, 10)
  dp = -(B / (tm - A) + C)

  #print('temp: ', tempV, '  relH: ', humdV,' dew: ',dp)
  print('temp: {:&lt;10} relH: {:&lt;10} dew: {:&lt;10}'.format(tempV, humdV, dp))
  time.sleep(2)



</code></pre>
]]></description><link>https://forum.pycom.io/post/27244</link><guid isPermaLink="true">https://forum.pycom.io/post/27244</guid><dc:creator><![CDATA[Frida]]></dc:creator><pubDate>Sun, 14 Apr 2019 14:09:26 GMT</pubDate></item><item><title><![CDATA[Reply to Wer hat den Sensor SHT20 oder SHT21 erfolgreich an laufen? on Sun, 14 Apr 2019 14:47:11 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="https://forum.pycom.io/uid/172">@Frida</a> Scheint zu laufen!<br />
Vielen vielen Dank. Sie haben mir sehr geholfen.</p>
]]></description><link>https://forum.pycom.io/post/27245</link><guid isPermaLink="true">https://forum.pycom.io/post/27245</guid><dc:creator><![CDATA[Wolli01]]></dc:creator><pubDate>Sun, 14 Apr 2019 14:47:11 GMT</pubDate></item><item><title><![CDATA[Reply to Wer hat den Sensor SHT20 oder SHT21 erfolgreich an laufen? on Sun, 14 Apr 2019 17:50:13 GMT]]></title><description><![CDATA[<p dir="auto">Gern geschehen.<br />
Grüße aus Dänemark</p>
]]></description><link>https://forum.pycom.io/post/27247</link><guid isPermaLink="true">https://forum.pycom.io/post/27247</guid><dc:creator><![CDATA[Frida]]></dc:creator><pubDate>Sun, 14 Apr 2019 17:50:13 GMT</pubDate></item></channel></rss>