Blynk Edgent with DS18B20 on ESP32

Hey there,

so i´m having a pretty strange behavior. Using Blynk.Edgent i can´t read DS18B20 Sensors. It´s just measuring -127.00°C.

Using only BlynkSimpleEsp32_SSL it´s working fine, also does it when i comment BlynkEdgent.run() out.

What could cause this? Is the overhead that comes with the Edgent Library too big? I really would like to use Edgent because of the WiFi Manager and Blynk.Air . Maybe some of you know a solution to this.


/*==============================================================================
 * Blynk Parameter
 *============================================================================*/
#define BLYNK_TEMPLATE_ID "TMPLhsDUJ-un"
#define BLYNK_DEVICE_NAME "ThermoWatch 21041001"
#define BLYNK_FIRMWARE_VERSION "0.1.7"
#define BLYNK_PRINT Serial
//#define BLYNK_DEBUG
//#define APP_DEBUG

/*==============================================================================
 * Include Section
 *============================================================================*/

#include "Arduino.h"
#include "BlynkEdgent.h"
#include <OneWire.h>
#include <DallasTemperature.h>
//#include <U8g2lib.h>
//#include <Wire.h>
//#include <string>
//using namespace std;

/*==============================================================================
 * Sensor Bus Parameter
 *============================================================================*/
#define ONE_WIRE_BUS 4

// SensorBus Init
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

// Sensor Adressen auf dem BUS
DeviceAddress sensor1 = { 0x28, 0xFF, 0x64, 0x1E, 0x23, 0x86, 0x07, 0x1D };

// Sensor Variablen
BlynkTimer SensorTimer;
byte resolution = 10; // Sensor Auflösung
float TempSensor1; // Zwischenspeicher zum auslesen

/*==============================================================================
 * BUS Abfrage
 *============================================================================*/

void readBusandSend()
{
  sensors.requestTemperatures();
  TempSensor1 = sensors.getTempC(sensor1); 
  Blynk.virtualWrite(1, TempSensor1);
  Serial.println(TempSensor1);
}

void setup()
{
    // Show Boot Screen
  Serial.begin(115200);

  // Sensor init
  sensors.begin();
  sensors.setResolution(sensor1, resolution);
  //sensors.setWaitForConversion(false);

  // Blynk init
  BlynkEdgent.begin();
  SensorTimer.setInterval(5000L, readBusandSend);
  // Non Blocking Loop Delay start

}

/*==============================================================================
 * Main Loop
 *============================================================================*/

void loop()
{
  // Start Blynk
  BlynkEdgent.run();
  SensorTimer.run();
}

Take this out of your void loop.

also, you should add a 4.7k pull-up resistor between the signal and power pin.

Sorry for the confusion, this is supposed to be in the timer function for testing purposes, but even without it doesn´t work. I´m already using an 4,7k resistor.

Should not the pin on blynk be a Virtual pin (V1) and not a Digital pin. I also sit with the same problem, but I need a 4.7k pull up resistor, so I must order 1 first, lol.

You don’t have a board type defined, so the custom board type will be used. Unless you’ve changed the pin assignments in Settings.h then GPIO4 is already in use for the LED the indicates the Edgent provisioning state.

You should read the “Defining your physical switch and LED” section of this tutorial for more info…

Pete.

1 Like

HHM :flushed: I don´t quite know what to say, such a dumb thing to make this happen. Thank you very much. I would have taken a very long time to come up with that. I used a Heltec board before and therefor created my own board type, but after changing to the ESP32DEV Board i just removed the Board Type and now thats what happened :blush:

1 Like