Massimo Cestra
Published © GPL3+

My Home1000 Holiday Things for HOME Automation & Control

Remotely we control our home with MKR1000 and IOT of Blynk. We can manage the boiler, the 'anti-theft irrigation, open the Automatic Gate.

IntermediateShowcase (no instructions)3 days10,292
My Home1000 Holiday Things for HOME Automation & Control

Things used in this project

Hardware components

Arduino MKR1000
Arduino MKR1000
×1
DHT11 Temperature & Humidity Sensor (4 pins)
DHT11 Temperature & Humidity Sensor (4 pins)
×2
SparkFun BMP180 Barometric Pressure Sensor Hookup
×1
Modulo Relè 4 canali DC 5V per Arduino
×2
N° 1 Modulo Relè per Arduino
×3

Software apps and online services

Blynk
Blynk
Arduino IDE
Arduino IDE

Story

Read more

Schematics

My Home1000 Holiday

Here's your first circuit diagram ...
And in the process of development and improvement

The Video of Draft

Code

My HOME1000 Holiday Things

Arduino
/**************************************************************
 * Blynk is a platform with iOS and Android apps to control
 * Arduino, Raspberry Pi and the likes over the Internet.
 * You can easily build graphic interfaces for all your
 * projects by simply dragging and dropping widgets.
 *
 *   Downloads, docs, tutorials: http://www.blynk.cc
 *   Blynk community:            http://community.blynk.cc
 *   Social networks:            http://www.fb.com/blynkapp
 *                               http://twitter.com/blynk_app
 *
 * Blynk library is licensed under MIT license
 * This example code is in public domain.
 *
 **************************************************************
 * This example shows how to use Arduino MKR1000
 * to connect your project to Blynk.
 *
 * NOTE: You may need to install WiFi101 library through the
 *       Arduino IDE Library Manager.
 *
 * Feel free to apply it to any other example. It's simple!
 *
 **************************************************************/

#define BLYNK_PRINT Serial    // Comment this out to disable prints and save space
#include <SPI.h>
#include <WiFi101.h>
#include <BlynkSimpleMKR1000.h>
#include <Adafruit_BMP085.h>
#include <Wire.h>
#include <SimpleTimer.h>
#include "DHT.h"

#define DHTPIN 1    // what pin we're connected to, pin1 is 5th pin from end


const int caldaia =  7;
const int luci =  6;
const int stato = luci ;

//#define DHTTYPE DHT21  // DHT 21
#define DHTTYPE DHT22  // DHT 22

Adafruit_BMP085 bmp;
  

DHT dht(DHTPIN,DHTTYPE);
SimpleTimer timer;

// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth[] = "INSERT YOUR AUTH";

// Your WiFi credentials.
// Set password to "" for open networks.
char ssid[] = "xxxxxxxxxxxxxx"; //  your network SSID (name)
char pass[] = "xxxxxxxxx";    //your network password
int keyIndex = 0;     // your network key Index number (needed only for WEP)

void sendSensor()
{


 float h = dht.readHumidity();
  // Read temperature as Celsius (the default)
  float t = dht.readTemperature();
  // Read temperature as Fahrenheit (isFahrenheit = true)
  float f = dht.readTemperature(true);

  // Check if any reads failed and exit early (to try again).
  if (isnan(h) || isnan(t) || isnan(f))
  {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }

  // Compute heat index in Fahrenheit (the default)
  float hif = dht.computeHeatIndex(f, h);
  // Compute heat index in Celsius (isFahreheit = false)
  float hic = dht.computeHeatIndex(t, h, false);
  
   
   
    float t1 = bmp.readTemperature();
    float p  = bmp.readPressure()/100;
    float alt = bmp.readAltitude();
    
    
    // This command writes t1 to Virtual Pin (0)
    Blynk.virtualWrite(V11, t1);
    // This command writes p to Virtual Pin (0)
    Blynk.virtualWrite(V10, p);
 
Blynk.virtualWrite(V12, alt);

  Blynk.virtualWrite(V2, h);
Blynk.virtualWrite(V3, t);

}

void setup()
{
  Serial.begin(9600);
  Blynk.begin(auth, ssid, pass);
  // Or specify server using one of those commands:
  //Blynk.begin(auth, ssid, pass, "blynk-cloud.com", 8442);
  //Blynk.begin(auth, ssid, pass, server_ip, port);

   dht.begin();
   Wire.begin(); // required by BMP180
    bmp.begin();
    timer.setInterval(1000L, sendSensor);

pinMode(caldaia, OUTPUT);


  
   

}
BLYNK_CONNECTED() {
Blynk.syncVirtual(V20);
}
// This function will be called every time
// when App writes value to Virtual Pin 1
BLYNK_WRITE(V20)
 {
 if(param.asInt()==1)
  {
     digitalWrite(caldaia, LOW);
  }
  else
  {
     digitalWrite(caldaia, HIGH);
  }
 }


void loop()
{


 




 
 
 timer.run(); // Initiates SimpleTimer
    Blynk.run();
}

Credits

Massimo Cestra

Massimo Cestra

2 projects • 22 followers

Comments