Hi superjuice,
If you want to “play” with the DS18b20 you need two libraries: “OneWire” and “DallasTemperature”
You can find below both libraries:
http://www.pjrc.com/teensy/arduino_libraries/OneWire.zip
https://github.com/milesburton/Arduino-Temperature-Control-Library/archive/master.zip
After that, I did a small PCB (I enjoy soldering small boards… call me crazy ) because a 4.7k pull-up resistor must be connected to the 1-wire bus.
The code is like this:
#include <ESP8266_HardSer.h>
#include <BlynkSimpleShieldEsp8266_HardSer.h>
#include <SimpleTimer.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define EspSerial Serial1 // Serial 1 Arduino Pro Micro!!!
SimpleTimer timer;
ESP8266 wifi(EspSerial);
#define Pin 3// pin DATA ds18b20
char auth[] = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
OneWire ourWire(Pin);
DallasTemperature sensors(&ourWire);
void setup()
{
// Set console baud rate
Serial.begin(9600);
delay(10);
EspSerial.begin(9600);
delay(10);
Blynk.begin(auth, wifi,"xxxxx","xxxxxxxxxxxxxxxx","xxx.xxx.x.xx");
delay(10);
sensors.begin();
delay(10);
timer.setInterval(2000L, leeTEMP);
}
void leeTEMP()
{
sensors.requestTemperatures();
Blynk.virtualWrite(0, sensors.getTempCByIndex(0));
}
void loop()
{
Blynk.run();
timer.run();
}
And some photos:
Let me know your comments!
Regards