Help to implement DS18B20s via RF due to wire restrictions

JohnRob

This Development module?
NodeMCU ESP8266 ESP-12 WiFi Development Board Module ESP 8266 ESP8266MOD US SHIP | eBay

Would I then implement “ogiewon” Hubduino into Hubitat ?

Can you educate me on the firmware and Hubitat driver for Temp probs?

Would the drive be the same if used SHT30s or DS18B20s ?

THANKs what a great Readme.md
Would these be a good choice to start with?
Amazon.com: HiLetgo 3pcs ESP8266 NodeMCU CP2102 ESP-12E Development Board Open Source Serial Module Works Great for Arduino IDE/Micropython (Large) : Electronics
I am still a bit behind how all this work but will to try.
For example these guys say the use a IDE Micropyton? would that be overwriten or used as a Core?

I have hubduino running on two of that 12E board and it works great.

I also am running Konnected on one of those. It is also working great.

Yes, those would work with HubDuino.

When the Arduino IDE uploads the program to the ESP8266 microcontroller, it replaces anything that was preinstalled on the board.

These little microcontrollers do not run an operating system. They simply run a purpose built application, which you create using the Arduino IDE. They are a great example of the KISS principle! Very simple, yet very effective.

If you have additional questions, please feel free to reach out.

Have a lot of catch up to do. This will take me a while.
My last project was several years ago using Arduino mini with MRF24WB0MA called redback
With a plug in miniUSB board. Then captured TCP/IP to use it in other projects. bla bla.

How can I tell if the ESP8266 I order is 3.02?

Do you have a recommendation on which temp sensor I should use with HubDuino that I will place inside of a Freezer? One that I hope will connect direct to the ESP8266.

Really appreciate how helpful you are, thanks.

Not sure what you mean by 3.02? The HiLetgo ESP8266 boards you linked above from Amazon will work with DS18B20 temperature sensors, as long as you wire them up correctly.

For example...

You mentioned using DS18B20 temperature sensors. I find these to be very reliable, much more so than the DHT11 or DHT22 sensors.

Maybe something like this?

https://www.amazon.com/TWTADE-Temperature-Waterproof-Stainless-DS18B20-3M-3/dp/B084TGGWZL?th=1

Got it! Doesn't get any better than this for support.
I have four (4) Hubitats across my family's homes and without this help would have been worthless.
Can't wait to have this work. HubDunino!

What is the V3.02 reference mean?
HubDuino v1.1.9 was tested using Arduino IDE 1.8.16 + ESP8266 v3.0.2

1 Like

Part 1 HubDuino/ST_Anything example sketches

Anything_Multiples_ESP8266WiFi.ino - NodeMCU v1.0 ESP8266-12e development board (no Arduino!)

What does “NO Arduino” mean ?

Is there a link to the ST anything repository in your read me?

It simply means that you can use the ESP8266 microcontroller all by itself. When I wrote ST_Anything for the SmartThings platform, it required the use of an actual Arduino UNO or Arduino MEGA board.

The ReadMe is contained in the GitHub repository for ST_Anything.

There are still some references to the old SmartThings code. Please follow the ReadMe found in the HubDuino folder.

Ahh, that is the v3.02 of the Arduino Board support package for the ESP8266. You'll need to add support for the ESP8266 platform to your Arduino IDE. There are plenty of instructions for how to do this online. For example, you can follow the instructions below

Should this help be on an Aduino sight somewhere?

IDE 2 is not communicating with ESP8266 (NodeMCU 1.0 (ESP-12E) on Port 1.

The HubDuino Readme set speed at 115200 in IDE along with port set to (what is in Device Manager). Did that ok.

Tried serval ports. Two separate ESP8266s.

Win11 PC does not do a dong sound when plug in the ESP8266 board.

Upload error says “A fatal esptool.py error occurred”

Am I getting the right USB driver for Win11?

Downloaded from Silicon Labs CP210X USB Windows Drivers with Serial Enumerator? Don’t think it is installing. Do Not see any indication the USB driver in Device Manager, just the standard Port (Com & LPT) as (COM1). Would think say something about driver?

Does IDE 2 even need a Win 11 USB driver to a ESP8266 (NodeMCU 1.0 (ESP-12E) board?
Since My FTDI USB to Serial cable works just fine in the same USB port that I have tried to connect to the ESP8266, although it does show up on COM5 and leaves COM1 along.

SOLVED, IF PLUG IN THE ESP8266 BEFORE STARTING IDE 2 WIN11 FINDS THE PORT ON THE ESP8266 AS COM6. START IDE2 SET AS COM6 AND WORKS?

1 Like

Dead easy.

Nodemcu // konnected

WiFi, simple, cheap.

1 Like

Need this help:

What ESP8266 Sketches to compile and upload?
Please look at my Process completed below.
Is it complete minus what Sketches to compile and upload to ESP8266?
And Copy, past and save Drivers into Hubitat C8.

Process completed:
Installed Arduino IDE 2 and used Board manager to install “NodeMCU 1.0 (ESP-12E Module) corrected COM port. Blink code test worked.

Note: I’m not an experienced user of GitHub. Thanks for you instruciotns!

  • Downloaded the ST anything via zip
  • Copied all ST-Anything Sketches from the zip file to my local Documents/Arduino/Sketches folder.
  • Copied all ST-Anything libraries from the zip file to my local Documents/Arduino/libraries folder.
  • Tested an ST_Anything_Multiplex_ESP8266.ino sketch for hardware (ESP8266) for compiling. Compiled and uploaded ok.

Next to do:
What ESP8266 Sketches to compile and upload?
If multiple EXP8266 Sketches each have to be updated as follows.
Do I make Hubitat & Smarthings Hubs sketches both same IP address and hubPort number39501.
Arduino must be assigned a static TCP/IP address, Gateway, DNS, Subnet Mask, SSID+Password(ESP8266)

My objective:
One (1) NodeMCU 1.0 (ESP-12E Module) with the following requirements.
Temperature (DS18B20 Prob) 1 each
Temperature 3 pin (TO-92) DS18B20 1 each.
Contact sensor.
Water sensor.

One at a time, Copy, Paste, and Save the source code for ALL of the "child-.groovy" and "hubduino-parent-.groovy" Drivers found in ST_Anything/HubDuino/Drivers at master · DanielOgorchock/ST_Anything · GitHub

Wondering what I’m missing.

Best place to start is with the ST_Anything_Multiples_ESP8266WiFi.ino sketch. You are going to need to have one of these sketches for each of your ESP8266 microcontroller boards, as each will need its own TCP/IP address.

Here is a sketch to get you started that hopefully achieves the above objectives.

//******************************************************************************************
//  File: ST_Anything_jerrywolfer_ESP8266WiFi.ino
//  Authors: Dan G Ogorchock & Daniel J Ogorchock (Father and Son)
//
//  Summary:  This Arduino Sketch, along with the ST_Anything library and the revised SmartThings 
//            library, demonstrates the ability of one NodeMCU ESP8266 to 
//            implement a multi input/output custom device for integration into SmartThings.
//            The ST_Anything library takes care of all of the work to schedule device updates
//            as well as all communications with the NodeMCU ESP8266's WiFi.
//
//            ST_Anything_Multiples implements the following ST Capabilities as a demo of what is possible with a single NodeMCU ESP8266
//              - 1 x Contact Sensor devices (used to monitor magnetic door sensors)
//              - 1 x Temperature Measurement devices (Temperature from Dallas Semi 1-Wire DS18B20 device)
//              - 1 x Water Sensor devices (using the 1 analog input pin to measure voltage from a water detector board)
//    
//  Change History:
//
//    Date        Who            What
//    ----        ---            ----
//    2015-01-03  Dan & Daniel   Original Creation
//    2017-02-12  Dan Ogorchock  Revised to use the new SMartThings v2.0 library
//    2017-04-17  Dan Ogorchock  New example showing use of Multiple device of same ST Capability
//                               used with new Parent/Child Device Handlers (i.e. Composite DH)
//    2017-05-25  Dan Ogorchock  Revised example sketch, taking into account limitations of NodeMCU GPIO pins
//    2018-02-09  Dan Ogorchock  Added support for Hubitat Elevation Hub
//    2024-02-28  Dan Ogorchock  Modified per Jerry Wolfer's requirements
//
//******************************************************************************************
//******************************************************************************************
// SmartThings Library for ESP8266WiFi
//******************************************************************************************
#include <SmartThingsESP8266WiFi.h>

//******************************************************************************************
// ST_Anything Library 
//******************************************************************************************
#include <Constants.h>       //Constants.h is designed to be modified by the end user to adjust behavior of the ST_Anything library
#include <Device.h>          //Generic Device Class, inherited by Sensor and Executor classes
#include <Sensor.h>          //Generic Sensor Class, typically provides data to ST Cloud (e.g. Temperature, Motion, etc...)
#include <Executor.h>        //Generic Executor Class, typically receives data from ST Cloud (e.g. Switch)
#include <InterruptSensor.h> //Generic Interrupt "Sensor" Class, waits for change of state on digital input 
#include <PollingSensor.h>   //Generic Polling "Sensor" Class, polls Arduino pins periodically
#include <Everything.h>      //Master Brain of ST_Anything library that ties everything together and performs ST Shield communications

#include <PS_Illuminance.h>  //Implements a Polling Sensor (PS) to measure light levels via a photo resistor

#include <PS_DS18B20_Temperature.h>  //Implements a Polling Sesnor (PS) to measure Temperature via DS18B20 libraries 
#include <PS_Water.h>        //Implements a Polling Sensor (PS) to measure presence of water (i.e. leak detector)
#include <IS_Contact.h>      //Implements an Interrupt Sensor (IS) to monitor the status of a digital input pin

//*************************************************************************************************
//NodeMCU v1.0 ESP8266-12e Pin Definitions (makes it much easier as these match the board markings)
//*************************************************************************************************
//#define LED_BUILTIN 16
//#define BUILTIN_LED 16
//
//#define D0 16  //no internal pullup resistor
//#define D1  5
//#define D2  4
//#define D3  0  //must not be pulled low during power on/reset, toggles value during boot
//#define D4  2  //must not be pulled low during power on/reset, toggles value during boot
//#define D5 14
//#define D6 12
//#define D7 13
//#define D8 15  //must not be pulled high during power on/reset

//******************************************************************************************
//Define which Arduino Pins will be used for each device
//******************************************************************************************
#define PIN_WATER_1               A0  //NodeMCU ESP8266 only has one Analog Input Pin 'A0'

#define PIN_CONTACT_1             D2  //SmartThings Capabilty "Contact Sensor"
#define PIN_TEMPERATURE_1         D7  //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

//******************************************************************************************
//ESP8266 WiFi Information
//******************************************************************************************
String str_ssid     = "yourSSIDhere";                           //  <---You must edit this line!
String str_password = "yourWiFiPasswordhere";                   //  <---You must edit this line!
IPAddress ip(192, 168, 1, 227);       //Device IP Address       //  <---You must edit this line!
IPAddress gateway(192, 168, 1, 1);    //Router gateway          //  <---You must edit this line!
IPAddress subnet(255, 255, 255, 0);   //LAN subnet mask         //  <---You must edit this line!
IPAddress dnsserver(192, 168, 1, 1);  //DNS server              //  <---You must edit this line!
const unsigned int serverPort = 8090; // port to run the http server on

// Hubitat Hub Information
IPAddress hubIp(192, 168, 1, 143);    // hubitat hub ip         //  <---You must edit this line!
const unsigned int hubPort = 39501;   // hubitat hub port

//******************************************************************************************
//st::Everything::callOnMsgSend() optional callback routine.  This is a sniffer to monitor 
//    data being sent to ST.  This allows a user to act on data changes locally within the 
//    Arduino sktech.
//******************************************************************************************
void callback(const String &msg)
{
//  Serial.print(F("ST_Anything Callback: Sniffed data = "));
//  Serial.println(msg);
  
  //TODO:  Add local logic here to take action when a device's value/state is changed
  
  //Masquerade as the ThingShield to send data to the Arduino, as if from the ST Cloud (uncomment and edit following line)
  //st::receiveSmartString("Put your command here!");  //use same strings that the Device Handler would send
}

//******************************************************************************************
//Arduino Setup() routine
//******************************************************************************************
void setup()
{
  //******************************************************************************************
  //Declare each Device that is attached to the Arduino
  //  Notes: - For each device, there is typically a corresponding "tile" defined in your 
  //           SmartThings Device Hanlder Groovy code, except when using new COMPOSITE Device Handler
  //         - For details on each device's constructor arguments below, please refer to the 
  //           corresponding header (.h) and program (.cpp) files.
  //         - The name assigned to each device (1st argument below) must match the Groovy
  //           Device Handler names.  (Note: "temphumid" below is the exception to this rule
  //           as the DHT sensors produce both "temperature" and "humidity".  Data from that
  //           particular sensor is sent to the ST Hub in two separate updates, one for 
  //           "temperature" and one for "humidity")
  //         - The new Composite Device Handler is comprised of a Parent DH and various Child
  //           DH's.  The names used below MUST not be changed for the Automatic Creation of
  //           child devices to work properly.  Simply increment the number by +1 for each duplicate
  //           device (e.g. contact1, contact2, contact3, etc...)  You can rename the Child Devices
  //           to match your specific use case in the ST Phone Application.
  //******************************************************************************************
  //Polling Sensors
  static st::PS_Water               sensor1(F("water1"), 60, 20, PIN_WATER_1, 200);
  static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1); 
  
  //Interrupt Sensors 
  static st::IS_Contact             sensor3(F("contact1"), PIN_CONTACT_1, LOW, true);
  
  //*****************************************************************************
  //  Configure debug print output from each main class 
  //  -Note: Set these to "false" if using Hardware Serial on pins 0 & 1
  //         to prevent communication conflicts with the ST Shield communications
  //*****************************************************************************
  st::Everything::debug=true;
  st::Executor::debug=true;
  st::Device::debug=true;
  st::PollingSensor::debug=true;
  st::InterruptSensor::debug=true;

  //*****************************************************************************
  //Initialize the "Everything" Class
  //*****************************************************************************

  //Initialize the optional local callback routine (safe to comment out if not desired)
  st::Everything::callOnMsgSend = callback;
  
  //Create the SmartThings ESP8266WiFi Communications Object
    //STATIC IP Assignment - Recommended
    st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, ip, gateway, subnet, dnsserver, serverPort, hubIp, hubPort, st::receiveSmartString);
 
    //DHCP IP Assigment - Must set your router's DHCP server to provice a static IP address for this device's MAC address
    //st::Everything::SmartThing = new st::SmartThingsESP8266WiFi(str_ssid, str_password, serverPort, hubIp, hubPort, st::receiveSmartString);

  //Run the Everything class' init() routine which establishes WiFi communications with SmartThings Hub
  st::Everything::init();
  
  //*****************************************************************************
  //Add each sensor to the "Everything" Class
  //*****************************************************************************
  st::Everything::addSensor(&sensor1);
  st::Everything::addSensor(&sensor2);
  st::Everything::addSensor(&sensor3);
  
      
  //*****************************************************************************
  //Add each executor to the "Everything" Class
  //*****************************************************************************

  //*****************************************************************************
  //Initialize each of the devices which were added to the Everything Class
  //*****************************************************************************
  st::Everything::initDevices();
  
}

//******************************************************************************************
//Arduino Loop() routine
//******************************************************************************************
void loop()
{
  //*****************************************************************************
  //Execute the Everything run method which takes care of "Everything"
  //*****************************************************************************
  st::Everything::run();
}

I have removed all of the non-essential stuff from the sketch to help avoid any confusion. Just focus on the lines that have the "<---You must edit this line!" comment at the end of them. These are all local network related items.

If you deploy more than one of these ESP8266's, each will need it's own copy of the sketch with the correct IP address for each microcontroller. Please do not create duplicate IP addresses on your network.

Hopefully this gets you moving forward again. Note: I have not tested the above sketch, as I am away from my main development system.

Thank you so much that really helped! done with that part.
ogiewon you really made this easy to do!
Temperature prob in Hubitat works great, will do the rest in a few weeks.

ofiwqon Not sure how to add the temperature sensor for room temp measurement.
Existing code:
#define PIN_TEMPERATURE_1 D7 //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

static st::PS_DS18B20_Temperature sensor2(F("temperature1"), 15, 0, PIN_TEMPERATURE_1, false, 10, 1);

st::Everything::addSensor(&sensor3);

Does this make sense to add the Dallas (TO-92) IC semiconductor DS1820?

#define PIN_TEMPERATURE_2 D6 //SmartThings Capabilty "Temperature Measurement" (Dallas Semiconductor DS18B20)

static st::PS_DS18B20_Temperature sensor4(F("temperature2"), 15, 0, PIN_TEMPERATURE_2, false, 10, 1);

st::Everything::addSensor(&sensor4);

Or if you have the time would be more than happy for an updated version of the one you already sent.

That looks like it should work. You may want to reduce the polling interval of both of these sensors, as temperatures rarely change as quickly as every 15s. You may also want to adjust the polling offset for the second sensor from 0s to 5s.

so, maybe something like

static st::PS_DS18B20_Temperature sensor4(F("temperature2"), 120, 5, PIN_TEMPERATURE_2, false, 10, 1);

This will prevent both DS18B20 sensors from being polled at the same time.

got it thanks!

Is the sketch password protected? asking for a password to upload?

Oh, forgot to ask how do I install multiple ES8266 on Hubitat with hubduino?

Nothing password protected. When you say “upload”, what exactly do you mean?

Simply add a Virtual Device, using the HubDuino Ethernet Parent driver, for each ESP8266.