SMT160 based Temperature indicator

There are lot of temperature sensors both with analog & digital outputs. This project gives you an another temperature indicator which has been done with a digital sensor SMT160.
Although it is a digital sensor it does not gives out the temperature directly. The output is duty cycled modulated. The sensor can measure temperature from -45deg to +150deg.
The output duty cycle is D.C. = 0.320+0.00470 x t, here t is the temperature.
Therefore Temperature T = Dc / 0.0047
based Temperature indicator
Bascom Code

β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€“mainβ€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-
$regfile = β€œm8def.dat”
$crystal = 1000000
β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-lcdβ€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
Config Lcd = 16 * 2
Config Lcdpin = Pin , Rs = Pinc.5 , E = Pinc.4 , Db4 = Pinc.3 , Db5 = Pinc.2 , Db6 = Pinc.1 , Db7 = Pinc.0
β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€“dimβ€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-
Dim avr_reset As Word
Dim Avr_set As Word
Dim Temp As Single
Dim Duty As Single
Dim X As Integer

β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-
Config Timer1 = Timer , Prescale = 1
Enable Timer1
β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€“mainβ€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
Config Pinb.2 = Input
β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”
Cursor Off
Cls
Locate 1 , 5
Lcd β€œHello”
Locate 2 , 1
Lcd β€œavrprojects.info”
Wait 2
Cls

Smt160:
Do
Gosub Read_data_sm160
Locate 1 , 1
Lcd β€œT= ” ; Temp ; β€œcΒ Β Β  β€œ;
Wait 1
Loop

β€˜β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”β€”-
Read_data_sm160:
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Bitwait Pinb.2 , Set
Bitwait Pinb.2 , Reset
Stop Timer1
Bitwait Pinb.2 , Set
Timer1 = 0
Start Timer1
Bitwait Pinb.2 , Reset
β€˜Xl = Timer1
avr_set = Timer1
Timer1 = 0
Start Timer1
Bitwait Pinb.2 , Set
β€˜Xf = Timer1
Avr_reset = Timer1

X = Avr_set + Avr_reset
Duty = Avr_set / X
Duty = Duty – 0.32
Waitms 1
Temp = Duty / 0.0047
Waitms 1
Locate 1 , 1
Temp = Round(temp)
Stop Timer1
Return
For more Detail: SMT160 based Temperature indicator


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top