dont know if this is any help, but I found a tutorial/sketch with a DS18b20 “id reader” and then a sketch for using the DS18b20 with a nodemcu. Its a more manual approach but works.
The ID reader:
include <SimpleTimer.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 // This is the ESP8266 pin D4
OneWire ds(ONE_WIRE_BUS);
DallasTemperature sensors(&ds);
SimpleTimer timer;
void setup()
{
Serial.begin(115200); // See the connection status in Serial Monitor
getDeviceAddress();
}
void getDeviceAddress(void) {
byte i;
byte addr[8];
Serial.println(“Getting the address…\n\r”);
/* initiate a search for the OneWire object we created and read its value into
addr array we declared above*/
while(ds.search(addr)) {
Serial.print(“The address is:\t”);
//read each byte in the address array
for( i = 0; i < 8; i++) {
Serial.print(“0x”);
if (addr[i] < 16) {
Serial.print(‘0’);
}
// print each byte in the address array in hex format
Serial.print(addr[i], HEX);
if (i < 7) {
Serial.print(", ");
}
}
// a check to make sure that what we read is correct.
if ( OneWire::crc8( addr, 7) != addr[7]) {
Serial.print(“CRC is not valid!\n”);
return;
}
}
ds.reset_search();
return;
}
void loop(void) {
timer.run();
}
It outputs hex string(s) which is the ID(s) of the DS18b20(s)
Insert those in below sketch
then a DS18b20 blynk sketch with two sensors:
#include <SimpleTimer.h>
#define BLYNK_PRINT Serial // Comment this out to disable prints and save space
#include <BlynkSimpleEsp8266.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 // (nodemcu D4 = 2) This is the ESP8266 pin
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
DeviceAddress tempSensor1 = { INSERT HEX HERE }; // Temperature probe #1
DeviceAddress tempSensor2 = { 0x28, 0xFF, 0x8F, 0x35, 0x16, 0x15, 0x03, 0x4F }; // Temperature probe #2
char auth = “******”; // Put your Auth Token here. (see Step 3 above)
SimpleTimer timer;
float temperature1, temperature2; // Variables for storing temperatures
void setup()
{
WiFi.mode(WIFI_STA);
Serial.begin(115200); // See the connection status in Serial Monitor
Blynk.begin(auth, “SSID”, “PASSWORD”); //insert here your SSID and password
while (Blynk.connect() == false) {
// Wait until connected
}
sensors.begin();
sensors.setResolution(tempSensor1, 12); // More on resolutions: http://www.homautomation.org/2015/11/17/ds18b20-how-to-change-resolution-9101112-bits/
sensors.setResolution(tempSensor2, 12);
// These timers are used to keep the loop() nice and leak… keeps Blynk from getting flooded.
timer.setInterval(5000L, sendSensor1);
}
void loop()
{
Blynk.run();
timer.run();
}
void sendSensor1() {
sensors.requestTemperatures(); // Polls the sensors
temperature1 = sensors.getTempC(tempSensor1); // Stores temp in F. Change getTempF to getTempC for celcius.
Blynk.virtualWrite(5, temperature1); // Send temp to Blynk virtual pin 1
temperature2 = sensors.getTempC(tempSensor2);
Blynk.virtualWrite(6, temperature2);
Blynk.virtualWrite(7, temperature1-temperature2);
}
void sendWifi()
{
Blynk.virtualWrite(1, map(WiFi.RSSI(), -105, -40, 0, 100) );
}
Where:
V5 is Temp1
V6 is Temp2
V7 is Temp diff between the two (something I needed in my project)
V1 is wifi signal