DSLR motion detection with Raspberry Pi and OpenCV

One of our favourite makers, Pi & Chips (AKA David Pride), wanted to see if they could trigger a DSLR camera to take pictures by using motion detection with OpenCV on Raspberry Pi.

You could certainly do this with a Raspberry Pi High Quality Camera, but David wanted to try with his swanky new Lumix camera. As well as a Raspberry Pi and whichever camera you’re using, you’ll also need a remote control. David sourced a cheap one from Amazon, since he knew full well he was going to be… breaking it a bit.

Breaking the remote a bit

When it came to the “breaking” part, David explains: “I was hoping to be able to just re-solder some connectors to the button but it was a dual function button depending on depth of press. I therefore got a set of probes out and traced which pins on the chip were responsible for the actual shutter release and then *carefully* managed to add two fine wires.”

Further breaking

Next, David added Dupont cables to the ends of the wires to allow access to the breadboard, holding the cables in place with a blob of hot glue. Then a very simple circuit using an NPN transistor to switch via GPIO gave remote control of the camera from Python.

Raspberry Pi on the right, working together with the remote control’s innards on the left

David then added OpenCV to the mix, using this tutorial on PyImageSearch. He took the basic motion detection script and added a tiny hack to trigger the GPIO when motion was detected.

He needed to add a delay to the start of the script so he could position stuff, or himself, in front of the camera with time to spare. Got to think of those angles.

David concludes: “The camera was set to fully manual and to a really nice fast shutter speed. There is almost no delay at all between motion being detected and the Lumix actually taking pictures, I was really surprised how instantaneous it was.”

The whole setup mounted on a tripod ready to play

Here are some of the visuals captured by this Raspberry Pi-powered project…

Take a look at some more of David’s projects over at Pi & Chips.

15 comments

kine avatar

good idea but it’s hard to make this device.

Anonymous avatar

It’s cool and all but in the real world, I would still use a motion sensor.

Graeme avatar

Great idea, I’d like to see this done with a Pi ZeroW. Has the potential for remote triggering, using the original button from the remote to activate/deactivate, scheduling etc.

David Pride avatar

That would be really cool for portability – and it is possible to install OpenCV 3 on the Pi Zero too.

Steven P avatar

This one is a great idea. It’s looking hard but will give it a try.

David Pride avatar

Hi Stephen, genuinely not *too* hard. The trickiest bit was soldering the wires to the remote. The code is really simple thanks to Adrian!

Bernhard avatar

Thx for your idea. Pls more of such stuff :-)
Best regards
Bernhard

David Pride avatar

Hi Bernhard, thanks for your comments – I love making and breaking things better with Pi. :) I’ve got another project in the pipeline that builds on a portion of what I’ve used here.

bishnu avatar

woowww thanks for sharing this idea. It’s looking hard but will give it a try.

Kine avatar

Very good idea.Thanks for sharing this idea

Netflix premium mod apk avatar

looks interesting.

Vestige Products avatar

Great Post look forward for more content like this.

jabijan avatar

Wao, It will be very nice if it works

Senpai avatar

really one of the best idea. Thanks

Kinemaster Apk avatar

It’s cool and all but in the real world, I would still use a motion sensor.

Comments are closed