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.

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

The project was born from me and my son for the competition Arduino Internet of Holiday Things, who declined to be able to turn on remote heating the house or the garden lights or christmas lights and operate the alarm, and while the holidays? Here ‘IOT and MKR100 possible and even easy and low cost. Now I will explain how to proceed.

 

 

Schematics

My Home1000 Holiday

Here’s your first circuit diagram …
And in the process of development and improvement

Code

/**************************************************************
 * 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();
}

Source : My Home1000 Holiday Things for HOME Automation & Control


About The Author

Ibrar Ayyub

I am an experienced technical writer holding a Master's degree in computer science from BZU Multan, Pakistan University. With a background spanning various industries, particularly in home automation and engineering, I have honed my skills in crafting clear and concise content. Proficient in leveraging infographics and diagrams, I strive to simplify complex concepts for readers. My strength lies in thorough research and presenting information in a structured and logical format.

Follow Us:
LinkedinTwitter

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top