logo elektroda
logo elektroda
X
logo elektroda

Raspberry Pi 3 + WiFi + Camera + PIR = home monitoring

matti0010 

Welcome,

I would like to introduce you to a simple and easy project that anyone can quickly build. For this purpose, I used Raspberry Pi 3 model B with built-in WiFi. This is home monitoring that can be turned on when leaving the apartment. When the alarm is armed (60 seconds after pressing the button) and detects movement, a photo will be taken, which will then be sent to the indicated email address. After sending the photo, the system waits 1 second (total intervals are a few seconds) and checks whether the movement is still detected, if so, the process of taking the photo and sending the message is repeated until the movement disappears.

For a project outside Raspberry Pi 3 you need:
- HC-SR501 PIR motion sensor, which should be connected to GPIO14 (5V is available on pin number 4),
- signaling diode (LED 3mm + resistor), which should be connected to GPIO16,
- a camera dedicated to Raspberry Pi, which should be connected to the dedicated connector located on the board,
- membrane keyboard, in which the selected character should be connected to the GPIO2 and GPIO3 pins

Now a few words of explanation. The membrane keypad 4x4 characters gives great possibilities, e.g. you can enter codes to activate and deactivate the alarm. Here, however, I used a simplified version in which I selected one button from the entire keyboard and it is he who is responsible for turning the alarm on and off. We decide which button is connected (connecting it properly). The alarm operation is signaled by a lit LED. If the alarm is turned off, the LED goes out.

Before starting the program, configure WiFi so that it can always connect to the network by itself. Alternatively, a cable can be used :)

Python code:
Code: Python
Log in, to see the code


I warn you right away that I practically don't know Python so I know it could have been done better. I'm just learning the language in my free time :) If anyone has any valuable advice, I will gladly take it. Each photo taken is sent to an email address, which we will indicate in case the thief stole the device. Email support is configured for Gmail. You can choose the address to send email and the address to which this email should be sent.

The housing and appearance of the device are shown in the pictures below (I know the tragic quality). Additional holes are for the camera and PIR mounting screws (I need to find some, this is temporarily stabilized by adhesive tape) :P ). I didn't take pictures from the inside because there is a small tangle of cables. As you can see, the keyboard comes out from the side. The power supply has also been led out. The cutouts are also not impressive, but the system works and fulfills its role, so I think it may be useful to someone.


About Author
matti0010 wrote 319 posts with rating 25 , helped 8 times. Been with us since 2012 year.

Comments

mr_grabarz 15 Jul 2017 22:07

In the case of exactly one camera can and profitable while few cameras in this solution rather poor better is the recorder + IP cameras of the things that caught my eye: - what if there is no... [Read more]

matti0010 15 Jul 2017 22:31

Ultimately, I wanted to make only one camera that will monitor the entrance door along with the corridor. If I had to make several cameras, of course your idea would be much better. For the rest: ... [Read more]

mr_grabarz 15 Jul 2017 22:38

nooo ok but how does everything behave? trying to send again? example: the IP connection has died, someone PIR is detecting something, the camera takes a picture, the script wants to send it - failed... [Read more]

matti0010 15 Jul 2017 23:15

If the photo fails to send, there are two possible cases: a) the motion is still detected so he takes a new photo and tries to send the new photo b) motion is not detected, then it does not take a... [Read more]

mr_grabarz 16 Jul 2017 21:37

I would think about trying to send a recent or recent photo if no motion is detected :) I was interested a few years back and the number of disadvantages far outweighed the number of advantages... [Read more]

matti0010 16 Jul 2017 21:40

I think I'll add the option to resend because it's a good idea. From what I read, I also found that there are more disadvantages than advantages. However, some may be interested :) What to... [Read more]

mr_grabarz 16 Jul 2017 21:44

because it is so-called off-topic and is inconsistent with the regulations? makes searching for information more difficult, because it is rather difficult to look for information about data transmission... [Read more]

Heinzek 16 Jul 2017 21:46

Nice construction. As for motion detection, it can be done on a "webcam". Read about motion which, when motion is detected on the camera, automatically saves photos to the designated place. It... [Read more]

matti0010 17 Jul 2017 17:56

We discussed possible ways of powering and transmitting the signal, which is an inseparable element of monitoring :P It makes sense with a clogged email, in that case a cloud and a better disk is... [Read more]

romulus73 20 Jul 2017 18:30

An interesting project I am doing now, alarm for the garage, but on Arduino The cloud is a linden I mean dropbox, buy yourself a NAS and there you have 4 cameras as standard. When you configure it,... [Read more]

mr_grabarz 21 Jul 2017 00:14

cloud is one thing, network disk is another they sum it up like this: people are divided into three groups: 1. those who do backups 2. those who will do backups 3. those who think they are... [Read more]

Freddy 21 Jul 2017 06:30

Why? Regular backups are different, and a copy of files in the cloud is different - they can coexist. [Read more]

romulus73 21 Jul 2017 09:39

Colleagues cloud is a network folder with synchronization placed on the NAS. Why do you think I have one disk? I have a cloud with full synchronization, you have a dropbox without a beckap and the... [Read more]

..::MariuszB::.. 22 Jul 2017 16:39

The cloud today because of the costs and profits associated with it is implemented quite often on one rack and in the same room with the marketing slogan "in the cloud safer". But everyone believes in... [Read more]

matti0010 22 Jul 2017 20:04

I noticed an interesting problem. Sometimes the system will arm or disarm itself. It is as if the state on the keyboard pin was unstable. A pull-up polarizing resistor would probably help (because I'm... [Read more]