KY-001 Temperature Sensor Module

View on Amazon
Overview
About KY-001 Temperature Sensor Module
The KY-001 is a temperature sensor module based on the DS18B20 digital temperature sensor. It communicates via the 1-Wire protocol, ensuring easy integration with ESP32, Arduino, and other microcontrollers. With high accuracy and a wide temperature range, it is ideal for temperature monitoring in smart home applications, weather stations, and industrial environments.
⚡ Key Features
- DS18B20-Based Sensor – Ensures reliable and accurate temperature measurements.
- High Accuracy – ±0.5°C from -10°C to +85°C.
- Wide Operating Range – Supports -55°C to +125°C.
- 1-Wire Communication – Simple connection with a single data wire.
- Requires 4.7kΩ Pull-Up Resistor – For stable operation between data and VCC.
Get Your KY-001
Prices are subject to change. We earn from qualifying purchases as an Amazon Associate.
KY-001 Specifications
Complete technical specification details for KY-001 Temperature Sensor Module
📊 Technical Parameters
KY-001 Pinout
The **KY-001** is a 3-pin temperature sensor module based on the DS18B20 chip:
Visual Pinout Diagram

Pin Types
Quick Tips
**Interface**: 1-Wire (Dallas/Maxim single-wire protocol),🌡️ **Based On**: [DS18B20 digital sensor](/sensors/ds18b20/)
**Pull-up Required**: 4.7kΩ resistor between DATA and VCC,⚡ **Power**: 3.3V or 5V operation
**Accuracy**: ±0.5°C from -10°C to +85°C,🌡️ **Range**: -55°C to +125°C operating range
Pin Descriptions
| Pin Name | Type | Description | Notes |
|---|---|---|---|
1 Pin 1 (GND) | Power | Ground connection | |
2 Pin 2 (VCC) | Power | Power supply | 3.3V or 5V |
3 Pin 3 (DATA) | Communication | 1-Wire data line | Requires 4.7kΩ pull-up resistor |
Wiring KY-001 to ESP32
To interface the **KY-001** with an **ESP32** using 1-Wire protocol:
Visual Wiring Diagram

Connection Status
Protocol
Pin Connections
| KY-001 Pin | Connection | ESP32 Pin | Description |
|---|---|---|---|
1 Pin 1 (GND) Required | GND | Ground | |
2 Pin 2 (VCC) Required | 3.3V or 5V | Power supply | |
3 Pin 3 (DATA) Required | GPIO21 | 1-Wire data line (any GPIO) |
**Pull-up Resistor**: Add 4.7kΩ resistor between DATA pin and VCC
**GPIO Selection**: Can use any GPIO pin, GPIO21 is just an example
**Voltage**: Use 3.3V for ESP32 to avoid level shifting
**Multiple Sensors**: Can connect multiple DS18B20 sensors on same data line
KY-001 Troubleshooting
Common issues and solutions to help you get your sensor working
Common Issues
Issue: The sensor is not detected, returning -127°C or no data.
Solutions:
- Ensure proper wiring connections and check the pull-up resistor (4.7kΩ).
- Use a multimeter to verify voltage on the VCC and DATA pins.
- Confirm the correct GPIO pin is used in the code.
Issue: The sensor outputs incorrect or fluctuating temperature values.
Solutions:
- Check for noise interference on the data line; use shielded cables if necessary.
- Ensure the sensor is properly powered (3.3V or 5V).
- Retry the sensor readings after resetting the microcontroller.
Debugging Tips
Use the Serial Monitor to check for error messages and verify the sensor's output. Add debug prints in your code to track the sensor's state.
Use a multimeter to verify voltage levels and check for continuity in your connections. Ensure the power supply is stable and within the sensor's requirements.
Additional Resources
KY-001 Programming Examples
Ready-to-use code examples for different platforms and frameworks
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(115200);
sensors.begin();
}
void loop() {
sensors.requestTemperatures();
Serial.print("Temperature: ");
Serial.println(sensors.getTempCByIndex(0));
delay(2000);
}This code initializes and reads the KY-001 sensor using the OneWire and DallasTemperature libraries.
#include <stdio.h>
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "driver/gpio.h"
#include "onewire.h"
#include "ds18b20.h"
#define KY001_GPIO GPIO_NUM_4
void app_main(void) {
printf("KY-001 Sensor Test\n");
onewire_bus_handle_t bus = onewire_bus_init(KY001_GPIO);
uint8_t rom_code[8];
if (!onewire_search_first(bus, rom_code, false)) {
printf("Sensor not found\n");
return;
}
while (1) {
float temp;
ds18b20_start_conversion(bus, rom_code);
vTaskDelay(pdMS_TO_TICKS(750));
ds18b20_get_temperature(bus, rom_code, &temp);
printf("Temperature: %.2f°C\n", temp);
vTaskDelay(pdMS_TO_TICKS(2000));
}
}This ESP-IDF code initializes the KY-001 sensor and reads the temperature every 2 seconds.
sensor:
- platform: dallas_temp
address: 0x1234567890abcdef
name: KY-001 Temperature Sensor
update_interval: 60sESPHome configuration for the KY-001 temperature sensor.
platformio.ini
[env:esp32]
platform = espressif32
board = esp32dev
framework = arduino
lib_deps =
paulstoffregen/OneWire
milesburton/DallasTemperaturemain.cpp
#include <Arduino.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 4
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(115200);
sensors.begin();
}
void loop() {
sensors.requestTemperatures();
Serial.print("Temperature: ");
Serial.println(sensors.getTempCByIndex(0));
delay(2000);
}PlatformIO example for reading the KY-001 sensor.
import machine
import onewire
import ds18x20
import time
pin = machine.Pin(4)
ow = onewire.OneWire(pin)
ds = ds18x20.DS18X20(ow)
roms = ds.scan()
while True:
ds.convert_temp()
time.sleep(1)
for rom in roms:
print("Temperature:", ds.read_temp(rom))
time.sleep(2)MicroPython script to read temperature from KY-001 using the DS18B20 driver.
Wrapping Up KY-001
The ESP32 KY-001 Temperature Sensor Module is a powerful KY-0xx module sensor that offers excellent performance and reliability. With support for multiple development platforms including Arduino, ESP-IDF, ESPHome, PlatformIO, and MicroPython, it's a versatile choice for your IoT projects.
Best Practices
For optimal performance, ensure proper wiring and follow the recommended configuration for your chosen development platform.
Safety First
Always verify power supply requirements and pin connections before powering up your project to avoid potential damage.
Ready to Start Building?
Now that you have all the information you need, it's time to integrate the KY-001 into your ESP32 project and bring your ideas to life!








