The KY-028 is a thermal sensor module that utilizes an NTC thermistor to detect the temperature of the surrounding environment. NTC or Negative Temperature Coefficient means the resistance of the thermistor decreases with increasing temperature. The passive components that include the LM393 IC create a voltage divider for the thermistor.
The module in this example has analog (A0) and digital (D0) pin connections. Only the analog pin is used here. When the temperature increases, the output voltage that appears on the analog input of the Arduino will drop. The opposite applies when the temperature decreases. The temperature detection threshold can be adjusted through the onboard potentiometer.
1 2 3 4 5 6 7 8 9 10 11 12 13 | int sensorPin=A0; int val; void setup() { Serial.begin (9600); pinMode(sensorPin,INPUT); } void loop() { val=analogRead(sensorPin); Serial.println(val); delay(2000); } |
No comments:
Post a Comment