Go Down

Topic: DS18B20 waterproof Temp sensor - Sharing project to take pool temperaure (Read 414 times) previous topic - next topic


So far I have the temp sensor taking temp readings and Serial.print it on the serial display.
Next, I'm going to attempt to port that over to a Wemos(Now called LOLIN I think) ESP8266.
After that, I will connect to my WiFi and report the water temp of my pool to Home Assistant via MQTT.

Oh, no!  Bad day.  I didn't realize I was out of ESP8266's.  I have (1), but that's being used for another experiment.  Let's see how low the shipping takes this time.

For now; here's my current sketch:

Code: [Select]
   DS18B20 Waterproof Temp Sensor
   By Nick Sebring
   5V(red), GND(black), Data(yellow)
   4.7K Resistor between 5V & Data line (Pullup Resistor)
#include <OneWire.h>
#include <DallasTemperature.h>

#define ONE_WIRE_BUS 8   //  Pin 8
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

void setup(void)
  // start serial port
  Serial.println("DS18B20 Waterproof Temperature Sensor");
void loop(void)
  sensors.requestTemperatures(); // get temperature from sensor

  //  ****************  CREATE BUFFER TO STORE BINARY DATA ***********
#define INT_STR_SIZE 16
  char buffer[INT_STR_SIZE];

  //  ****************  READ DATA FROM SENSOR ************************
  //  If you want Celcius, change F to C
  dtostrf(sensors.getTempFByIndex(0), 3, 1, buffer);//  1= decimal places

  //  ****************  DISPLAY TEMPERATURE DATA *********************
  Serial.println(" *F");

  delay(500);//  May adjust this to take readings less often (something like every 30-60 minutes).



Actually no.  Not at this time.  I was on Youtube and someone had asked if I had gotten my Temp sensors to show up in Home Assistant. Which I have.  I played with other Temp sensors and got them to show up in Home Assistant.  I've had this DS18B20 for about a year.  It's cold and wet outside, hence focusing on indoor activities.  Should be fairly straight forward.  But first I need more Wemos D-1 minis.  Just thought I would log in and share my progress.

Good to see you still around.  You have helped me out on a few other projects.  Thanks for that!


Shouldn't this be in the Exhibition / Gallery section ?

Two or three hours spent thinking and reading documentation solves most programming problems.

Go Up