Things used in this project

Hardware components:
Linkitsmart7688
MediaTek Labs The MediaTek LinkIt™ Smart 7688 platform
×1
10167 01
DHT22 Temperature Sensor
×1
12002 04
Breadboard (generic)
×1
09590 01
LED (generic)
×1
11026 02
Jumper wires (generic)
×1
Rg relay a
RobotGeek Relay
×1
Adafruit industries ada592 image 75px
USB-A to Micro-USB Cable
×1
Adafruit industries ada1536 image
Buzzer
×1
08377 02 l
Resistor 330 ohm
×4
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
Camera (generic)
×1
Software apps and online services:
Ide web
Arduino IDE
Blynk logo avatars
Blynk

Schematics

My circuit
My elegant circuit
Linkit fritzing bb eqicygqvjg

Code

Blynk Bridge DHT22Arduino
My code
#define BLYNK_PRINT Serial
/* Set this to a bigger number, to enable sending longer messages */
//#define BLYNK_MAX_SENDBYTES 128
#include <Bridge.h>
#include <Process.h>
#include <BlynkSimpleYun.h>

char auth[] = "755c4016d214484480b80c5739068ef7";
byte b=0,c=0,d=0,e=0;
char a;
int LED = 5 ;

#include <DHT.h>
#define DHTPIN 6          // What digital pin we're connected to
#define DHTTYPE DHT22   // DHT 22, AM2302, AM2321
//#define DHTTYPE DHT21   // DHT 21, AM2301

DHT dht(DHTPIN, DHTTYPE);
BlynkTimer timer;

void sendSensor()
{
  float h = dht.readHumidity();
  float t = dht.readTemperature(); // or dht.readTemperature(true) for Fahrenheit

  if (isnan(h) || isnan(t)) {
    Serial.println("Failed to read from DHT sensor!");
    return;
  }
  // You can send any value at any time.
  // Please don't send more that 10 values per second.
  Blynk.virtualWrite(V5, h);
  Blynk.virtualWrite(V6, t);
}

void setup() {
  // put your setup code here, to run once:
  Bridge.begin();
  Blynk.begin(auth);
  dht.begin();
  timer.setInterval(1000L, sendSensor);
  pinMode(LED, OUTPUT);
  digitalWrite(LED, LOW);
  Serial.begin(9600);
  Serial.print("Hola, para tomar una foto favor de mandar un 1");
  

}

void loop() {
  // put your main code here, to run repeatedly:
  Blynk.run();
  timer.run();
  a=Serial.read();
  if(a=='1')
  {
  digitalWrite(LED, HIGH); 
  Blynk.email("pufyx1@gmail.com", "Intruso", "Hay alguien inesperado en la casa, revisa la foto en dropbox"); 
  takePicture();
  uploadPicture();
  a=0;  
  digitalWrite(LED, LOW);  
  }
}


void takePicture() {
  Process p; // Create a new process
  p.begin("fswebcam"); // Run the fswebcam utility, but first...
  p.addParameter("/root/app/pic.jpg"); // add a path parameter
  p.addParameter("-r 1280x720"); // and a resolution parameter
  p.run(); // now run it and and wait for its termination
}

void uploadPicture() {
  Process p; 
  p.begin("python"); 
  p.addParameter("/root/app/dropy.py"); 
  p.run(); 
}
Send photoPython
Code for send photo to dropbox, using dropbox api
import dropbox
import datetime 
suffix = datetime.datetime.now().strftime("%Y-%m-%d-%H-%M-%S")
filename = "photobooth-" + suffix + ".jpg" 

client = dropbox.client.DropboxClient('YOURACCESSTOKENGOESHERE')
f = open('/mnt/sda1/pic.jpg', 'rb')
response = client.put_file(filename, f)
print "uploaded:", response

Credits

Soka cdsdtvc7fp
Alexis Santiago Allende

Im a person who since young feel a passion for electronics, I also like to cook pizza and travel. Now Im working on the internet of things

Contact

Replications

Did you replicate this project? Share it!

I made one

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

Linkit One: Blowing an LED
Intermediate
  • 976
  • 27

Full instructions

In this tutorial I Will show you how to turn on an led with your mouth. The Led will turn on when start to blow the sound sensor.

Linkit One: Water Level Indicator
Intermediate
  • 1,095
  • 26

In this project we will learn on making water level indicator using linkit one. This project could help you save water more efficiently.

Understanding LinkIt ONE ScanNetworks
Intermediate
  • 921
  • 18

Protip

I found a sketch called "ScanNetworks" in the LWiFi library and decided to give it a try.

Vertical Hydroponic Farm
Intermediate
  • 32,819
  • 202

Work in progress

IoT Enabled Hydroponic Farm

IoT with LinkIt ONE and Microsoft Azure
Intermediate
  • 1,061
  • 23

Full instructions

This is an example of a very basic a telemetry project which may be classified as a classic “Internet of Things” (IoT) application.

Creating the Tweeting Viking Hat
Intermediate
  • 1,074
  • 20

Full instructions

I made a tweeting viking hat to show off that anyone could hear iBeacons.

Add projectSign up / Login