MotionEye security camera setup

raspberrypi3
security
picamera

#1

Recently I was experimenting with MotionEye, which is a frontend motion, a pretty widely used camera motion detection tool.

Based on their pretty good Docker examples already, I’ve “resinified” it a bit more and got it deployed on a Raspberry Pi 3 with an attached PiCamera and an extra USB web cam.

It works pretty well so far. Just deploy the code, then navigate to the control interface and start to set things up. The settings will be persisted, as well as the saved media files over reboot.

Some notes on this particular setip

  • the whole container weighs around 290MB
  • I’ve enabled Avahi inside the container, and it’s set up such that e.g. if remote cameras are attached, then the .local addresses can be used
  • the application tries to set up the kernel modules, etc, on the Pi so if there’s a PiCamera attached, then it can be added easily then in the MotionEye dashboard
  • the device time zone can be adjusted over an environment variable.
  • the dashboard name can be adjusted by changing the resin device’s name
  • works over the public device URL as well
  • currently only set up for a Pi (or actually likely over any ARMv7 device type), others should be pretty straightforward to add and should be coming.
  • one can attach other network cameras’ streams to it as well. I’ve tried with the current, v4l version of resin-cam, and works okay on the local network (as MJPEG streaming). There’s a lot more to improve on this side, though, lots of potential…

You can find the code here:

It’s still work-in-progress, happy to hear any feedback!

Usage notes

Also some usage tricks that I’ve found so far, in case these are helpful for anyone:

  • In the still images settings, the default image name is such, that if there are multiple images taken in the same second, they will overwrite each other. it’s better IMHO to add the frame number to the image as well, so each image will have unique name, e.g. using the %Y-%m-%d/%H-%M-%S.%q setting (added .%q at the end compared to the default
  • Google Drive backup works pretty well. Needed a bit of troubleshooting, such as each camera will need its own key (cannot reuse one across cameras), and the location naming is totally obvious (but the help tooltip does help)
  • motion detection can be a bit tricky to set up, depending on the environment. I had to adjust quite a bit of the light-switch detection, threshold values, etc…