Presentation is loading. Please wait.

Presentation is loading. Please wait.

Motion Activated Twitter Webcam Douglas Drobny University of Idaho.

Similar presentations


Presentation on theme: "Motion Activated Twitter Webcam Douglas Drobny University of Idaho."— Presentation transcript:

1 Motion Activated Twitter Webcam Douglas Drobny University of Idaho

2 Objective Detect motion through an Arduino Board Use Python to take a picture with the default windows webcam Post the image to a Twitter account Relatively inexpensive (goal: $80)

3 Budget Arduino Uno $30 Parallax PIR sensor $11 Breadboard $ 8 Webcam ~$20 Total Price: $59

4 Arduino Uno R-3 Uses the ATmega16U2 Architecture USB or 7-12V power void loop(){ val = digitalRead(inputPin); if (val == HIGH) { digitalWrite(ledPin, HIGH); if (pirState == LOW) { Serial.println("Motion detected!"); pirState = HIGH; } } else { if (pirState == HIGH){ Serial.println("Motion ended!"); pirState = LOW; }

5 Motion Sensor First try: Generic PIR Motion Sensor – Sparkfun.com – Does not regulate its own voltage – Complex wiring Second Try: Parallax PIR Motion Sensor – Internal LED that light up on motion detection – 1:1 wiring

6 Taking the image Responds to input on a COM port – Uses the PySerial library ser = serial.Serial('/./COM3‘, timeout=1) line = ser.readline() Takes an image – Uses VideoCapture library from VideoCapture import Device cam = Device() cam.saveSnapshot('image.jpg')

7 Twitter Authentication Requires 4 keys – Consumer Key – Consumer Key Secret Created when adding an App on twitter.com – Access Token – Access Token Secret Created when user gives permission to an App

8 Tweepy Supports the new Oauth authentication for Twitter Does not support uploading files in a Tweet – https://github.com/laiso/tweepy does https://github.com/laiso/tweepy api = tweepy.API('consumer key', 'consumer key secret‘, 'access token', 'access token secret‘) api.status_update_with_media(filename, text)

9 Results https://twitter.com/#!/ScadaProject It works! Issues: – Motion sensor detects motion wider than camera range – Motion sensor light isn’t very sneaky – Too many images quickly to Twitter can error out some posts


Download ppt "Motion Activated Twitter Webcam Douglas Drobny University of Idaho."

Similar presentations


Ads by Google