Introduction: AnE Smart Doorbell Systems

AnE Smart Doorbell Systems is a system that aims to inform you when someone presses the button of your doorbell. When a guest presses the button of the doorbell, which is placed outside the house, the buzzer will ring. The PiCam, which is mounted outside the house, allows them to take a photo/ short video should they feel that there is a potential intruder(s). The LED is placed inside the house to allow the homeowner(s) to simulate that the house is not vacant and ward away potential intruders.

To differentiate it from your standard doorbell system, it makes use of Telegram messenger application to notify the homeowner(s) when a guest presses the button and allow the homeowner(s) to send a response. There are various types of responses that the homeowner(s) can send- display a message via LCD screen, turn on LED or take a video/ picture using the PiCam. Should they not have a Telegram account linked to their AnE Smart Doorbell Systems’ account, they can make use of the web interface which allows them to perform the same functions as if they were to use Telegram.

Have fun learning!

For a more detailed explanation, look into the word document below:

Step 1: Summary of the Steps That Would Be Discsused

  • Overview of set-up
  • Hardware Requirements
  • Setting up Smart Doorbell
  • Test Run

Step 2: Final Hardware Set-up

After the completion of our tutorial, the raspberrypi set-up would look like this.

Step 3: Hardware Requirements


Overview of the hardware components required for this application.

  • Tactile Push-button (1)
  • 10kΩ Resistor (1)
  • LED (1)
  • 330 Ω Resistor (3)
  • I2C LCD Screen (1)
  • Buzzer (1)
  • Jumper Wires: Male-Female(4) & Male-Male (8)

Step 4: Setting Up Smart Doorbell (Part 1)

Setting up your raspberry pi components

The images shown are step-by-step procedures on how the hardware set-up looks like.

After completing the setup, you can then download the codes needed to run the program from the link below.

Pi codes link:
https://github.com/eunicepoh98/IOTAssignment2/tree/master/IOTPi

Step 5: Setting Up Smart Doorbell (Part 2)

Setting up AWS

AnE Smart Doorbell Systems makes
use of Amazon Web Services (AWS) to publish and subscribe to the state of the hardware components, such as LCD Screen and PiCam.

­­­When the button is pressed, it publishes a payload, which informs subscribers such Telegram or web app. The other hardware components also publish payloads, which keeps the user informed of its state and keeps track of its history.

  1. At the AWS Console, click on Services.
  2. Select AWS IoT
  3. At the AWS IoT Dashboard, select Registry | Things
  4. Click on Create *Note: If you don’t have a thing yet, click on Register a thing.
  5. Give your Thing a name and click Create thing
  6. Select Interact and copy and paste REST API Endpoint to a notepad
  7. At the AWS IoT Dashboard, select Security | Certificates
  8. Click on Create *Note: If you don’t have a certificate yet, click on Create certificate
  9. Click Download for each certificate
  10. Move your certs to a new folder named certs and rename them accordingly
  11. Click Attach a policy
  12. Click Create a new policy
  13. Define the policy name and authorized actions and click 'Create'.
  14. Go back to the Iot dashboard, select security | certificates and click on the certificate menu to attach policy
  15. select the policy you created and attach

Step 6: Setting Up Smart Doorbell (Part 3)

Installing necessary libraries

The word document includes the necessary libraries that would be needed to be installed in order to run the programs on your raspberry pi.

After installing the necessary libraries, you can now proceed to download the python file which includes the codes needed to run the raspberry pi components.

1. Install Flask with this command

sudo pip install flask

2. Install the AWS Python library with this command

sudo pip install AWSIoTPythonSDK

3. Install Boto, the Python library for AWS on your raspberrypi

sudo pip install boto3

4. Install the AWS Command‐Line Interface Client on your Raspberry Pi

sudo pip install awscli

5. Create a python script ane_doorbell.py with the code below

sudo nano ~/smartdoorbell/ane_doorbell.py

Step 7: Setting Up Smart Doorbell (Part 4)

Building the telegram bot

In this section, we will explain the different steps needed to be taken to make the telegram bot working.

We will be using Telegram Bot to notify the user when someone presses their doorbell and also allow the user to interact with their system through being able to

1. Display or clear message on their LCD display

2. Turning On and Off the light

3. Take a Picture

4. Take a 8s Video

Users will only be able to interact with the Telegram bot if they have created an account on the website and link their telegram account to their Product.

Firebase

We will be using Firebase as a datebase as well as to authenticate the users when they login using their email and password

The kind of information we will be storing in database:

- Product Keys and the Users link to it if any - User's email, telegram chat id, authentication uuid, and product key - User's Product devices information such as displayed messages, photo and video url in s3, light status and time doorbell is pressed

Bluemix

We will be using Bluemix SDK for Node.js to host our Node.js Server in the cloud. The Node.js Server will handle the telegram bot events, subscribing and publishing with the AWS IoT as well as reading and writing to Firebase

Link:
https://github.com/eunicepoh98/IOTAssignment2/tree/master/IOTNode

Step 8: Setting Up Smart Doorbell (Part 5)

Setting up Web app

├── static

| └── css

| ├── login.css

| ├── register.css

| ├── styles.css

| └── welcome.css

|

├── templates

| ├── dashboard.html

| ├── lcd.html

| ├── light.html

| ├── login.html

| ├── picture.html

| ├── register.html

| └── welcome.html

|

└── server.py

after completion, you should have these files in your folder in order to run the web app. Download the codes from the git hub link below.

Web codes link:

https://github.com/eunicepoh98/IOTAssignment2/tree/master/IOTWeb

Step 9: Setting Up Smart Doorbell (Part 6)

Test Run

To test the project run this code on the raspberry pi:

sudo python ~/smartdoorbell/ane_doorbell.py

To test the web browser run the following code :

python server.py

Test the telegram bot by searching for @AnE_Bot on the telegram application.

Step 10: Done!

Thanks for reading!

We hope this tutorial was of help to you and happy coding :)