Things used in this project

Hardware components:
Intel.web.720.405
Intel Edison
×1
1434509556 android phone color
Android device
×1
Adafruit industries ada161 image 75px
Photo resistor
×1
Mfr 25frf52 10k sml
Resistor 10k ohm
×1
11026 02
Jumper wires (generic)
×1
Software apps and online services:
Eipgsd2k
Twitter
Hand tools and fabrication machines:
09507 01
Soldering iron (generic)

Schematics

Photoresistor configuration
TwitterIot.fzz

Code

tweetpic.pyPython
Testing the Sentry ward
import tweepy
import cv2
import urllib
import time

consumer_key = *YOUR KEY HERE*
consumer_secret = *YOUR KEY HERE*
access_token = *YOUR TOKEN HERE*
access_token_secret = *YOUR TOKEN HERE*
your_handle = *ENTER YOUR TWITTER HANDLE HERE*

camip = *YOUR CAMERA IP HERE*
chk_old=0

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
imag = urllib.URLopener()

while 1:
	tweet = tweepy.Cursor(api.search, q = your_handle, lang = 'en')
	count = 0
	for tweet in tweet.items():
		print (tweet.text, tweet.author.screen_name,tweet.id)
		txt = tweet.text
		hand = tweet.author.screen_name
		chk = tweet.id
		cond = chk_old!=chk
		print cond
		count += 1
		if count > 0:
			break
	if txt == your_handle + ' Click!':  
		if cond:
			imag.retrieve('http://'+camip+':8080/shot.jpg','shot.jpg')
			img = cv2.imread('shot.jpg')
			time.sleep(3)
			this = '/home/root/shot.jpg'
			psts = '@'+hand+' This is what I can see!'
			api.update_with_media(filename=this, in_reply_to_status_id=chk, status=psts)
			chk_old = chk
			print chk_old
			print 'done'
	time.sleep(11)
tweetint.pyPython
Final code for integration with light sensors
import tweepy
import cv2
import urllib
import time
import mraa

consumer_key = *YOUR KEY HERE*
consumer_secret = *YOUR KEY HERE*
access_token = *YOUR TOKEN HERE*
access_token_secret = *YOUR TOKEN HERE*
your_handle = *ENTER YOUR TWITTER HANDLE HERE*
camip = *YOUR CAMERA IP HERE*

chk_old=0

auth = tweepy.OAuthHandler(consumer_key, consumer_secret)
auth.set_access_token(access_token, access_token_secret)
api = tweepy.API(auth)
imag = urllib.URLopener()
light = mraa.Aio(0)

tweet = tweepy.Cursor(api.search, q = your_handle , lang = 'en')
count = 0
for tweet in tweet.items():
	print (tweet.text, tweet.author.screen_name,tweet.id)
	txt = tweet.text
	hand = tweet.author.screen_name
	chk = tweet.id
	cond = chk_old!=chk
	print cond
	break
if txt== your_handle + ' Start!':
	print('Security System Started!')
	while count<1:
		tweet = tweepy.Cursor(api.search, q = '@satyasiot', lang = 'en')
		count = 2
		val = float(light.read())
		print val
		if val > 500:  
			if cond:
				imag.retrieve('http://'+camip+':8080/shot.jpg','shot.jpg')
				img = cv2.imread('shot.jpg')
				time.sleep(3)
				this = '/home/root/shot.jpg'
				psts = '@satyasiot Intruder Alert!'
				api.update_with_media(filename=this, in_reply_to_status_id=chk, status=psts)
				chk_old = chk
				print chk_old
				print 'done'
		time.sleep(11)
		for tweet in tweet.items():
			txt = tweet.text
			hand = tweet.author.screen_name
			chk = tweet.id
if txt=='@satyasiot Stop!':
	while 1:

Credits

Aaeaaqaaaaaaaawqaaaajdlhmmy3zgyylthimjatngrjyi05zdqwltbhnzhmzwyyztuxnq
Satyavrat Wagle

A keen tinkerer, I have an active interest in IoT Solutions, Wireless Sensor Networks, Single Board Computing Implementations, Embedded Systems, and Robotics.

Contact

Replications

Did you replicate this project? Share it!

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

Give feedback

Comments

Similar projects you might like

VNC Configuration Without Display On Pi Zero W
Intermediate
  • 412
  • 5

Protip

Get started with Pi Zero W without a display. This tutorial helps you to enable SSH, VNC and configure VNC on your smartphone.

Voice Controled Click Lamps
Intermediate
  • 66
  • 2

Work in progress

We have a couple of floor lamps from Ikea. They have two lights in each, and a switch for each light. Let's control them remotely.

Android Things A.I. Candy Dispenser
Intermediate
  • 466
  • 6

Full instructions

A candy dispenser running Android Things that exchanges photos for candies. It uses computer vision to classify the image.

Intel Curie TinyTILE Dress: Accelerometer + Optical Fibers
Intermediate
  • 379
  • 10

Full instructions

A dress using Intel Curie accelerometer on TinyTILE and its small form factor to control colors of the optical fibers with arm movements.

MAKERBALL
Intermediate
  • 807
  • 4

Makerball is a DIY pinball machine kit that can be upgraded digitally with the Arduino Genuino 101. Here we show you the electronical part.

MAKERBALL

Team Makerball.org

Pre-Collision Assist with Pedestrian Detection - Honda Civic
Intermediate
  • 1,908
  • 20

Full instructions

Combine Walabot's RF radar with real-time hazard detection and classification from camera, powered by TensorFlow with YOLO approach.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback