Build the internet of things with Raspberry Pi!
-
Upload
donald-derek-haddad -
Category
Technology
-
view
682 -
download
2
description
Transcript of Build the internet of things with Raspberry Pi!
![Page 1: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/1.jpg)
![Page 2: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/2.jpg)
The recipeHardware Stack
• Raspberry Pi Model B (512 MB Ram)• Raspberry Pi Camera Module (2 MP) or
any compatible USB Cam *• Ethernet Cable• Wifi dongle: Edimax EW-7811Un -
150Mbps Wireless• SD Card ( 4 GB ++)
![Page 3: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/3.jpg)
The recipeSoftware Stack
• Raspbian OS • Node.js (v 0.10.2 +)• Python (V 2.7)• Shell Scripts• Twitter Stream API• Google Drive API
![Page 4: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/4.jpg)
Downloading weaponsNode.js on Raspberry Pi: https://github.com/DonaldDerek/rPi-cheat-sheet
![Page 5: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/5.jpg)
WARNINGcoding mask on!
![Page 6: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/6.jpg)
Connecting to your raspberry pissh-ing
Usefull Links:http://elinux.org/RPi_Advanced_Setup
#Avahi Deamon should be installedssh [email protected]
#Static IPshh [email protected]
![Page 7: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/7.jpg)
* Testing USB CamResurrecting ancient technologies
#Test USB CameraLsusb
#Take images from RaspberryPi USB Camerafswebcam -d /dev/video0 -r 640x480 test.jpeg
![Page 8: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/8.jpg)
Testing Rpi 2mp camTiny yet amazing camera!
raspistill –o test.jpg -w 640 -h 480
![Page 9: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/9.jpg)
WARNINGcoding mask on!
![Page 10: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/10.jpg)
App architectureWhere all your scripts belong
• node_modules/• ntwitter/• Request/
• bin/• atom/• gdata/• gdrive.py
• images/• App.js• Config.js• Controller.js• Package.json• tw-upload.js
![Page 11: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/11.jpg)
Twitter stream apiThe communication layer is built upon Twitter’s infrastructure
var twit = new twitter(config);
// Check Credentialstwit.verifyCredentials(function (err, data) { if(err) console.log(err);}).stream('user', {track:watch}, function(stream) {
console.log("Twitter stream is ready and waiting for inc tweets...")
stream.on('data', function (data) {
//Check if tweet is not emptyif (data.text !== undefined) {
//Action Code here}
});
//Catch errorsstream.on('error', function (err, code) {
console.log("err: "+err+" "+code)});
![Page 12: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/12.jpg)
Child processControl anything you can do in the terminal
child = exec("raspistill -o "+ image_path +" -w 640 -h 480", function (err, stdout, stderr) {
//trigger another event})
![Page 13: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/13.jpg)
WARNINGcoding mask on!
![Page 14: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/14.jpg)
Google drive apiLight-weight python script
//Authenticate with Gdrive APItry: docsclient.ClientLogin(username, password, docsclient.source);
except (gdata.client.BadAuthentication, gdata.client.Error), e: sys.exit('Unknown Error: ' + str(e))
except: sys.exit('Login Error, perhaps incorrect username/password')print 'success!'
Resources: http://planzero.org/blog/2012/04/13/uploading_any_file_to_google_docs_with_python
![Page 15: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/15.jpg)
WARNINGcoding mask on!
![Page 16: Build the internet of things with Raspberry Pi!](https://reader034.fdocuments.in/reader034/viewer/2022042614/555d3f8cd8b42ad8698b53e0/html5/thumbnails/16.jpg)
May The Source be With youhttps://github.com/DonaldDerek/GoogleBeam
DerekHaddadDonaldDerek r_hamzehrhamzeh