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:
/*
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.begin(9600);
Serial.println("DS18B20 Waterproof Temperature Sensor");
sensors.begin();
}
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.print(buffer);
Serial.println(" *F");
delay(500);// May adjust this to take readings less often (something like every 30-60 minutes).
}