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...");
sensors.requestTemperatures();
Serial.println("DONE");
uint8_t count = sensors.getDeviceCount();
for (int i = 0; i < count; i++)
{
Serial.print("Temperature " + String(i) + "is: " + String(sensors.getTempCByIndex(i)));
}
delay(1000);
}
void setup()
{
//WIFI Kit series V1 not support Vext control
Heltec.begin(
true /*DisplayEnable Enable*/,
true /*Heltec.LoRa Disable*/,
true /*Serial Enable*/,
true /*PABOOST Enable*/,
868E6/*long BAND*/);
sensors.begin(); // initialize therm-sensors
}
void loop()
{
getDS18B20values();
delay(1500);
}
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.