First install Windows 10 IOT on Raspberry Pi board. Connect SMT172 sensor to the Raspberry Pi pins (as shown in the schematics). SMT172 has a duty cycle (PWM) output that can be directly interfaced with a microcontroller without the use of extra components. https://github.com/AlirezaP/Windows_Iot_Temperature_SMT172-/blob/master/Doc/smt172.pdf
Read Temperature:
1. Measure duty cycle (PWM)
for (int avg = 0; avg <= 7; avg++)
{
for (int i = 0; i < 2000; i++)
{
if (tPintObj.Read() == GpioPinValue.High)
{
pwmh++;
}
else
{
pwml++;
}
await Task.Delay(TimeSpan.FromTicks(10));
}
sum += ((pwmh / (pwml + pwmh)));
}
2. Put DC in the below formula
Temperature = 212.77 × DC − 68.085
double avg = (double)sum / (double)8;
double temperature = (double)212.77 * avg - (double)68.085;
return temperature;
Comments