hkcam icon indicating copy to clipboard operation
hkcam copied to clipboard

Motion sensor version

Open nielsth opened this issue 5 years ago • 15 comments

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?

nielsth avatar May 24 '19 14:05 nielsth

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

brutella avatar May 27 '19 18:05 brutella

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.

nielsth avatar May 28 '19 08:05 nielsth

Possible this could be developed natively using just the camera:

https://github.com/bemasher/pmvr

kaidesu avatar Jun 01 '19 03:06 kaidesu

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.

pieter avatar Jun 20 '19 17:06 pieter

This feature looks very interesting.

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

brutella avatar Jun 21 '19 16:06 brutella

@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.

nielsth avatar Jun 26 '19 08:06 nielsth

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

phillipthelen avatar Jul 15 '19 19:07 phillipthelen

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.

pieter avatar Jul 17 '19 19:07 pieter

@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.

phillipthelen avatar Jul 18 '19 12:07 phillipthelen

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

RaymondMouthaan avatar Jul 20 '19 05:07 RaymondMouthaan

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

cyberhusky69 avatar Aug 22 '19 09:08 cyberhusky69

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.

RaymondMouthaan avatar Aug 22 '19 13:08 RaymondMouthaan

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.

cyberhusky69 avatar Aug 22 '19 14:08 cyberhusky69

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.

libewa avatar Dec 29 '20 10:12 libewa

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

sighmon avatar Jun 18 '22 05:06 sighmon