Skip to content

Security camera with human recognition based on A.I. detection

License

Notifications You must be signed in to change notification settings

Terkea/secure-pi

Repository files navigation

A brief introduction to Secure-PI

Secure-PI is a Raspberry Pi-based project powered by Google TensorFlow, which is essentially a security camera with human identification. It operates by taking photographs whenever a human presence is detected in the camera's field of view. All of the images contain a timestamp and can be seen on the web interface, allowing the user to remotely monitor what is going on. Aside from that, it has a live view and an SMTP server, which serves to send e-mails to users if the IP address has changed, because most ISPs use DHCP to randomly allocate IP addresses, and some of them change the IP's rather frequently, so we can provide a stable connection to the camera. alt text

Required materials

To get started we gonna need some materials such as:

  1. Raspberry pi 3b+
  2. Raspberry pi camera module you could buy a regular one, but I highly recommend the one with night vision
  3. Power supply
  4. MicroSD Card
  5. I suggest you buy weather a case which comes with a fan or at least heatsinks thus the temperatures can get high and it could damage the board.

Flashing the OS to the MicroSD card and testing the camera connection

After we gathered all the materials we can get started by putting all those pieces together and installing the operating system.

  • First of all download the latest version of Raspbian which can be found here:
https://www.raspberrypi.org/downloads/raspbian/
  • After that, we have to download balena etcher to write the os image to the MicroSD card
https://www.balena.io/etcher/
  • Flash the image

alt text

We'll perform a headless installation

  • Open the card and create two files in the boot folder, one called ssh without any extension, which will grant us ssh access later on and another one called wpa_supplicant.conf which will take care of the internet connection.
  • Open wpa_supplicant.conf and paste the following code and fill it with your wireless credentials and country
country=gb
update_config=1
ctrl_interface=/var/run/wpa_supplicant

network={
 ssid="<Name of your WiFi>"
 psk="<Password for your WiFi>"
}

alt text

  • Save, exit and plug the card into the Pi and boot it up

More information about this process can be found on raspberry pi documentation:

https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
  • After you plug in the power supply go to command prompt and type
arp -a

Something similar to this should show up, try to ssh all the IPs listed with dynamic type to find out which one was assigned to the pi. In my case was 192.168.1.133

alt text

You could also use angry IP scanner to find out which IP was assigned to the board alt text

  • With putty establish a ssh into the pi

The credentials are pi:raspberry

alt text

  • The next step is to test the camera to see if everything is all righ, in order to do so type the following command into the terminal
raspistill -o test.jpg

If no error shows up we can look over the file to see if it exists using ls, which means that everything is all right alt text

  • At this point, we have to update and upgrade the pi
sudo apt-get update
sudo apt-get upgrade

This may take a while so be patient. Once everything is done reboot the pi and we can get started installing secure-pi

Installing secure-pi

  • First of all, we have to download the installation file
wget https://raw.githubusercontent.com/Terkea/secure-pi/master/install.sh
  • Execute the shell file
sudo bash install.sh

The whole process might take between 10-20 minutes so meanwhile, be sure that you leave it alone to download all the requirements and install the service

  • Navigate to the IP address assigned to the pi>settings and set up the SMTP server with your credentials

login credentials: [email protected]:raspberry alt text

  • To make the pi visible outside our private network, we have to set up a port forwarding rule. To do this we have to log in into our router, then go to firewall. Add the raspberry pi's IP address and the running port which is by default set to 5000 save and restart the router. alt text

Your router interface would most likely look different but the process is just the same

Now we are all set and done. Congrats, you just got yourself a security camera with artificial intelligence

Contributing

Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.

About

Security camera with human recognition based on A.I. detection

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published