I want to connect a DS18B20 to my newly bought Heltec ESP32 LoRa (V2). For initial testing I have used some standard code:

#include "heltec.h"
#include <OneWire.h>
#include <DallasTemperature.h>

OneWire ds(14);
DallasTemperature sensors(&ds);

void getDS18B20values()
  Serial.print(" Requesting therms...");

  uint8_t count = sensors.getDeviceCount();
  for (int i = 0; i < count; i++)
    Serial.print("Temperature " + String(i) + "is: " + String(sensors.getTempCByIndex(i)));


void setup()

  //WIFI Kit series V1 not support Vext control
      true /*DisplayEnable Enable*/,
      true /*Heltec.LoRa Disable*/,
      true /*Serial Enable*/,
      true /*PABOOST Enable*/,
      868E6/*long BAND*/);

  sensors.begin(); // initialize therm-sensors

void loop()


Here's a quick schematic I designed with the designer provided by stackexchange. Not all parts were available so I had to improvise a litte. I hope it is accurate enough.


simulate this circuit – Schematic created using CircuitLab

Another weird thing is that if I wire it all up I can start the ESP but I can't flash any new software to it because it doesn't react. So I assume it's a wiring issue the code should be fine but I posted it anyway. I had tested it with multiple DS18B20 sensors. A while ago on an Arduino they were all still working. I am more experienced with Arduinos than with ESPs. Are there any differences in regard to the wiring I have to be careful of?

Edit: I already have some sensored wired to the ESP, a BH1750, DHT11, an analog soil moisture sensor and an analog light dependent resistor.

  • Please just use a blank rectangle if you can't find the proper schematic symbols instead of random components. – StarCat Jun 6 '20 at 9:18
  • You should become sceptical when connecting two pins of a device together :) if that was correct, the manufacturer hinself could have connected those pins inside the device and one of the pins wouldn't be there – Sim Son Jun 6 '20 at 22:23

I have not checked your code, but you certainly have a wiring issue.

There are two main problems.

  1. Your Vcc is connected to the data output of the DS18B20. This means you will never read anything except logic "high" from the data output.
  2. The 4k7 resistor should not be connected this way. See the schematic below on how it should be connected. You could also set up a data pin with an internal pullup so you don't need an external pullup.

This is roughly how it should look.


simulate this circuit – Schematic created using CircuitLab

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.