Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
The recipe
Hardware Stack

• Raspberry Pi Model B (512 MB Ram)
• Raspberry Pi Camera Module (2 MP) or
any compatible USB C...
The recipe
Software Stack

•
•
•
•
•
•

Raspbian OS
Node.js (v 0.10.2 +)
Python (V 2.7)
Shell Scripts
Twitter Stream API
G...
Downloading weapons
Node.js on Raspberry Pi: https://github.com/DonaldDerek/rPi-cheat-sheet
WARNING
coding mask on!
Connecting to your raspberry pi
ssh-ing

#Avahi Deamon should be installed
ssh pi@raspberrypi.local
#Static IP
shh pi@192....
* Testing USB Cam
Resurrecting ancient technologies

#Test USB Camera
Lsusb

#Take images from RaspberryPi USB Camera
fswe...
Testing Rpi 2mp cam
Tiny yet amazing camera!

raspistill –o test.jpg -w 640 -h 480
WARNING
coding mask on!
App architecture
Where all your scripts belong

• node_modules/
• ntwitter/
• Request/
• bin/
• atom/
• gdata/
• gdrive.py...
Twitter stream api
The communication layer is built upon Twitter’s infrastructure
var twit = new twitter(config);

// Chec...
Child process
Control anything you can do in the terminal

child = exec("raspistill -o "+ image_path +" -w 640 -h 480",
fu...
WARNING
coding mask on!
Google drive api
Light-weight python script
//Authenticate with Gdrive API
try:
docsclient.ClientLogin(username, password,...
WARNING
coding mask on!
May The Source be With you
https://github.com/DonaldDerek/GoogleBeam

DonaldDerek

DerekHaddad

rhamzeh

r_hamzeh
Build the internet of things with Raspberry Pi!
Upcoming SlideShare
Loading in …5
×

Build the internet of things with Raspberry Pi!

1,236 views

Published on

Arabnet Conf 2014 Code & Design Day.

GDG Beirut Code Lab:
Duration: 1h30min
Project Files: https://github.com/DonaldDerek/GoogleBeam
Given By: Raghd Hamzeh, Donald Derek Haddad

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Build the internet of things with Raspberry Pi!

  1. 1. The recipe Hardware 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 ++)
  2. 2. The recipe Software Stack • • • • • • Raspbian OS Node.js (v 0.10.2 +) Python (V 2.7) Shell Scripts Twitter Stream API Google Drive API
  3. 3. Downloading weapons Node.js on Raspberry Pi: https://github.com/DonaldDerek/rPi-cheat-sheet
  4. 4. WARNING coding mask on!
  5. 5. Connecting to your raspberry pi ssh-ing #Avahi Deamon should be installed ssh pi@raspberrypi.local #Static IP shh pi@192.168.5.10 Usefull Links: http://elinux.org/RPi_Advanced_Setup
  6. 6. * Testing USB Cam Resurrecting ancient technologies #Test USB Camera Lsusb #Take images from RaspberryPi USB Camera fswebcam -d /dev/video0 -r 640x480 test.jpeg
  7. 7. Testing Rpi 2mp cam Tiny yet amazing camera! raspistill –o test.jpg -w 640 -h 480
  8. 8. WARNING coding mask on!
  9. 9. App architecture Where 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
  10. 10. Twitter stream api The communication layer is built upon Twitter’s infrastructure var twit = new twitter(config); // Check Credentials twit.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 empty if (data.text !== undefined) { //Action Code here } }); //Catch errors stream.on('error', function (err, code) { console.log("err: "+err+" "+code) });
  11. 11. Child process Control anything you can do in the terminal child = exec("raspistill -o "+ image_path +" -w 640 -h 480", function (err, stdout, stderr) { //trigger another event })
  12. 12. WARNING coding mask on!
  13. 13. Google drive api Light-weight python script //Authenticate with Gdrive API try: 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
  14. 14. WARNING coding mask on!
  15. 15. May The Source be With you https://github.com/DonaldDerek/GoogleBeam DonaldDerek DerekHaddad rhamzeh r_hamzeh

×