Monitoring temperature changes remotely is essential in various fields, from smart farming and cold storage tracking to industrial automation and environmental monitoring. Instead of relying on expensive commercial sensors, why not build a compact, waterproof, wireless IoT temperature monitoring system using the DFROBOT Beetle ESP32 C3 and Dallas DS18B20 waterproof temperature sensor?
To make it durable and weatherproof, we’ll house our system inside a custom 3D-printed enclosure, produced with JUSTWAY’s expert 3D printing services. Plus, there’s an exciting offer—you can get 15% cashback on all manufacturing orders placed with JUSTWAY from June 1st to August 31st, 2025! More details on that later. 🚀
Why Use DFROBOT Beetle ESP32 C3?The DFROBOT Beetle ESP32 C3 is a compact yet powerful microcontroller tailored for IoT applications. Here’s why it’s perfect for our temperature monitoring system:
✅ WiFi & Bluetooth support for real-time data transmission
✅ Low power consumption, making it ideal for battery-powered setups
✅ Compact size, fitting neatly in a waterproof case
✅ USB Type-C interface for easy programming and debugging
The ESP32 C3 ensures reliable data communication, allowing us to monitor temperature remotely without manual checks.
Dallas DS18B20 – The Perfect Waterproof SensorTo capture temperature accurately in outdoor environments, the Dallas DS18B20 Waterproof Temperature Sensor is an excellent choice.
Key Features:🌡️ High accuracy (±0.5°C precision)
💧 Waterproof & rugged (Stainless steel casing)
🔗 1-Wire protocol (Simplifies connectivity, supports multiple sensors)
🛠️ Wide temperature range (-55°C to +125°C)
With easy wiring and reliable output, the DS18B20 is ideal for weather stations, greenhouse monitoring, and cold storage tracking.
Designing & 3D Printing the Waterproof EnclosureWhy Use JUSTWAY for 3D Printing?To ensure the best protection for our electronics, we need a high-quality waterproof enclosure. While home 3D printing might have precision issues, JUSTWAY’s professional 3D printing service offers:
✔ Accurate manufacturing for perfect fitting
✔ Water-resistant materials like ABS, PETG, and Resin
✔ Fast production with expert-grade finishing
With JUSTWAY’s advanced 3D printing, our temperature monitoring system remains waterproof and durable, even in extreme conditions.
🔥 BONUS: JUSTWAY is currently running a 15% cashback campaign for all orders placed between June 1st – August 31st, 2025! More details below.
Follow this link to get a Summer cashback from JUSTWAY
1️⃣ DFROBOT Beetle ESP32 C3 – Microcontroller handling data processing and transmission
2️⃣ Dallas DS18B20 Waterproof Temperature Sensor – Captures temperature readings
3️⃣ 4.7kΩ Pull-up Resistor – Stabilizes sensor communication
4️⃣ Custom 3D-Printed Waterproof Case – Ordered via JUSTWAY
5️⃣ Jumper Wires & Connectors – Secures stable connections
🔧 Wiring the DS18B20 SensorSince DS18B20 uses 1-Wire communication, multiple sensors can be connected to a single data pin.
Connect Power to 3.3V and Gnd to Gnd and Data to Pin 0 of the Beetle ESP32 C3.
📌 Installing Required Libraries
To communicate with the DS18B20 sensor, install the following Arduino libraries:
🔹 OneWire Library – Handles 1-Wire communication
🔹 DallasTemperature Library – Simplifies temperature readings
📜 Arduino Code for Temperature Monitoring
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 4 // GPIO pin for DS18B20
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
void setup() {
Serial.begin(115200);
sensors.begin();
}
void loop() {
sensors.requestTemperatures();
float tempC = sensors.getTempCByIndex(0);
Serial.print("Temperature: ");
Serial.print(tempC);
Serial.println(" °C");
delay(2000); // Wait before next reading
}
Sending Temperature Data to Web ServerWant to view real-time temperature data on Webserver Use this Arduino code:
// Import required libraries
#ifdef ESP32
#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#else
#include <Arduino.h>
#include <ESP8266WiFi.h>
#include <Hash.h>
#include <ESPAsyncTCP.h>
#include <ESPAsyncWebServer.h>
#endif
#include <OneWire.h>
#include <DallasTemperature.h>
// Data wire is connected to GPIO 4
#define ONE_WIRE_BUS 0
// Setup a oneWire instance to communicate with any OneWire devices
OneWire oneWire(ONE_WIRE_BUS);
// Pass our oneWire reference to Dallas Temperature sensor
DallasTemperature sensors(&oneWire);
// Variables to store temperature values
String temperatureF = "";
String temperatureC = "";
// Timer variables
unsigned long lastTime = 0;
unsigned long timerDelay = 5000;
// Replace with your network credentials
const char* ssid = "";
const char* password = "";
// Create AsyncWebServer object on port 80
AsyncWebServer server(80);
String readDSTemperatureC() {
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
sensors.requestTemperatures();
float tempC = sensors.getTempCByIndex(0);
if(tempC == -127.00) {
Serial.println("Failed to read from DS18B20 sensor");
return "--";
} else {
Serial.print("Temperature Celsius: ");
Serial.println(tempC);
}
return String(tempC);
}
String readDSTemperatureF() {
// Call sensors.requestTemperatures() to issue a global temperature and Requests to all devices on the bus
sensors.requestTemperatures();
float tempF = sensors.getTempFByIndex(0);
if(int(tempF) == -196){
Serial.println("Failed to read from DS18B20 sensor");
return "--";
} else {
Serial.print("Temperature Fahrenheit: ");
Serial.println(tempF);
}
return String(tempF);
}
const char index_html[] PROGMEM = R"rawliteral(
<!DOCTYPE HTML><html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" integrity="sha384-fnmOCqbTlWIlj8LyTjo7mOUStjsKC4pOpQbqyi7RrhN7udi9RwhKkMHpvLbHG9Sr" crossorigin="anonymous">
<style>
html {
font-family: Arial;
display: inline-block;
margin: 0px auto;
text-align: center;
}
h2 { font-size: 3.0rem; }
p { font-size: 3.0rem; }
.units { font-size: 1.2rem; }
.ds-labels{
font-size: 1.5rem;
vertical-align:middle;
padding-bottom: 15px;
}
</style>
</head>
<body>
<h2>ESP DS18B20 Server</h2>
<p>
<i class="fas fa-thermometer-half" style="color:#059e8a;"></i>
<span class="ds-labels">Temperature Celsius</span>
<span id="temperaturec">%TEMPERATUREC%</span>
<sup class="units">°C</sup>
</p>
<p>
<i class="fas fa-thermometer-half" style="color:#059e8a;"></i>
<span class="ds-labels">Temperature Fahrenheit</span>
<span id="temperaturef">%TEMPERATUREF%</span>
<sup class="units">°F</sup>
</p>
</body>
<script>
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("temperaturec").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/temperaturec", true);
xhttp.send();
}, 10000) ;
setInterval(function ( ) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("temperaturef").innerHTML = this.responseText;
}
};
xhttp.open("GET", "/temperaturef", true);
xhttp.send();
}, 10000) ;
</script>
</html>)rawliteral";
// Replaces placeholder with DS18B20 values
String processor(const String& var){
//Serial.println(var);
if(var == "TEMPERATUREC"){
return temperatureC;
}
else if(var == "TEMPERATUREF"){
return temperatureF;
}
return String();
}
void setup(){
// Serial port for debugging purposes
Serial.begin(115200);
Serial.println();
// Start up the DS18B20 library
sensors.begin();
temperatureC = readDSTemperatureC();
temperatureF = readDSTemperatureF();
// Connect to Wi-Fi
WiFi.begin(ssid, password);
Serial.println("Connecting to WiFi");
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println();
// Print ESP Local IP Address
Serial.println(WiFi.localIP());
// Route for root / web page
server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/html", index_html, processor);
});
server.on("/temperaturec", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", temperatureC.c_str());
});
server.on("/temperaturef", HTTP_GET, [](AsyncWebServerRequest *request){
request->send(200, "text/plain", temperatureF.c_str());
});
// Start server
server.begin();
}
void loop(){
if ((millis() - lastTime) > timerDelay) {
temperatureC = readDSTemperatureC();
temperatureF = readDSTemperatureF();
lastTime = millis();
}
}
💰 JUSTWAY is offering 15% cashback on all orders placed between June 1st – August 31st, 2025 (UTC). If you’re 3D printing your enclosure or need CNC machining, this is the best time to save!
Follow this link to get a Summer cashback from JUSTWAY
✔ Get 15% cashback to reduce production costs
✔ Works for CNC, 3D Printing, and Sheet Metal fabrication
✔ Cashback credited within 3 business days
✔ Combine cashback with coupons and loyalty points for extra savings!
📌 How to Apply1️⃣ Place an order with JUSTWAY between June 1st – August 31st, 2025.
2️⃣ Once your order is completed, email marketing03@justway.com with your order number and JUSTWAY account details.
3️⃣ JUSTWAY will review your order, and upon approval, 15% of your order value will be credited to your account.
Final ThoughtsWith the DFROBOT Beetle ESP32 C3, Dallas DS18B20, and JUSTWAY’s expert 3D printing, you can create a robust, wireless temperature monitoring system that’s perfect for outdoor or industrial applications.
🚀 Ready to Build Your Own?Follow this link to get a Summer cashback from JUSTWAY
🛒 Order your 3D prints today via JUSTWAY and claim your 15% cashback before August 31st, 2025! 📩 After ordering, email marketing03@justway.com to apply for cashback!
Comments