KY-028 Temperature sensor (thermistor)
This module contains an NTC thermistor which can measure temperatures in the range of -55°C up to +125°C.
- Arduino
- Raspberry Pi
- Raspberry Pi Pico
- Micro:Bit
This module contains an NTC thermistor that can measure temperatures from -55°C to +125°C. The thermistor changes its resistance depending on the temperature: as the temperature increases, the resistance decreases. This behavior makes it ideal for monitoring threshold values. You can set a desired temperature threshold value using a rotary potentiometer. As soon as the measured temperature exceeds this threshold value, the sensor emits a digital high signal. A built-in comparator is used to compare the set and measured values. In addition, an LED indicates when the sensor is supplied with voltage and another LED lights up when the threshold value is exceeded. This module is ideal for applications where reliable temperature monitoring is required, e.g. in heating control systems or air conditioning systems.
User note
This sensor is ideally suited for threshold value measurement. This means that the sensor emits a digital high signal as soon as a threshold value set by the user on the rotary potentiometer is exceeded. It should be noted here that the digital signal is a comparison of the value set on the rotary potentiometer and the measured value on the sensor, which are then compared by the LM393 comparator installed on the board. The set value of the rotary potentiometer is the threshold value, which is used to define a logical high signal.
Digital output: If a magnetic field is detected, a signal is output here
Analog output: Direct measured value of the sensor unit
LED1: Indicates that the sensor is supplied with voltage
LED2: Indicates that the temperature threshold has been exceeded
Functionality of the sensor
This sensor has two functional components on its circuit board: The front sensor unit, which physically measures the environment and outputs it as an analog signal to the second unit, the comparator. The comparator compares the measured value of the sensor with the value set on the rotary potentiometer and outputs a logical high signal on the digital pin and LED L1 if the value on the rotary potentiometer is exceeded.
Please note: The signal is inverted. If a high value is measured, this results in a lower voltage value at the analog output.
The rotary potentiometer can be set as follows:
Pin assignment
Arduino | Sensor |
---|---|
5 V | +V |
GND | GND |
Pin 3 | Digital Signal |
Pin A0 | Analog Signal |
Code example
The program reads the current voltage value, which can be measured at the analog output, and outputs it on the serial interface. In addition, the state of the digital pin is also output in the console. This state indicates whether the limit value has been exceeded.
To load the following code example onto your Arduino, we recommend using the Arduino IDE. In the IDE, you can select the appropriate port and board for your device.
Copy the code below into your IDE. To upload the code to your Arduino, simply click on the upload button.
This module contains an NTC thermistor that can measure temperatures from -55°C to +125°C. The thermistor changes its resistance depending on the temperature: as the temperature increases, the resistance decreases. This behavior makes it ideal for monitoring threshold values. You can set a desired temperature threshold value using a rotary potentiometer. As soon as the measured temperature exceeds this threshold value, the sensor emits a digital high signal. A built-in comparator is used to compare the set and measured values. In addition, an LED indicates when the sensor is supplied with voltage and another LED lights up when the threshold value is exceeded. This module is ideal for applications where reliable temperature monitoring is required, e.g. in heating control systems or air conditioning systems.
User note
This sensor is ideally suited for threshold value measurement. This means that the sensor emits a digital high signal as soon as a threshold value set by the user on the rotary potentiometer is exceeded. It should be noted here that the digital signal is a comparison of the value set on the rotary potentiometer and the measured value on the sensor, which are then compared by the LM393 comparator installed on the board. The set value of the rotary potentiometer is the threshold value, which is used to define a logical high signal.
Digital output: If a magnetic field is detected, a signal is output here
Analog output: Direct measured value of the sensor unit
LED1: Indicates that the sensor is supplied with voltage
LED2: Indicates that the temperature threshold has been exceeded
Functionality of the sensor
This sensor has two functional components on its circuit board: The front sensor unit, which physically measures the environment and outputs it as an analog signal to the second unit, the comparator. The comparator compares the measured value of the sensor with the value set on the rotary potentiometer and outputs a logical high signal on the digital pin and LED L1 if the value on the rotary potentiometer is exceeded.
Please note: The signal is inverted. If a high value is measured, this results in a lower voltage value at the analog output.
The rotary potentiometer can be set as follows:
Pin assignment
Raspberry Pi | Sensor |
---|---|
GPIO 24 [Pin 18] | Digital Signal |
3,3 V [Pin 1] | +V |
GND [Pin 6] | GND |
- | Analog Signal |
Sensor | KY-053 |
---|---|
Analog Signal | A0 |
Digital Signal | - |
+V | - |
GND | - |
Raspberry Pi | KY-053 |
---|---|
GPIO 3 [Pin 5] | SCL |
GPIO 2 [Pin 3] | SDA |
3,3 V [Pin 1] | VDD |
GND [Pin 6] | GND |
Analog sensor, therefore the following must be considered: The Raspberry Pi has, in contrast to the Arduino, no analog inputs or there is no ADC (analog digital converter) integrated in the chip of the Raspberry Pi. This limits the Raspberry Pi, if you want to use sensors, which do not output digital values, but a continuously changing value (example: potentiometer -> different position = different voltage value).
To avoid this problem, our sensor kit X40 contains the KY-053, a module with a 16-bit ADC, which you can use on the Raspberry to expand it with 4 analog inputs. This module is connected to the Raspberry Pi via I2C, takes over the analog measurement and transfers the value digitally to the Raspberry Pi.
So we recommend to connect the KY-053 module with the mentioned ADC in between for analog sensors of this set. You can find more information on the KY-053 Analog Digital Converter information page.
Code example
Attention! To use this module in combination with the KY-053 Analog-Digital-Converter, a virtual environment must be set up. All the necessary information can be found here.
This module contains an NTC thermistor that can measure temperatures from -55°C to +125°C. The thermistor changes its resistance depending on the temperature: as the temperature increases, the resistance decreases. This behavior makes it ideal for monitoring threshold values. You can set a desired temperature threshold value using a rotary potentiometer. As soon as the measured temperature exceeds this threshold value, the sensor emits a digital high signal. A built-in comparator is used to compare the set and measured values. In addition, an LED indicates when the sensor is supplied with voltage and another LED lights up when the threshold value is exceeded. This module is ideal for applications where reliable temperature monitoring is required, e.g. in heating control systems or air conditioning systems.
User note
This sensor is ideally suited for threshold value measurement. This means that the sensor emits a digital high signal as soon as a threshold value set by the user on the rotary potentiometer is exceeded. It should be noted here that the digital signal is a comparison of the value set on the rotary potentiometer and the measured value on the sensor, which are then compared by the LM393 comparator installed on the board. The set value of the rotary potentiometer is the threshold value, which is used to define a logical high signal.
Digital output: If a magnetic field is detected, a signal is output here
Analog output: Direct measured value of the sensor unit
LED1: Indicates that the sensor is supplied with voltage
LED2: Indicates that the temperature threshold has been exceeded
Functionality of the sensor
This sensor has two functional components on its circuit board: The front sensor unit, which physically measures the environment and outputs it as an analog signal to the second unit, the comparator. The comparator compares the measured value of the sensor with the value set on the rotary potentiometer and outputs a logical high signal on the digital pin and LED L1 if the value on the rotary potentiometer is exceeded.
Please note: The signal is inverted. If a high value is measured, this results in a lower voltage value at the analog output.
The rotary potentiometer can be set as follows:
Pin assignment
Micro:Bit | Sensor |
---|---|
Pin 1 | Digital Signal |
3,3 V | +V |
GND | GND |
- | Analog Signal |
Sensor | KY-053 |
---|---|
Analog Signal | A0 |
Digital Signal | - |
+V | - |
GND | - |
Micro:Bit | KY-053 |
---|---|
Pin 19 | SCL |
Pin 20 | SDA |
3,3 V | VDD |
GND | GND |
Analog sensor, therefore the following must be observed: The Micro:Bit has analog inputs or there is an ADC (analog digital converter) integrated in the chip of the Micro:Bit. However, these are only limited to 10-bit and therefore offer only a rather low accuracy for analog measurements.
To avoid this problem, our sensor kit X40 contains the KY-053, a module with a 16-bit ADC, which you can use on the Micro:Bit to expand it by 4 analog inputs. This is connected to the Micro:Bit via I2C, takes over the analog measurement and transfers the value digitally to the Micro:Bit.
Therefore we recommend to connect the KY-053 module with the mentioned ADC in between for analog sensors of this set. More information can be found on the KY-053 Analog Digital Converter information page KY-053 Analog Digital Converter.
Code example
The program uses the corresponding library from us to control the ADS1115 ADC. This has been published under the following link pxt-ads1115 under the MIT-License.
pins.setPull(DigitalPin.P1, PinPullMode.PullUp)
ADS1115.setMode(mode.Multi)
ADS1115.setRate(rate.Rate5)
ADS1115.setGain(gain.One)
ADS1115.initADS1115(userInI2C.Gnd)
basic.forever(function () {
serial.writeString("Analoger Wert: ")
serial.writeLine("" + (ADS1115.raw_to_v(ADS1115.read(0))))
if (pins.digitalReadPin(DigitalPin.P1) == 1) {
serial.writeLine("Threshold value reached")
} else {
serial.writeLine("Threshold value not yet reached")
}
serial.writeLine("_____________________________________")
basic.pause(1000)
})
Sample program download
This module contains an NTC thermistor that can measure temperatures from -55°C to +125°C. The thermistor changes its resistance depending on the temperature: as the temperature increases, the resistance decreases. This behavior makes it ideal for monitoring threshold values. You can set a desired temperature threshold value using a rotary potentiometer. As soon as the measured temperature exceeds this threshold value, the sensor emits a digital high signal. A built-in comparator is used to compare the set and measured values. In addition, an LED indicates when the sensor is supplied with voltage and another LED lights up when the threshold value is exceeded. This module is ideal for applications where reliable temperature monitoring is required, e.g. in heating control systems or air conditioning systems.
User note
This sensor is ideally suited for threshold value measurement. This means that the sensor emits a digital high signal as soon as a threshold value set by the user on the rotary potentiometer is exceeded. It should be noted here that the digital signal is a comparison of the value set on the rotary potentiometer and the measured value on the sensor, which are then compared by the LM393 comparator installed on the board. The set value of the rotary potentiometer is the threshold value, which is used to define a logical high signal.
Digital output: If a magnetic field is detected, a signal is output here
Analog output: Direct measured value of the sensor unit
LED1: Indicates that the sensor is supplied with voltage
LED2: Indicates that the temperature threshold has been exceeded
Functionality of the sensor
This sensor has two functional components on its circuit board: The front sensor unit, which physically measures the environment and outputs it as an analog signal to the second unit, the comparator. The comparator compares the measured value of the sensor with the value set on the rotary potentiometer and outputs a logical high signal on the digital pin and LED L1 if the value on the rotary potentiometer is exceeded.
Please note: The signal is inverted. If a high value is measured, this results in a lower voltage value at the analog output.
The rotary potentiometer can be set as follows:
Pin assignment
Raspberry Pi Pico | Sensor |
---|---|
GPIO26 (A0) | Analog Signal |
GND | GND |
3 V | +V |
GPIO18 | Digital Signal |
You can also use an ADC such as the KY-053. This ADC has a higher resolution than the internal ADC of the Raspberry Pi Pico, which means that the sensor can be analysed more accurately.
Code example
The program reads the current voltage value, which can be calculated by reading the analog output, and outputs it on the serial interface. In addition, the state of the digital pin is also indicated in the console. This indicates whether the limit value has been exceeded.
To load the following code example onto your Pico, we recommend using the Thonny IDE. All you have to do first is go to Run > Configure interpreter ... > Interpreter > Which kind of interpreter should Thonny use for running your code? and select MicroPython (Raspberry Pi Pico).
Now copy the code below into your IDE and click on Run.