Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

Temprature measurement with SHT11 sensor

Status
Not open for further replies.

HN

Member level 1
Joined
Jun 15, 2002
Messages
38
Helped
5
Reputation
10
Reaction score
5
Trophy points
1,288
Activity points
276
sht11 bascom

8) STH11 Datasheet

Here!
 
  • Like
Reactions: grrmfi

    grrmfi

    points: 2
    Helpful Answer Positive Rating

Dspnut

Full Member level 2
Joined
Jul 18, 2002
Messages
141
Helped
10
Reputation
18
Reaction score
5
Trophy points
1,298
Activity points
1,267
sht11 code

For those whose preferred choice of MCU is MCS51,

Here is (K*E*I*L) c-code for interfacing the SHT11 temp-humid sensor to the MCS51 (in this case the 89C51RD2 + 11.0592 MHz (Speed x2)). The detail how to connect the SHT11 to the 89C51RD2 is explained in the source code.
 

asena

Member level 4
Joined
Jan 23, 2003
Messages
75
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Portugal
Activity points
652
sht11 picbasic

This is great thanks!
Do you think you could share the PIC code with us?
I would like to build one my self, and add more functions !!

thanks and regards

asena
 

Dspnut

Full Member level 2
Joined
Jul 18, 2002
Messages
141
Helped
10
Reputation
18
Reaction score
5
Trophy points
1,298
Activity points
1,267
sht11 asm

After some web surfing,

Here is a link describing how to interface a SHT11 sensor to an AVR mcu. The source code is written in Basic (BASCOM-AVR). I cann't find the PIC code (sorry asena :roll: ).

http://www.mcselec.com/an_116.htm

You may add more features and functions to this source code... :)
 

asena

Member level 4
Joined
Jan 23, 2003
Messages
75
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Portugal
Activity points
652
sht11 c code

Thanks anyway!
I'll write the code myself, and then i'll post it here!

Lets wait for HN, he may have the PIC source!

regards

asena
 

cancel

Full Member level 5
Joined
May 27, 2001
Messages
251
Helped
15
Reputation
30
Reaction score
4
Trophy points
1,298
Activity points
1,878
sht11 atmega

hi ...

can you tell me about availability of this sensor. I am using dallas 1820 and no problems so far .. whats the benefit of this solution ??

regards

cancel
 

Nick C.

Full Member level 5
Joined
Dec 19, 2002
Messages
281
Helped
33
Reputation
66
Reaction score
25
Trophy points
1,308
Activity points
2,213
sht11 i2c

cancel said:
I am using dallas 1820 and no problems so far .. whats the benefit of this solution ??

regards

cancel
Temperature and humidity sensing in one part.
 

asena

Member level 4
Joined
Jan 23, 2003
Messages
75
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Portugal
Activity points
652
pic sht11

cancel,

go to the manufacturer website, and ask for a sample.
They'll send it to you.

www.sensirion.com

regards

asena 8)
 

challenger

Junior Member level 3
Joined
Feb 2, 2003
Messages
27
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Activity points
324
sht11 pic code

Has any body written Picbasic code they can share for this sensor yet?


I dont know what communications protocall to use with this sensor.
I2C doesnt work.
If you can help me please send on to me .

rgds
challenger
 

Kripton2035

Advanced Member level 4
Joined
Jul 19, 2001
Messages
1,155
Helped
208
Reputation
418
Reaction score
180
Trophy points
1,353
Location
Western Europe
Activity points
7,716
sht11 sensor

challenger said:
Has any body written Picbasic code they can share for this sensor yet?

I dont know what communications protocall to use with this sensor.
I2C doesnt work.
r
here is some picbasic code for the sht11
only to read humidity (temp doesnt interest me for now...) the protocol is NOT I2C, but something like. you have to emulate yourself this pseudo i2c- see the picbasic code below

mysda var PORTC.6
myscl var PORTC.7
hread con %00000101 ' lecture humiditÈ sur sht11
humid var word
humidchk var byte
h1 var word
h2 var word
h3 var word

sht11_init: ' initialisation du sht11
Output mysda
Output myscl
High mysda
Low myscl
For i=1 to 10
High myscl
Pause 1
Low myscl
Pause 1
Next i
Call sht11_ts
return

sht11_ts: ' transmission start
High myscl
Pause 1
Low mysda
Pause 1
Low myscl
Pause 1
High myscl
Pause 1
High mysda
Pause 1
Low myscl
return

sht11_readhumid: ' lecture humiditÈ sur sht11
Call sht11_ts
Shiftout mysda,myscl,1,[hread\8] ' sortie commande lire humiditÈ
Input mysda ' attente ack
Low myscl
While mysda=1
Wend
Pulsout myscl,10 ' envoi ack
While mysda=0
Wend
While mysda=1 ' attente de la fin de la mesure
Wend
Low myscl
ShiftIn mysda,myscl,0,[humid.highbyte\8]
Low mysda
Pulsout myscl,10 ' envoi ack
ShiftIn mysda,myscl,0,[humid.lowbyte\8]
Low mysda
Pulsout myscl,10 ' envoi ack
ShiftIn mysda,myscl,0,[humidchk\8]
High mysda
Pulsout myscl,10 ' envoi ack
Input mysda
Input myscl ' retour en haute impÈdance
return
 

Taro

Full Member level 2
Joined
Jun 28, 2001
Messages
143
Helped
8
Reputation
16
Reaction score
5
Trophy points
1,298
Activity points
1,195
sht11 microchip

Here's code for AVR (FASTAVR)


'//////////////////////////////////////////////////////////////
'/// FastAVR Basic Compiler for AVR by MICRODESIGN ///
'/// SHT11/15 Temperature and Humidity measurement ///
'/// 14/12 bit ///
'//////////////////////////////////////////////////////////////
$Device= 8515
$Stack = 32 ' stack size
$Clock = 7.3728
$Baud=115200
$ShiftOut Data=PORTD.2, Clk=PORTD.3, 1
$LeadChar=" ", Format(2,3)

$Def dDta=DDRD.2
$Def inDta=PIND.2
$Def Dta=PORTD.2
$Def Sck=PORTD.3

Declare Sub Init()
Declare Sub StartTX()
Declare Sub CommReset()
Declare Function WriteByte(db As Byte) As Byte
Declare Function ReadByte(ack As Byte) As Byte
Declare Function Measure(what As Byte) As Word

Dim tmp As Integer, ftmp As Float
Dim n As Byte
Dim Cta As Byte, Ctb As Integer

Const True=1, False=0
Const ACK=1, NAK=0

Const TmpSHT=&h03
Const HumSHT=&h05
Const ResSHT=&h1e
Const Rstat =&h07
Const Wstat =&h06

Const c1=-4, c2=0.0405, c3=-2.8E-06

Init()

Do
tmp=Measure(TmpSHT) ' measure Temperature
ftmp=tmp/100-40
Print "Temp:"; ftmp

tmp=Measure(HumSHT) ' measure Humidity
ftmp=c1+tmp*c2+Sqr(tmp)*c3
Print "Humy:"; ftmp
Print
Wait 1
Loop

'//////////////////////////////////////////////////////////////
Sub Init()
WaitMs 20
CommReset()
WriteByte(Wstat) ' write to Status
Set dDta
WriteByte(0) ' 14bit for T, 12 bit for RH
End Sub

'//////////////////////////////////////////////////////////////
Function Measure(what As Byte) As Word
Local tmp As Word

CommReset()
If WriteByte(what)=0 Then ' isue Cmd
BitWait inDta, 0 ' wait for data ready
tmp=ReadByte(ACK) ' read first byte
Shift(Left, 8, tmp) ' make it MSB
tmp=tmp Or ReadByte(NAK) ' read second byte and combine
'n=ReadByte(NAK) ' no CRC for now
Else
Print "No sensor!"
tmp=0
End If
Return tmp
End Function

'//////////////////////////////////////////////////////////////
Sub StartTX()
Set dDta
Set Sck
Reset Dta
Reset Sck
Set Sck
Set Dta
Reset Sck
End Sub

'//////////////////////////////////////////////////////////////
Sub CommReset()
Local i As Byte

Set Dta
For i=0 To 8
Set Sck: Reset Sck
Next
StartTX()
End Sub

'//////////////////////////////////////////////////////////////
Function WriteByte(db As Byte) As Byte
Local mask As Byte

ShiftOut db ' send data
Reset dDta ' back to input
Set Sck:Reset Sck ' clock ACK
Return inDta ' return ACK (0=SHT present)
End Function

'//////////////////////////////////////////////////////////////
Function ReadByte(ack As Byte) As Byte
Local i As Byte, db As Byte

db=ShiftIn
Set dDta
Dta=Not ack
Set Sck
Reset Sck
Reset dDta
Return db
End Function
 

Kripton2035

Advanced Member level 4
Joined
Jul 19, 2001
Messages
1,155
Helped
208
Reputation
418
Reaction score
180
Trophy points
1,353
Location
Western Europe
Activity points
7,716
sht11 pic

I have done it now for ccs compiler for both temp and humidity.

if anybody wants it please msg me and I will post it.
 

asena

Member level 4
Joined
Jan 23, 2003
Messages
75
Helped
4
Reputation
8
Reaction score
1
Trophy points
1,288
Location
Portugal
Activity points
652
sht11 gcc

And i have it for Microchips C18.
It works very well with the 18F series.

asena
 

spelle

Newbie level 2
Joined
Jan 24, 2004
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
20
sht11 avr code

Hi,

Does anywone have the asm source code for the 2x16LCD-PIC16F84-SHT11 configuration?
I found the hex file on TURKengineers last week and it works fine (except for the integrated website-add and a strange offset on the temperature) but they are unfortunately not responding to requests for the source code :(
 

Taro

Full Member level 2
Joined
Jun 28, 2001
Messages
143
Helped
8
Reputation
16
Reaction score
5
Trophy points
1,298
Activity points
1,195

spelle

Newbie level 2
Joined
Jan 24, 2004
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
20
sht11 ccs

I've already tried that circuit but did not have any luck getting it to work.
 

SNOOP! (Ronnie)

Newbie level 3
Joined
Jan 27, 2004
Messages
4
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,281
Location
Germany
Activity points
21
sht11 + avr

Hi..
Does anyone have seen some SHT11 sample code for 8051 Assembler?
or the LST file from C code?

Thanks
Ronnie
 

rvlad23

Newbie level 1
Joined
Apr 28, 2004
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
10
ssb_sensor.h

hello

anyone can help me with a schematic for connecting sht11 with an AVR Atmega8 and seding results to a PC using USB. I would appreciate some links or advices. I have to do a project with this subject and I can't find anything with usb,atmel and sht11 together.

Thank you in advance
 

Status
Not open for further replies.
Toggle Sidebar

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top