brutella / hkcam

Open-Source HomeKit Surveillance Camera
https://hochgatterer.me/hkcam/
Apache License 2.0
919 stars 141 forks source link

Motion sensor version #5

Open nielsth opened 5 years ago

nielsth commented 5 years ago

I'd like to use this with a HC-SR501 Motion Sensor built-in (connected to the Pi 0).Would you consider adding support for that? Both in the software as well as an edited version of the hardware enclosure to make room for the sensor?

brutella commented 5 years ago

I haven't worked with the HC-SR501 sensor yet. Does somebody have experience with it?

nielsth commented 5 years ago

Could this be of any help? https://www.mbtechworks.com/projects/pir-motion-sensor-with-raspberry-pi.html

The sensor can be connected to a Pi's GPIO port and is supported by the default GPIO library. Not sure if that library is on the HKCam as well?

I'm currently using a Pi 0 with camera module running homebridge. With this sensor connected to the GPIO port, all I needed was a simple Homebridge plugin to get the motion sensor in a separate tile in HomeKit / the home app.

kaidesu commented 5 years ago

Possible this could be developed natively using just the camera:

https://github.com/bemasher/pmvr

pieter commented 5 years ago

I'm also interested in this. HKCam is running, but my PIR sensor is still being shipped. However, implementation should be pretty straightforward, since all the sensor does is toggle the GPIO port.

@nielsth Maybe you can try the above pull request and see if it works? You'll need to build a new version of hkcam, put it on your raspberry, and change the run command / service to include the --motion_pin argument (e.g. by editing /etc/sv/hkcam/run and adding --motion_pin=10).

@brutella How do you feel about including this functionality in hkcam? It's not necessarily camera related, but I think it goes together nicely. Was also thinking of creating another enclosure model which contains a cut-out for the sensor.

brutella commented 5 years ago

This feature looks very interesting.

If this is integrated into HKCam, we should make a 3D-printed enclosure which fits the motion sensor.

nielsth commented 5 years ago

@pieter I'm afraid I don't have HKCam yet. I'm holding off investing in one because of this feature request :)

Edit: I could try that on my Pi 0 sometime in the next weeks. I guess I'll need to back-up and erase it so the current Homebridge installation won't get in the way? That'll take me some time though.

phillipthelen commented 4 years ago

I'm still waiting on my HC-SR501, which should arrive on friday, to get some good measurements but looking at the dimensions from the internet, just modifying the lid and maybe adding a separator between the module and the Raspberry pi could work. I'll try to verify if this works and try to get something working once my sensor arrives. (unless someone else already has work done on this?)

Screenshot 2019-07-15 at 21 01 05

pieter commented 4 years ago

Tried this today and the motion sensor worked as expected in Homekit.

Having an updated case would be awesome, not sure how the module is going to fit though. The HC-SR501 is kinda big. I was thinking maybe we could stack the modules, with the Raspberry being at the bottom, and the camera + motion sensor on top? So something like this:

|-\ /-------/         \------|
| CAM          MOTION        |
|        RASPBERRY           |
------------------------------

Excuses for the crappy ASCII art. This would create a somewhat thick, shorter version of the cam.

phillipthelen commented 4 years ago

@pieter I like your idea! My idea unfortunately doesn't really work, since the sensor is a lot thicker than I thought it would be. For the shorter/thicker case, there would probably also need to be a middle piece that separates the PI from the camera and sensor, so that no components can touch each other.

RaymondMouthaan commented 4 years ago

You might consider using a different (smaller) motion sensor like the MH-SR602 or AM312

cyberhusky69 commented 4 years ago

Hello I'm new here but find the hkcam project very interesting. Does the motion detection also work with Doppler radar sensor RCWL-0516 ? The main advantage over PIR sensors are the can be placed inside a case, have a higher range like 7 m and only detects human or animal motions (as they react on water inside bodies). This way the cam only detects motions it should and not vaccuum cleaners moving around or plants moving through wind.

The connections between the Pi and RCWL-0516 are as follows. Raspberry Pi RCWL-0516 5V VIN GND GND GPIO17 OUT

More infos on how to connect this motion detector can be found here https://www.electromaker.io/tutorial/blog/using-a-doppler-radar-sensor-with-the-raspberry-pi-12

RaymondMouthaan commented 4 years ago

Some possible disadvantages of the rcwl-0516 could be that it has 360 degrees detection and goes through walls and doors, it might detect your neighbors.

cyberhusky69 commented 4 years ago

Some possible disadvantages of the rcwl-0516 could be that it has 360 degrees detection and goes through walls and doors, it might detect your neighbors.

I have nor neighbors just my cat and dogs around the house.

libewa commented 3 years ago

Does the motion detection also work with Doppler radar sensor RCWL-0516 ?

More infos on how to connect this motion detector can be found here

https://www.electromaker.io/tutorial/blog/using-a-doppler-radar-sensor-with-the-raspberry-pi-12

You can connect it to HomeKit (for example brutella/hc) and create an automation A sensor detect something > camera > record video or HomeKit's auto-recording, but it has to be implemented by @brutella.

sighmon commented 2 years ago

If anyone wants this as a standalone Go app while the PR is being reviewed: https://github.com/sighmon/homekit-hcsr501