If not, is there somewhere an example or a manual how to create a own I2C device file?
There are already libs for arduino and for Propeller(?) and i should be able to create a own one,
but i have no idea where to start, probably someone has a hint for me.
The interesting part on this sensor is, you can buy it in a steel case to put it into soil, perfect for watering control. http://www.adafruit.com/product/1298
Thank you in advance for your help
(hope I'm in the right section for such a question)
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Erikk hat geschrieben:
Do you mind sharing it?
Im trying to communicate with a SHT-21.
Or maybe just write down what methods your using (Write() or Write8() eg..)
Yea sure, as soon as all runs, i'll upload all necessary files.
But this can take some days/weeks, just started....
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Right now im trying to do a Write8 and then a Read, i get bus-activity when whatching the scope but no readings.
Probably not that far away from the truth
Edit, used my logic analyzer and got it working! I just need to finish the library
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
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" ?
It has a TON Timer of 50ms before Writing a measurement request ( i´ve only tested the No-Hold commands ).
The internal state machine has these states:
10: Write Temp measurement command -> Send to state 11.
11: Read/wait for respons, when respons is found -> Send to state 20.
20: Write Humidity measurement command -> Send to State 21.
21: Read/wait for respons, when respons if found -> Send to state 10.
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.
It dont use the checksum.
After a Temperature measurement request is sent, a 100ms TON is set, before doing a Read, same with Humidity Measurement, but only 40ms.
If the read isnt successfull it will try again in the next cycle.
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).
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.
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).
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.
Its probably not the best written library but it works very well.
Hope it will be of some use to someone.
Hi Erikk
Nice work, does not run 1:1 with the SHT-1x, but it helps me a lot to understand.
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.
Many thanks
G
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Erikk hat geschrieben:
I´ve attached my library for the SHT21.
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" ?
It has a TON Timer of 50ms before Writing a measurement request ( i´ve only tested the No-Hold commands ).
The internal state machine has these states:
10: Write Temp measurement command -> Send to state 11.
11: Read/wait for respons, when respons is found -> Send to state 20.
20: Write Humidity measurement command -> Send to State 21.
21: Read/wait for respons, when respons if found -> Send to state 10.
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.
It dont use the checksum.
After a Temperature measurement request is sent, a 100ms TON is set, before doing a Read, same with Humidity Measurement, but only 40ms.
If the read isnt successfull it will try again in the next cycle.
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).
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.
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).
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.
Its probably not the best written library but it works very well.
Hope it will be of some use to someone.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all
Does anyone has a library for the SHT-10 Humidity/Temperature sensor (any SHT-1x lib will work)?
http://www.adafruit.com/datasheets/Sensirion_Humidity_SHT1x_Datasheet_V5.pdf
If not, is there somewhere an example or a manual how to create a own I2C device file?
There are already libs for arduino and for Propeller(?) and i should be able to create a own one,
but i have no idea where to start, probably someone has a hint for me.
The interesting part on this sensor is, you can buy it in a steel case to put it into soil, perfect for watering control.
http://www.adafruit.com/product/1298
Thank you in advance for your help
(hope I'm in the right section for such a question)
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...
Reading the manuals really helps sometimes
Do you mind sharing it?
Im trying to communicate with a SHT-21.
Or maybe just write down what methods your using (Write() or Write8() eg..)
Yea sure, as soon as all runs, i'll upload all necessary files.
But this can take some days/weeks, just started....
Right now im trying to do a Write8 and then a Read, i get bus-activity when whatching the scope but no readings.
Probably not that far away from the truth
Edit, used my logic analyzer and got it working! I just need to finish the library
I´ve attached my library for the SHT21.
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" ?
It has a TON Timer of 50ms before Writing a measurement request ( i´ve only tested the No-Hold commands ).
The internal state machine has these states:
10: Write Temp measurement command -> Send to state 11.
11: Read/wait for respons, when respons is found -> Send to state 20.
20: Write Humidity measurement command -> Send to State 21.
21: Read/wait for respons, when respons if found -> Send to state 10.
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.
It dont use the checksum.
After a Temperature measurement request is sent, a 100ms TON is set, before doing a Read, same with Humidity Measurement, but only 40ms.
If the read isnt successfull it will try again in the next cycle.
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).
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.
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).
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.
Its probably not the best written library but it works very well.
Hope it will be of some use to someone.
SHT21.devdesc.xml [2.35 KiB]
I2C_SHT21.library [348.46 KiB]
Hi Erikk
Nice work, does not run 1:1 with the SHT-1x, but it helps me a lot to understand.
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.
Many thanks
G
Do you have example code for this?
Hi,
check the section
'CODESYS V3 Raspberry Pi share your devices & libraries '
l viewtopic.php?f=23&t=5872&p=10867#p11612 l
BR
Edwin