plasticus
Posts: 34
Joined: Tue Nov 01, 2016 10:31 pm

security camera: detect if I am near my raspberry

Sat Jan 27, 2018 11:26 am

Hi there, I am planning to make this security camera project for my room. Now, I am only interested in the camera being active when I am not in my house. I am trying to figure out a way so that the raspberry can automatically figure out if I am nearby, (therefore not recording) or if I am away (and the start recording when detecting motion).

In the worst case I'd like to have a simple way to activate/deactivate the system, possibly remotely or in any case without the need of physically dealing with the board.

Any suggestion?

Thanks!

jbudd
Posts: 1409
Joined: Mon Dec 16, 2013 10:23 am

Re: security camera: detect if I am near my raspberry

Sun Jan 28, 2018 12:20 am

Do you have a smart phone that connects to wifi at home?
Your Pi could ping the phone's IP address from time to time. If it get no response, you are out.

I don't know if iphones respond to ping, my Android does.

Here is a shell script to test if yours does

Code: Select all

#! /bin/bash
ping -w 1 192.168.1.210  # My phone's static IP address
if [[ $? == 0 ]]
then
   echo You are at home!
else
   echo You are out!
fi

jbudd
Posts: 1409
Joined: Mon Dec 16, 2013 10:23 am

Re: security camera: detect if I am near my raspberry

Sun Jan 28, 2018 12:25 am

Another possibility, also phone based,:

Use IFTT on the phone to send an mqtt message to the Pi when you arrive at or leave home. Of course this depends on you having a mobile data plan.
The camera script subscribes to the message topic and changes it's behaviour as appropriate.

plasticus
Posts: 34
Joined: Tue Nov 01, 2016 10:31 pm

Re: security camera: detect if I am near my raspberry

Sun Feb 18, 2018 2:22 am

jbudd wrote:
Sun Jan 28, 2018 12:25 am
Another possibility, also phone based,:

Use IFTT on the phone to send an mqtt message to the Pi when you arrive at or leave home. Of course this depends on you having a mobile data plan.
The camera script subscribes to the message topic and changes it's behaviour as appropriate.
could you elaborate please? Never heard of IFTT. How does it know when I'm home?

Thanks :)

jbudd
Posts: 1409
Joined: Mon Dec 16, 2013 10:23 am

Re: security camera: detect if I am near my raspberry

Sun Feb 18, 2018 2:46 am

IFTTT is an app, If This Then That.
For example If [you pass further than a certain distance from home] Then [send an MQTT message "Turn on security camera"]

Android https://play.google.com/store/apps/deta ... fttt.ifttt
iPhone https://itunes.apple.com/us/app/ifttt/id660944635?mt=8

It comes with a library of sample events and the actions they trigger, including lots of location based events

plasticus
Posts: 34
Joined: Tue Nov 01, 2016 10:31 pm

Re: security camera: detect if I am near my raspberry

Sun Feb 18, 2018 12:58 pm

jbudd wrote:
Sun Feb 18, 2018 2:46 am
IFTTT is an app, If This Then That.
For example If [you pass further than a certain distance from home] Then [send an MQTT message "Turn on security camera"]

Android https://play.google.com/store/apps/deta ... fttt.ifttt
iPhone https://itunes.apple.com/us/app/ifttt/id660944635?mt=8

It comes with a library of sample events and the actions they trigger, including lots of location based events
Thanks, it seems interesting. However I think I'll first try the first solution (ping the mobile). I don't usually keep my location turned on and would like to avoid it.
Thanks! :)

Return to “Beginners”