Introduction: Simple Home Automation With Android App

This project will provide you the simplest way to design Android app+python code for home control from anywhere in the world using Thinkspeak IOT platform.

here I code only for one room control...u can code similarly for other rooms as per your need...

I am just giving u idea how to start with home IOT using Raspberry pi+android app.

Step 1: What You Need...

HARDWARE

1.Raspberry pi

2.Android mobile

-LEDs, male to female wire.

SOFTWARE

1.Android Studio

2.python in Raspberry pi

Step 2: Python Code

import httplib, urllib
import re import RPi.GPIO as GPIO import time GPIO.setmode(GPIO.BCM) led1=23 led2=24 GPIO.setup(led1,GPIO.OUT) GPIO.setup(led2,GPIO.OUT)
while 1:
    datafromwebsite=urllib.urlopen("https://api.thingspeak.com/channels/284381/feeds.json?api_key=GFSE7RB782RDLS3Z&results=2")#COPY FROM 'GET A CHANNEL FEED'
    select=repr(datafromwebsite.read())
    select=select[350:]
    pick=re.search('field1":"(.+?)",',select)
    if pick:
        print pick.group(1)
    #select=select[400:]
    pick1=re.search('field2":"(.+?)"}]}',select)
    if pick1:
        print pick1.group(1)
    time.sleep(3)
    if pick.group(1)=="1":
        GPIO.output(led1, 1)
    else:
        GPIO.output(led1, 0)
    if pick1.group(1)=="1":
        GPIO.output(led2, 1)
    else:
        GPIO.output(led2, 0)
sleep(3)

Step 3: Android APP 'Home Control'

App is developed using Android studio.

In this two activities are made and code for only bedroom is done rest coder can do as per his/her need.

App opens with different room controls, on selecting room app read the the status of channels on thinkspeak and according to status update the switch used in next activity.

web link for android code:

https://github.com/kulwinderss/IOT.git

Comments

About This Instructable

273views

8favorites

License:

Bio: Likes to build circuits, electronics project in free time... Also love coding...have knowledge of JAVA, C, C++, Arduino, HTML, Android Studio, LabView, CoDeSys, OrCAD.....
More by Kitu Singh:Simple Home Automation With Android AppSmart Solar LampMobile control LED(Arduino+Bluetooth module)
Add instructable to: