Skip to main content

Motion Sensor System with Mobile Notifications and NFC Activation

I call the project things2c or "things to see" - a reference to both the video recording aspect and the Internet of Things (IoT). Basically, I had a solution looking for a problem (a couple Raspberry Pis, some NFC gadgetry, etc.) and was inspired by an article describing how to use a Raspberry Pi as low-cost HD surveillance camera.

What does it it do?

The system sends me alerts on my phone when motion is detected in my apartment unless the NFC tag on my keychain is close to the sensor inside my front door. Once the NFC tag is detected and the motion detection is turned off, a nice calming green LED flashes periodically. Video clips/previews are uploaded to Amazon S3 or ownCloud where they may be synced to a mobile device.

What is it not?

I do not claim this is a serious security appliance. There are various ways to thwart the system and I haven't given any serious thought to hardening it. For me, it was just a fun project.



Cloud Services

Design Diagram

things2c design


$ python --help
  things2c [options] nfc_scan
  things2c [options] motionctl
  things2c [options] watchdog
  things2c [options] blinkctl
  things2c [options] notify <notify_text>
  things2c [options] publish
  things2c [options] snoop
  things2c [options] filemanager
  things2c version

  nfc_scan          NFC scan/report
  motionctl         Control motion sensor
  watchdog          Watchdog for motion control
  blinkctl          Control status blink(1)
  notify            Send notifications
  publish           Publish topic/payload to MQ
  snoop             Output all MQTT traffic
  filemanager       Upload/delete video files
  version           Display version and exit

  -h --help         Print usage
  -c --config=FILE  Configuration file [default: /etc/things2c/things2c.ini]
  -v --verbose      Verbose/debug output
  -t --topic=TOPIC  Topic to publish
  -p --payload=PL   Payload for publish
  -e --encode       Encode payload

Build Notes

To build a standalone binary using pyinstaller, refer to Dockerfile_things2c for x86. To build for the Raspberry PI, I used the following after installing the needed Python modules (requirements.txt):

$ pyinstaller --hidden-import nfc.clf.pn533 --onefile ./

Deployment Notes

I deploy with Ansible - refer to playbook.yml.

License for things2c



Comments powered by Disqus