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.
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What You Need...
-LEDs, male to female wire.
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)
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: