Getting motion on PIR Sensor, take a photo from PI Cam and send to Watson Visual Recognition

This is a security solution which as soon as it is sensitized by a motion from the PIR sensor, the system takes a phot using PI Cam and sends it to Watson Visual Recognition, which analyzes and gives all information possible be detected. Getting motion from PIR Sensor, take a picture from PI Cam and to Watson Visual Recognition, using Rasp PI 3

The schema of Raspberry with PIR Sensor at link: https://ibm.box.com/s/ad5hu3e4g5wxsmqkkplnbjovn3u6auq1

The Schema of Raspberry with PI Cam at link: https://ibm.box.com/s/er9q5l04fyv8anxoqyqjml3akapxs49k

[{"id":"da1090db.fcbed","type":"tab","label":"Flow 5","disabled":false,"info":""},{"id":"a387a839.434f48","type":"rpi-gpio in","z":"da1090db.fcbed","name":"","pin":"32","intype":"tri","debounce":"25","read":true,"x":88.03125,"y":142.453125,"wires":[["819d53f.f6e73b"]]},{"id":"3f296594.2d1f9a","type":"exec","z":"da1090db.fcbed","command":"raspistill","addpay":false,"append":" -v -o photo.jpg","useSpawn":"false","timer":"","oldrc":false,"name":"Take a photo","x":587.0234375,"y":142.0390625,"wires":[["c3508df4.4816d"],[],[]]},{"id":"819d53f.f6e73b","type":"switch","z":"da1090db.fcbed","name":"Receive data from motion sensor","property":"payload","propertyType":"msg","rules":[{"t":"eq","v":"1","vt":"num"}],"checkall":"true","repair":false,"outputs":1,"x":335.0390625,"y":142.421875,"wires":[["3f296594.2d1f9a"]]},{"id":"c3508df4.4816d","type":"file in","z":"da1090db.fcbed","name":"Get photo file","filename":"./photo.jpg","format":"","chunk":false,"sendError":false,"encoding":"none","x":130.03125,"y":346.8437805175781,"wires":[["9269f3bd.de32b"]]},{"id":"9269f3bd.de32b","type":"visual-recognition-v3","z":"da1090db.fcbed","name":"","vr-service-endpoint":"https://gateway.watsonplatform.net/visual-recognition/api","image-feature":"classifyImage","lang":"pt-br","x":340.0234375,"y":346.859375,"wires":[["5f21af0.52a485"]]},{"id":"651d1b36.a5b654","type":"play audio","z":"da1090db.fcbed","name":"","voice":"62","x":755.0390625,"y":345.953125,"wires":[]},{"id":"5f21af0.52a485","type":"function","z":"da1090db.fcbed","name":"Format message","func":"imagens = \"Movimento detectado! Vejo: \";\nif(msg.result.images[0].classifiers[0].classes)\n{\n    for(x=0;x<msg.result.images[0].classifiers[0].classes.length; x++)\n    {\n        imagens += msg.result.images[0].classifiers[0].classes[x].class + \", \";\n    }\n}\nmsg.payload = imagens;\nreturn msg;","outputs":1,"noerr":0,"x":551.0390625,"y":346.46875,"wires":[["651d1b36.a5b654"]]}]

Flow Info

Created 5 years, 11 months ago
Rating: 5 2

Owner

Actions

Rate:

Node Types

Core
  • exec (x1)
  • file in (x1)
  • function (x1)
  • switch (x1)
Other

Tags

  • Watson
  • Visual
  • Recognition
  • Raspberry
  • PI
  • PICam
  • PIRSensor
  • PIR
  • Sensor
  • PlayAudio
  • GPIO
  • Image
  • Photo
  • Motion
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option