Things used in this project

Hardware components:
102110017%206
MediaTek Labs LinkIt Smart 7688 Duo
×1
386 00
DHT11 Temperature & Humidity Sensor
×1
11026 02
Jumper wires (generic)
×1
4 Channel DC 5V Relay Module
×1
Software apps and online services:
Ide web
Arduino IDE
PuTTY
WinSCP
Telegram Bot

Schematics

Wiring
Wire vzi5i1ilcr
Flowchart
Layout vxyyzyttun

Code

Python CodePython
#coder :- Salman Faris
import sys
import mraa
import time
import random
import datetime
import telepot
import serial 


 
s= None

def setup():
    global s
    s = serial.Serial("/dev/ttyS0", 57600)
    

 

def handle(msg):
    chat_id = msg['chat']['id']
    command = msg['text']

    print 'Got command: %s' % command
    
    
    if command =='/start':
       bot.sendMessage(chat_id,"Hi, Am Jarvis Your Personal Assistant Powerd by Linit7688 Duo developed by Salman Faris. ")
       bot.sendMessage(chat_id,"Am here to help You...! ")
       bot.sendMessage(chat_id,"to know more about my command type /help")
    elif command == '/help':
        bot.sendMessage(chat_id,"/TurnOnBedroomLight or /TurnOffBedroomLight :- to turn on/off bedroom light")
        bot.sendMessage(chat_id,"/TurnOnKitchenLight or /TurnOffKitchenLight :- to turn on/off Kitchen light")
        bot.sendMessage(chat_id,"/TurnOnLights or /TurnOffLights :- to turn on/off all the light")
        bot.sendMessage(chat_id,"/RoomTemp :- To know about Room Temperature ")
        bot.sendMessage(chat_id,"/RoomHumi :- To know about Room Humidity ")
        bot.sendMessage(chat_id,"/News :- To read Latest News ")
        s.write("1")
    elif command == '/TurnOnBedroomLight':
        bot.sendMessage(chat_id,"ok..Bedroom light now ON")
        s.write("1")
    elif command =='/TurnOffBedroomLight':
         bot.sendMessage(chat_id,"ok...Bedroom light now OFF")
         s.write("0")
    elif command == '/TurnOnKitchenLight':
         bot.sendMessage(chat_id,"ok...kitchen light now ON")
         s.write("3")
    elif command == '/TurnOffKitchenLight':
         bot.sendMessage(chat_id,"ok...kitchen light now OFF")
         s.write("2")
    elif command == '/TurnOnLights':
         bot.sendMessage(chat_id,"bedroom and kitchen light's are On")
         s.write("1")
         s.write("3")
    elif command == '/TurnOffLights':
         bot.sendMessage(chat_id,"bedroom and kitchen light's are On")
         s.write("0")
         s.write("2")
    elif command == '/RoomTemp':
         bot.sendMessage(chat_id,"Temperature is")
         s.write("5")
         a = s.read(5)
         bot.sendMessage(chat_id,a)
         bot.sendMessage(chat_id,"Celsius")
    elif command == '/RoomHumi':
         bot.sendMessage(chat_id,"Humidity is ")
         s.write("4")
         a = s.read(5)
         bot.sendMessage(chat_id,a)
    elif command == '/News':
         bot.sendMessage(chat_id,"http://www.bbc.com/news/world")
         bot.sendMessage(chat_id,"http://timesofindia.indiatimes.com/news")
         bot.sendMessage(chat_id,"http://www.ndtv.com/latest")
         
    else:
        bot.sendMessage(chat_id,"Wrong Command")
        bot.sendMessage(chat_id,"please check /help section to know more about Command's")



bot = telepot.Bot('bot token')
bot.message_loop(handle)
print 'I am listening...'

while True:
    setup()
Arduino CodeC/C++
#include <DHT.h>

#define DHTPIN A1  // DHTT pin connected to A1
#define DHTTYPE DHT11   // DHT 22  (AM2302)
DHT dht(DHTPIN, DHTTYPE);  // Initialize DHT sensor 


int chk;
float hum;  //Stores humidity value
float temp; //Stores temperature value

void setup() { 
          
          dht.begin();  //begin the DHTT
          
          Serial.begin(115200);  // open serial connection to USB Serial 
                                 //port(connected to your computer)
          Serial1.begin(57600);  // open internal serial connection to 
                                 //MT7688

          pinMode(13, OUTPUT); // Bedroom light
          pinMode(12,OUTPUT);  // kitchen light  
          
      }
      void loop() { 
         hum = dht.readHumidity();   // read humdity
         temp= dht.readTemperature();  //read temperature
         
            int c = Serial1.read();      // read from MT7688
            if (c != -1) {
                  switch(c) { 
                        case '0':                // turn off D13 when receiving "0"
                        digitalWrite(13, 0); 
                        break; 
                        case '1':                // turn on D13 when receiving "1" 
                        digitalWrite(13, 1); 
                        break; 
                        case '2':                // turn off D12 when receiving "1" 
                        digitalWrite(12,0);
                        break;
                        case '3':                // turn on D12 when receiving "1" 
                        digitalWrite(12,1);
                        break;
                        case '4':               // print temperature when receiving "4"
                        Serial1.print(hum);
                        break;
                        case '5':               //print humidity when receiving "5"
                        Serial1.print(temp);
                        break;
                        
                        
                        
                       
                  } 
            } 
      }

Credits

Dsc05679 xxk38knz8i
Salman Faris

Learning By Doing.

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

Blynk App with Linkit7688 Duo and Webcam
Intermediate
  • 300
  • 3

Full instructions

How to make a functional application with Blynk and the Linkit Smart 7688 Duo board, with utility for home automation.

Linkit One: Blowing an LED
Intermediate
  • 942
  • 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,052
  • 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
  • 888
  • 18

Protip

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

Vertical Hydroponic Farm
Intermediate
  • 29,764
  • 190

Work in progress

IoT Enabled Hydroponic Farm

Creating the Tweeting Viking Hat
Intermediate
  • 976
  • 20

Full instructions

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

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback