<?xml version="1.0" encoding="utf-8"?>
<feed xml:lang="en" xmlns="http://www.w3.org/2005/Atom"><title>Recent posts to Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/" rel="alternate"/><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/feed.atom" rel="self"/><id>https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/</id><updated>2020-02-27T15:26:32.179000Z</updated><subtitle>Recent posts to Looking for library to run a SHT-1x sensor</subtitle><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#4e37" rel="alternate"/><published>2020-02-27T15:26:32.179000Z</published><updated>2020-02-27T15:26:32.179000Z</updated><author><name>eschwellinger</name><uri>https://forge.codesys.com/u/eschwellinger/</uri></author><id>https://forge.codesys.comadef3a3c2837be5a7c5a182f95bc9b3147a15398</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;check the section &lt;br/&gt;
'CODESYS V3 Raspberry Pi share your devices &amp;amp; libraries '&lt;/p&gt;
&lt;p&gt;l &lt;a class="" href="http://forum.codesys.com/viewtopic.php?f=23&amp;amp;t=5872&amp;amp;x=10867&amp;amp;p=11612&amp;amp;lan=en" rel="nofollow"&gt;viewtopic.php?f=23&amp;amp;t=5872&amp;amp;p=10867#p11612&lt;/a&gt; l &lt;/p&gt;
&lt;p&gt;BR&lt;br/&gt;
Edwin&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#cb52" rel="alternate"/><published>2020-02-27T15:26:31.513000Z</published><updated>2020-02-27T15:26:31.513000Z</updated><author><name>sdujolo</name><uri>https://forge.codesys.com/u/sdujolo/</uri></author><id>https://forge.codesys.com300c80e1bbeeda3ea00c2ad1cf528f9b791ce075</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Do you have example code for this?&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Erikk hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
I´ve attached my library for the SHT21.&lt;br/&gt;
It has an internal statemachine inside the _iState, dont know if this was neccesary but i think the symbolic status of the device changes if it isnt "10" ?&lt;br/&gt;
It has a TON Timer of 50ms before Writing a measurement request ( i´ve only tested the No-Hold commands ).&lt;br/&gt;
The internal state machine has these states:&lt;br/&gt;
10: Write Temp measurement command -&amp;gt; Send to state 11.&lt;br/&gt;
11: Read/wait for respons, when respons is found -&amp;gt; Send to state 20.&lt;br/&gt;
20: Write Humidity measurement command -&amp;gt; Send to State 21.&lt;br/&gt;
21: Read/wait for respons, when respons if found -&amp;gt; Send to state 10.&lt;br/&gt;
Every read checks the statusbit of the second byte, to check if it is the correct measurement that is read(temp/humidity), and sets or resets the xTempValid and xHumidityValid booleans.&lt;br/&gt;
It dont use the checksum.&lt;br/&gt;
After a Temperature measurement request is sent, a 100ms TON is set, before doing a Read, same with Humidity Measurement, but only 40ms.&lt;br/&gt;
If the read isnt successfull it will try again in the next cycle.&lt;br/&gt;
I tried withouth these timers with 4ms cycle time. On the 17th Temperature read (68ms) I got a respons from the sensor, and the 7th Humidity read (28ms).&lt;br/&gt;
So to take some cycles of the Cpu and the bus, i think its the right way to go. But you could probably go down to ~65-70ms for a temperature read and ~30ms for a Humidity.&lt;br/&gt;
It also has a internal watchdog timer, which is needed if it doesnt get a respons at all (i made a short between the SCL/SDA lines and it got stuck in a reading state), when it runs out, it starts from _iState 0 (complete restart).&lt;br/&gt;
If you dont specify a I2C address, in _iState 0 it automatically sets the address 0x40 (decimal 64), which is specified in the SHT21 manual.&lt;br/&gt;
Its probably not the best written library but it works very well.&lt;br/&gt;
Hope it will be of some use to someone.&lt;/p&gt;
&lt;/blockquote&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#c31f" rel="alternate"/><published>2020-02-27T15:26:29.622000Z</published><updated>2020-02-27T15:26:29.622000Z</updated><author><name>impius</name><uri>https://forge.codesys.com/u/impius/</uri></author><id>https://forge.codesys.comd2c34bf7e2c4dfa13707f8fa5fcd7d59a5580b9f</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi Erikk&lt;br/&gt;
Nice work, does not run 1:1 with the SHT-1x, but it helps me a lot to understand.&lt;br/&gt;
As soon as SHT-1x is running i'll upload as well, it should not be that difficult, the interface to SHT-1x seams to be more simple as to a SHT-21.&lt;br/&gt;
Many thanks&lt;br/&gt;
G&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#c0d5" rel="alternate"/><published>2020-02-27T15:26:28.961000Z</published><updated>2020-02-27T15:26:28.961000Z</updated><author><name>Erikk</name><uri>https://forge.codesys.com/u/erikk/</uri></author><id>https://forge.codesys.comac3faec34603fea3568d29693faf5ab6c314a09e</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;I´ve attached my library for the SHT21.&lt;/p&gt;
&lt;p&gt;It has an internal statemachine inside the _iState, dont know if this was neccesary but i think the symbolic status of the device changes if it isnt "10" ?&lt;br/&gt;
It has a TON Timer of 50ms before Writing a measurement request ( i´ve only tested the No-Hold commands ).&lt;br/&gt;
The internal state machine has these states:&lt;br/&gt;
10: Write Temp measurement command -&amp;gt; Send to state 11.&lt;br/&gt;
11: Read/wait for respons, when respons is found -&amp;gt; Send to state 20.&lt;br/&gt;
20: Write Humidity measurement command -&amp;gt; Send to State 21.&lt;br/&gt;
21: Read/wait for respons, when respons if found -&amp;gt; Send to state 10.&lt;/p&gt;
&lt;p&gt;Every read checks the statusbit of the second byte, to check if it is the correct measurement that is read(temp/humidity), and sets or resets the xTempValid and xHumidityValid booleans.&lt;br/&gt;
It dont use the checksum.&lt;/p&gt;
&lt;p&gt;After a Temperature measurement request is sent, a 100ms TON is set, before doing a Read, same with Humidity Measurement, but only 40ms.&lt;br/&gt;
If the read isnt successfull it will try again in the next cycle.&lt;/p&gt;
&lt;p&gt;I tried withouth these timers with 4ms cycle time. On the 17th Temperature read (68ms) I got a respons from the sensor, and the 7th Humidity read (28ms).&lt;br/&gt;
So to take some cycles of the Cpu and the bus, i think its the right way to go. But you could probably go down to ~65-70ms for a temperature read and ~30ms for a Humidity.&lt;/p&gt;
&lt;p&gt;It also has a internal watchdog timer, which is needed if it doesnt get a respons at all (i made a short between the SCL/SDA lines and it got stuck in a reading state), when it runs out, it starts from _iState 0 (complete restart).&lt;/p&gt;
&lt;p&gt;If you dont specify a I2C address, in _iState 0 it automatically sets the address 0x40 (decimal 64), which is specified in the SHT21 manual.&lt;/p&gt;
&lt;p&gt;Its probably not the best written library but it works very well.&lt;br/&gt;
Hope it will be of some use to someone.&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=957" rel="nofollow"&gt;SHT21.devdesc.xml &lt;span&gt;&lt;span&gt;[2.35 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a class="" href="https://forum.codesys.com//download/file.php?id=956" rel="nofollow"&gt;I2C_SHT21.library &lt;span&gt;&lt;span&gt;[348.46 KiB]&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#1c9b" rel="alternate"/><published>2020-02-27T15:26:28.279000Z</published><updated>2020-02-27T15:26:28.279000Z</updated><author><name>Erikk</name><uri>https://forge.codesys.com/u/erikk/</uri></author><id>https://forge.codesys.com2e48dfead0c4272ba39fb02855ef30232a781343</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Right now im trying to do a Write8 and then a Read, i get bus-activity when whatching the scope but no readings.&lt;br/&gt;
Probably not that far away from the truth &lt;/p&gt;
&lt;p&gt;Edit, used my logic analyzer and got it working! I just need to finish the library &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#f843" rel="alternate"/><published>2020-02-27T15:26:26.308000Z</published><updated>2020-02-27T15:26:26.308000Z</updated><author><name>impius</name><uri>https://forge.codesys.com/u/impius/</uri></author><id>https://forge.codesys.com96a2ba789b5e3c5e38e862701466a7d71b1e5665</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Erikk hat geschrieben:&lt;/strong&gt;&lt;br/&gt;
Do you mind sharing it?&lt;br/&gt;
Im trying to communicate with a SHT-21.&lt;br/&gt;
Or maybe just write down what methods your using (Write() or Write8() eg..)&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Yea sure, as soon as all runs, i'll upload all necessary files.&lt;br/&gt;
But this can take some days/weeks, just started....&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#ccf0" rel="alternate"/><published>2020-02-27T15:26:25.510000Z</published><updated>2020-02-27T15:26:25.510000Z</updated><author><name>Erikk</name><uri>https://forge.codesys.com/u/erikk/</uri></author><id>https://forge.codesys.com2665414f69f331bd9fd671ec8899fa2c4c773c02</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Do you mind sharing it?&lt;br/&gt;
Im trying to communicate with a SHT-21.&lt;/p&gt;
&lt;p&gt;Or maybe just write down what methods your using (Write() or Write8() eg..)&lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#39a6" rel="alternate"/><published>2020-02-27T15:26:23.280000Z</published><updated>2020-02-27T15:26:23.280000Z</updated><author><name>impius</name><uri>https://forge.codesys.com/u/impius/</uri></author><id>https://forge.codesys.comb002f4180e53d2556b3f16ed4c6df52daeed564a</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;In the mean time i have found all i need to know, i'll upload a lib and the devdesc file as soon as all works...&lt;/p&gt;
&lt;p&gt;Reading the manuals really helps sometimes  &lt;/p&gt;&lt;/div&gt;</summary></entry><entry><title>Looking for library to run a SHT-1x sensor</title><link href="https://forge.codesys.com/forge/talk/Runtime/thread/4cc7d0efd3/?limit=25#dfcc" rel="alternate"/><published>2020-02-27T15:26:22.605000Z</published><updated>2020-02-27T15:26:22.605000Z</updated><author><name>impius</name><uri>https://forge.codesys.com/u/impius/</uri></author><id>https://forge.codesys.com8cc0aad7db0c9e962e62e255d14b5317d4aa33c3</id><summary type="html">&lt;div class="markdown_content"&gt;&lt;p&gt;Hi all&lt;br/&gt;
Does anyone has a library for the SHT-10 Humidity/Temperature sensor (any SHT-1x lib will work)?&lt;br/&gt;
&lt;a class="" href="http://www.adafruit.com/datasheets/Sensirion_Humidity_SHT1x_Datasheet_V5.pdf" rel="nofollow"&gt;http://www.adafruit.com/datasheets/Sensirion_Humidity_SHT1x_Datasheet_V5.pdf&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;If not, is there somewhere an example or a manual how to create a own I2C device file?&lt;/p&gt;
&lt;p&gt;There are already libs for arduino and for Propeller(?) and i should be able to create a own one, &lt;br/&gt;
but i have no idea where to start, probably someone has a hint for me.&lt;/p&gt;
&lt;p&gt;The interesting part on this sensor is, you can buy it in a steel case to put it into soil, perfect for watering control.&lt;br/&gt;
&lt;a class="" href="http://www.adafruit.com/product/1298" rel="nofollow"&gt;http://www.adafruit.com/product/1298&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thank you in advance for your help&lt;/p&gt;
&lt;p&gt;(hope I'm in the right section for such a question)&lt;/p&gt;&lt;/div&gt;</summary></entry></feed>