Project35.Digital Temperature Sensor Module ================================================ Description ------------ The KY-028 Digital Temperature Sensor measures temperature changes based on thermistor resistance. This module has both digital and analog outputs, there’s a potentiometer to djust the detection threshold on the digital interface. Compatible with Arduino, Raspberry Pi, ESP32, and other microcontrollers. Specification -------------- - Operating Voltage 3.3V ~ 5.5V - Temperature Measurement Range -55°C to 125°C - Measurement Accuracy ±0.5°C - Board Dimensions 15mm x 36mm Connect -------- .. image:: /img/connect/35_bb.png Code ----- .. code-block:: c int led = 13; // define the LED pin int digitalPin = 2; // KY-028 digital interface int analogPin = A0; // KY-028 analog interface int digitalVal; // digital readings int analogVal; //analog readings void setup() { pinMode(led, OUTPUT); pinMode(digitalPin, INPUT); //pinMode(analogPin, OUTPUT); Serial.begin(9600); } void loop() { // Read the digital interface digitalVal = digitalRead(digitalPin); if(digitalVal == HIGH) // if temperature threshold reached { digitalWrite(led, HIGH); // turn ON Arduino's LED } else { digitalWrite(led, LOW); // turn OFF Arduino's LED } // Read the analog interface analogVal = analogRead(analogPin); Serial.println(analogVal); // print analog value to serial delay(100); } The analog interface returns a numeric value that depends on the temperature and the potentiometer’s position. Since the analog output pin is directly connected to the potentiometer it isn’t possible to use the Steinhart-Hart equation to calculate the temperature as we did with the KY-013, we can only use this value to measure relative changes in temperature. Phenomenon ----------- .. image:: /img/phenomenon/35.jpg