/smart-postbox

Smart postbox - takes picture of the post, detects text on it and sends email

Primary LanguagePythonMIT LicenseMIT

smart-postbox

Main idea:

Prototype

Used components:

2 x Raspberry Pi 3 Model B
1 x Picamera
1 x PIR motion sensor
1 x RGB LED
1 x Breadborad
1 x Powerbank for the Raspberry Pi in the postbox
3 x femmale-to-female cable
2 x male-to-female cable
3 x male-to-male cable
Resistor(s) for LED

Setup on 1st Raspberry Pi

Data Flow

Configure

  1. first set up your Google Cloud Vision API and get your key. You can use this tutorial:
    https://www.dexterindustries.com/howto/use-google-cloud-vision-on-the-raspberry-pi/
  2. then create a file named "credentials" containing sender_email, sender_password, receiver_email like below:
sender@example.com
password1234
receiver@example.com

How to use

  1. run pir.py on the 1st Raspberry Pi
$ python3 pir.py
  1. run camera_2.py using Flask on the 1st Raspberry Pi
$ export FLASK_APP = camera_2.py
$ pyhton3 camera2.py
  1. Start Google Cloud Vision by exporting your key on the 2nd Raspberry Pi
$ export GOOGLE_APPLICATION_CREDENTIALS=your_google_vision_key.json
  1. run ocr.py using Flask on the 2nd Raspberry Pi
$ export FLASK_APP = ocr.py
$ flask run

pir.py runs on the 1st Raspberry Pi, detects new post insertion
camera_2.py runs on the 1st Raspberry Pi, takes a picture of the post and sends it to the 2nd Raspberry Pi
ocr.py runs on the 2nd Raspberry Pi, detects text on the post, applies filters and sends email