OC
OceanRemote
Low-code IoT platform
Back to Troubleshooting Hub

DS18B20 Not Detected

Your DS18B20 temperature sensor is not detected by OceanRemote. The dashboard shows no temperature or "-" for readings. The 1-Wire bus cannot find the sensor. This guide covers pull-up resistor requirements, wiring issues, addressing problems, and common DS18B20 detection failures on ESP32, ESP8266, and Pico W.

Last updated: April 22, 2026 | 10 min read

Symptoms

  • Dashboard shows no temperature or "-" for DS18B20
  • Serial Monitor shows "[SENSOR] DS18B20 read failed - sending error code -999"
  • OneWire scan returns 0 devices
  • Sensor worked before but stopped working after rewiring
  • Multiple DS18B20 sensors work but specific sensor doesn't
  • Sensor detected intermittently
  • Library compilation error: "OneWire.h: No such file or directory"

Common Causes

  1. Missing 4.7k Pull-up Resistor DS18B20 requires pull-up resistor between DATA and VCC
  2. Wrong GPIO Pin Using pin that doesn't support OneWire or incorrect pin in code
  3. Wiring Errors Loose connections, wrong pin order, or reversed VCC/GND
  4. OneWire Library Not Installed Missing OneWire or DallasTemperature libraries in Arduino IDE
  5. Long Wire Length Signal degradation on long 1-Wire bus
  6. Parasite Power Issues Using parasite power mode without proper configuration
  7. Faulty Sensor DS18B20 may be damaged from over-voltage or ESD

DS18B20 Pinout

Pin Name Connect To Notes
Left GND () GND () Must connect to ground ()
Middle DQ () GPIO pin Add 4.7k pull-up to VCC
Right VDD () 3.3V or 5V 3.3V recommended for ESP boards

Pin order: GND - DATA - VDD . Do not confuse with transistor pinout!

Correct Wiring Diagrams

ESP32 with DS18B20

ESP32                    DS18B20
                    
3.3V  VDD 
                         
                        4.7k resistor
                         
GPIO15  DQ 
GND   GND 

// Recommended GPIO pins: 4, 5, 15, 16, 17
// Avoid GPIO0, GPIO2, GPIO12 

ESP8266 with DS18B20

ESP8266         DS18B20
        
3.3V  VDD 
                         
                        4.7k resistor
                         
D2   DQ 
GND   GND 

// D1 Mini pins: D1=GPIO5, D2=GPIO4, D3=GPIO0, D4=GPIO2
// D2  is recommended for DS18B20

Pico W with DS18B20

Pico W                   DS18B20
                    
3.3V  VDD 
                         
                        4.7k resistor
                         
GPIO15   DQ 
GND   GND 

// Pico W GPIO options: 0-22 are safe
// GPIO15  works well

Step-by-Step Fixes

1. Add 4.7k Pull-up Resistor

DS18B20 requires a 4.7k pull-up resistor between DATA and VCC:

  • Connect 4.7k resistor between DATA pin and VCC
  • Without this resistor, the 1-Wire bus cannot communicate
  • Use 1/4 watt resistor
  • Color code: Yellow-Violet-Red-Gold
  • Place resistor as close to the DS18B20 as possible
  • For multiple sensors, one pull-up resistor is sufficient

2. Install OneWire and DallasTemperature Libraries

Missing libraries cause compilation errors:

  • Open Arduino IDE Sketch Include Library Manage Libraries
  • Search for "OneWire" Install "OneWire by Jim Studt"
  • Search for "DallasTemperature" Install "DallasTemperature by Miles Burton"
  • Restart Arduino IDE after installation
  • OceanRemote firmware includes these libraries automatically

3. Scan for Device Address

Verify if DS18B20 is responding:

// Upload this test sketch to find DS18B20 address
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 15  // Your GPIO pin
OneWire oneWire;
DallasTemperature sensors;

void setup() {
  Serial.begin;
  sensors.begin();
  
  Serial.print;
  Serial.println);
  
  // Print addresses of all devices
  for ; i++) {
    DeviceAddress address;
    sensors.getAddress;
    Serial.print;
    Serial.print(i);
    Serial.print;
    for  {
      Serial.print;
      if  Serial.print;
    }
    Serial.println();
  }
}

void loop() {}

4. Verify Wiring Connections

Check all connections with multimeter:

  • Use continuity mode to verify GNDGND connection
  • Verify DATAGPIO pin connection
  • Verify VDD3.3V/5V connection
  • Check that 4.7k resistor is between DATA and VCC
  • For waterproof DS18B20, red=VCC, black=GND, yellow/white=DATA
  • Check for cold solder joints or loose jumper wires

5. Test with Different GPIO Pin

Some pins may have issues:

  • Try different GPIO pin
  • Avoid GPIO0, GPIO2, GPIO12 on ESP32
  • Avoid GPIO0, GPIO2, GPIO15 on ESP8266 (boot strapping pins)
  • On Pico W, GPIO0-22 all work for DS18B20
  • Update OceanRemote firmware with new pin and re-flash

6. Shorten Wire Length

Long wires degrade 1-Wire signal:

  • Keep DATA wire under 10 meters for reliable operation
  • For longer runs, use active repeater or reduce to 5 meters
  • Use twisted pair cable for long runs
  • Use thicker wire for long runs
  • Avoid running DATA wire parallel to AC power lines

7. Test with Parasite Power Mode

DS18B20 can be powered via DATA line :

// Parasite power mode 
// DS18B20 gets power from DATA line
// Requires strong pull-up 

// Wiring for parasite mode:
// DS18B20 VDD   GND
// DS18B20 DQ   GPIO + 4.7k pull-up to VCC
// DS18B20 GND   GND

// In code, enable parasite power:
sensors.setWaitForConversion;  // Don't wait, use parasitic power

// Note: Parasite mode less reliable than normal mode
// Use normal mode  for best results

DS18B20 Address Format

Byte Meaning Example Notes
0 Family code ()0x28 Always 0x28 for DS18B20
1-6 Unique serial number ()0xA1, 0x2B, 0x45, ...Each sensor has unique ID ()
7 CRC checksum 0xXX ()Validates address integrity ()

DS18B20 family code is always 0x28. Other codes are for other 1-Wire devices.

Prevention Tips

  • Always use 4.7k pull-up resistor between DATA and VCC critical for 1-Wire communication
  • Use normal power mode instead of parasite mode for reliability
  • Keep wire length under 10 meters for stable communication
  • Use 3.3V power for ESP32/ESP8266 compatibility
  • For waterproof sensors, verify wire colors: red=VCC, black=GND, yellow=DATA
  • Test with OneWire scanner sketch before integrating into OceanRemote
  • If using multiple sensors, each needs unique address

Related Issues

Frequently Asked Questions

Q: Can I connect multiple DS18B20 sensors to the same pin?

A: Yes! The 1-Wire protocol supports multiple sensors on the same DATA pin. Each sensor has a unique 64-bit address. OceanRemote firmware currently reads only the first sensor, but you can modify the code to read all of them.

Q: Why 4.7k resistor? Can I use 10k?

A: 4.7k is the standard for 1-Wire at 3.3V-5V. 10k may work but can cause unreliable communication, especially with longer wires or multiple sensors. Always use 4.7k for best results.

Q: My DS18B20 was working but stopped. What happened?

A: Most likely: 1) Loose wire connection, 2) Pull-up resistor fell off, 3) Power supply issue, 4) ESD damage . Check wiring first. If using waterproof sensor, check for water ingress at the probe.

Still having detection issues? Contact Support or return to the Troubleshooting Hub.