ESP32 DS18B20 great chip for measuring digital temperature uses Dallas library
Автор: Electricum
Загружено: 2025-08-13
Просмотров: 119
Описание:
1. Overview
This project uses:
• ESP32 as the microcontroller
• DS18B20 digital temperature sensor for accurate temp measurement
• SSD1306 OLED display (128×64, I²C) to show the readings
• A 4.7 kΩ pull-up resistor to keep the 1-Wire data line stable
The ESP32 reads the temperature from the DS18B20, formats it, and shows it both on the OLED and the serial monitor every 2 seconds.
________________________________________
2. How It Works
1. One-Wire Protocol
o The DS18B20 communicates over a single data wire.
o Each sensor has a unique 64-bit address, so you could connect multiple sensors on the same pin if needed.
o The OneWire library handles the low-level timing.
2. DallasTemperature Library
o This sits on top of OneWire and gives you high-level commands like:
sensors.requestTemperatures();
sensors.getTempCByIndex(0);
o It supports reading multiple DS18B20s by index or address.
3. OLED Display
o The SSD1306 OLED uses I²C (2 wires: SDA & SCL) to receive commands.
o The Adafruit SSD1306 + Adafruit GFX libraries handle drawing text and graphics.
o You can display text, symbols (like °), and even custom graphics.
4. Workflow in Loop
o Request a new temperature reading
o Read the value in °C
o Print it to serial monitor
o Clear the OLED, write new text, and update the display
________________________________________
3. Key Features
• Flexible GPIO choice — you can put the DS18B20 on any digital-capable pin by changing ONE_WIRE_BUS.
• Multiple sensors possible — the bus supports several DS18B20s with unique IDs.
• I²C OLED simplicity — only 2 pins needed for the display (plus power and ground).
• No operating system drivers — unlike Raspberry Pi, ESP32 talks to the sensor directly.
________________________________________
4. Possible Enhancements
• High/Low Temperature Alarm
o Use the DS18B20’s built-in alarm registers or just compare readings in code to trigger a buzzer, LED, or flashing OLED message.
• Switch to Fahrenheit with a single function call:
sensors.getTempFByIndex(0);
• Data Logging — send temperature to an SD card, cloud server, or MQTT broker.
• Multiple DS18B20s — monitor different spots and show them all on the OLED.
• Graph Mode — draw a simple scrolling temperature graph on the OLED.
Code: https://github.com/ukkokalevala/DS18B...
Повторяем попытку...
Доступные форматы для скачивания:
Скачать видео
-
Информация по загрузке: