Door bell with pi camera and motion detection

Also interesting, and in my original proposal :slight_smile: http://www.thingiverse.com/thing:2097751

Ive orderd another dash button to have a go at using this within the script.
it can be a programme with many options.

I have not used any 3d design or printing software, I was going to have a hunt tonight to see whats available.

Solidworks is the industry standard, but I am sure there are free ones around too.
In my case I downloaded the .stl files from thingiverse and then just uploaded them to 3D hubs

Interesting project - I am sure there will be much interest in this once completed. So currently you are using the cam motion detection to send a mqtt message as well as by push button?
Whats left to work on:

  • CV integration?
  • sending on video / audio feeds to smartphone to allow interaction with visitor?

Both interesting ideas :slight_smile:
My plan was to train a classifier to recognise when certain features are present in the images (e.g a person) to reduce the false positive rate of motion detection.I don’t have much experience in this area but a colleague recommended CNN https://www.tensorflow.org/tutorials/deep_cnn

Both of these are a little way off at the moment, still getting used to playing with Python and raspberry Pi.
Not even sure how it would perform yet.
Just trying to get the basics up and running then move on to the next stage.

It now saves a log when a doorbell press has been made and when motion is detected.

Ive tidied the code up a bit also shifted code blocks into functions added remarks etc.

I am now working at getting HA to notify my phone and my wifes phone when either event occurs.

Im also looking at BTLE tag/beacon detection. Maybe as an alternative/addition to face recognition.

For face recognition, this article covers the AWS service https://www.hackster.io/gr1m/raspberry-pi-facial-recognition-16e34e?utm_source=hackster&utm_medium=email&utm_campaign=new_projects

This actually looks really cool https://aws.amazon.com/rekognition/

Received the Dash today, got to playing with it, it seems there is still quite a delay (1-3 seconds) as it has to reconnect to the wifi each time it is pressed.
The way most of the hacks are triggered is by detecting its network presence, by either IP or mac address.
I will still add it to the programme as an option, and Ill try to find more fluent solutions.

1 Like

I think that delay is unavoidable unfortunately

This is the fastest method Ive found of reading the amazon dash, it uses command-line nmap which will need to be installed.
It is still 1-2 seconds but it detects the Dash as soon as it connects to wifi, unlike the other methods it seems slower and sometimes doesnt detect the button press.

import subprocess
import paho.mqtt.client as mqtt
import paho.mqtt.publish as publish

status=0 # Status of connection
mac="##:##:##:##:##:##" #get the mac address of your dash button with fing or via your router
auth = {
  'username':"pi",
  'password':"raspberry"
}
hostip="192.168.0.8"
#mqtt function
def PublishMQTT(topic,payload):
    publish.single(topic,
                   payload=payload,
                   hostname=hostip,
                   client_id="doorbell",
                   auth=auth,
                   port=1883)
while True:
    #command line call to ip address # for quickest and more reliable response u need the ip of the dash which can also be obtained via router or fing
    result=subprocess.check_output("sudo nmap -sn 192.168.0.41", shell=True)
    #print result
    if (mac in result): # Detect mac address in the command line response
        print "button pressed"
        status=1
        PublishMQTT("dash/button","1")
    else:
        if status==1:
            print "Off"
            status=0
            PublishMQTT("dash/button","0")

Awesome I will try it out :smiley:

Hi well your code works fine for me, however as you say the delay is quite significant and I think this rules out the dash for me. Two options I am now considering:

  1. Bluetooth button - Cheap BlueTooth Buttons and Linux – Terence Eden’s Blog - less than 3 quid, could be no faster than the dash https://www.amazon.co.uk/gp/product/B00LQHJY0I/ref=as_li_tl?ie=UTF8&camp=1634&creative=19450&creativeASIN=B00LQHJY0I&linkCode=as2&tag=shksprblog-21

  2. A standard RF one. Has the added benefit of the chime, and my idea is to open up the case and use the LED signal on the receiver as an input to my raspberry pi analog in line. Nice examples include https://www.amazon.co.uk/Wireless-Doorbell-TeckNet-Cordless-500-feet/dp/B01LQBRJFA/ref=sr_1_12?ie=UTF8&qid=1489919609&sr=8-12&keywords=wireless+doorbell+uk

You could just use the door chime as you say but also get an arduino nano and a 433mhz reciever sniff out the button press and sendit to your pi, or attach the reciever directly to the pi.

Perfect, only 1 pound too! https://www.amazon.co.uk/d/Electronics-Photo/1pcs-433Mhz-transmitter-receiver-kit-Arduino-project/B00E9OGFLQ/ref=sr_1_5?ie=UTF8&qid=1489922110&sr=8-5&keywords=433+MHz+receiver

I think I now have a clear picture of how I see this project now…

  1. RF doorbell
  2. Pi zero Z
  3. Pi camera (I have the spy one that I can position behind the port hole on my door)
  4. Facial recognition to select the best photo (i.e. clear head shot) from a short burst taken after the button is pressed
  5. MQTT signal to trigger HA and send my phone the notification including selected photo

Re point 5 I am not yet sure how the photo will be sent as a notification, I hope this is possible with the HA iOS app or Pushbullet?

Re 5 @robmarkcole, I use Telegram to log into my hikvision camera and send the picture to my phone when it detects movement on my camera. I dont have a pi camera but is there a URL available for the PI to grab an image?

Thanks! Il check out Telegram. The pi camera feed can be streamed locally, is that enough for Telegram or does it require a web stream? Cheers

I’ve had a search for Telegram, is it this? https://core.telegram.org/api
My experience with notifications is that getting them when not accurate is really annoying, so I only anticipate configuring notifications when there is greater than 80% probability that a person is detected. Therefore until this level of accuracy can be achieved by a motion image sensor I anticipate just running motion detection in the background for reviewing images offline, and having notifications only for button presses on the doorbell.

I bought these a few months ago for a different project, only thing is for good range you need to solder a wire onto the antenna, the existing one is lame, it wont reach more than 10feet

1 Like