Project tutorial
Temperature Monitor with IoT

Temperature Monitor with IoT © GPL3+

Blynk app makes everything easy! Notifications, settings, probe, battery level and more...

  • 416 views
  • 0 comments
  • 0 respects

Components and supplies

Necessary tools and machines

3drag
3D Printer (generic)
09507 01
Soldering iron (generic)
4966285
Solder Wire, Lead Free

Apps and online services

About this project

I am preparing room for my baby. For this reason monitoring room temperature and moisture is really important. Solution is simple;

  • Use DHT11 to get temp and hum values,
  • ESP8266 collects values and sends to the blynk servers
  • AMS117 breakout board regulates power to 3.2 volt coming from lipo
  • Lipo charger charges the lipo
  • DS18B20 measures bath water temperature
  • 10k - 20k voltage divider limits voltage to measure battery level over analog input
  • blnk sends notification to mobile phone and tracks temperature

Code

Arduino IDE CodesArduino
This is esp8266 code
#define BLYNK_PRINT Serial
#include <ESP8266WiFi.h>
#include <BlynkSimpleEsp8266.h>

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);

#include "DHTesp.h"

DHTesp dht;


char auth[] = "uGDn56XGhJS7TkEb0D_gAzkFL66czQDs";
char ssid[] = "y-home";
char pass[] = "Yurdakul9988!";
BlynkTimer timer;


float temp;
int lowTemp;
int hiTemp;
float ambTemp;
float ambHum;

byte notifState = 0;

bool isFirstConnect = true;
BLYNK_CONNECTED() {
  if (isFirstConnect) {
    Blynk.syncAll();
    isFirstConnect = false;
  }
}

void setup()
{

  Blynk.begin(auth, ssid, pass);
  timer.setInterval(10000L, tempSend);
  timer.setInterval(5000L, probeSend);
  timer.setInterval(10000L, notifSend);
  sensors.begin();
  dht.setup(14, DHTesp::DHT11); // Connect DHT sensor to GPIO 17
}

BLYNK_WRITE(V1) {
  byte value = param.asInt();
  lowTemp = value;
}

BLYNK_WRITE(V2) {
  byte value = param.asInt();
  hiTemp = value;
}

BLYNK_WRITE(V3) {
  byte value = param.asInt();
  notifState = value;
}

void tempSend() {

  float humidity = dht.getHumidity();
  float temperature = dht.getTemperature();

  ambTemp = temperature;
  ambHum = humidity;
  Blynk.virtualWrite(V11, ambTemp);
  Blynk.virtualWrite(V12, ambHum);

  // Blynk.setProperty(V0, "color", "#FF0000");
  // Blynk.setProperty(V0, "color", "#00FF00");
}

void probeSend() {
  sensors.requestTemperatures();
  temp = sensors.getTempCByIndex(0);
  Blynk.virtualWrite(V10, temp);
}

void notifSend() {
  if (notifState == 1 && ambTemp >= hiTemp) {
    Blynk.notify("Oda sicakligi cok yusek!");
    delay(300);
    Blynk.virtualWrite(V3, 0);
    notifState = 0;
  }
  if (notifState == 1 && ambTemp <= lowTemp) {
    Blynk.notify("Oda sicakligi cok dusuk!");
    delay(300);
    Blynk.virtualWrite(V3, 0);
    notifState = 0;
  }
}


void loop()
{
  Blynk.run();
  timer.run();
}

Comments

Add projectSign up / Login