MJRoBot
Published © GPL3+

IoT Made Simple: Monitoring Temperature Anywhere

We will learn how to capture temperature data, upload it to internet with a NodeMCU and monitor it on a Smart device using a Blynk app.

BeginnerFull instructions provided4 hours10,440
IoT Made Simple: Monitoring Temperature Anywhere

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Temperature Sensor DS18B20
×1
Resistor 4.75k ohm
Resistor 4.75k ohm
×1

Software apps and online services

Arduino IDE
Arduino IDE
Blynk
Blynk

Story

Read more

Schematics

Temp Monitor

Code

Code snippet #1

C/C++
/************************************************************** 
 * IoT Temperature Monitor with Blynk
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 * 
 * Developed by Marcelo Rovai - 05 January 2017
 ***************************************************************/
/* ESP & Blynk */
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>
#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
char auth[] = "YOUR AUTH CODE HERE";
/* WiFi credentials */
char ssid[] = "YOUR SSID";
char pass[] = "YOUR PASSWORD";
/* TIMER */
#include <SimpleTimer.h>
SimpleTimer timer;
/* DS18B20 Temperature Sensor */
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2 // DS18B20 on arduino pin2 corresponds to D4 on physical board
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature DS18B20(&oneWire);
float temp;
void setup() 
{
  Serial.begin(115200);
  Blynk.begin(auth, ssid, pass);
  DS18B20.begin();
  timer.setInterval(1000L, getSendData);
}
void loop() 
{
  timer.run(); // Initiates SimpleTimer
  Blynk.run();
}
/***************************************************
 * Send Sensor data to Blynk
 **************************************************/
void getSendData()
{
  DS18B20.requestTemperatures(); 
  temp = DS18B20.getTempCByIndex(0);
  Serial.println(temp);
  Blynk.virtualWrite(10, temp); //virtual pin V10
}

Github file

https://github.com/adafruit/ESP8266-Arduino/tree/esp8266/libraries/OneWire

Github

https://github.com/milesburton/Arduino-Temperature-Control-Library

Credits

MJRoBot

MJRoBot

33 projects • 563 followers
Engineer, writer and forever student. Passionate to share knowledge of electronics with focus on IoT and robotics.

Comments

Add projectSign up / Login