Home Communication

by ThomasHowest in Circuits > Raspberry Pi

139 Views, 0 Favorites, 0 Comments

Home Communication

posterA4.png

Hello there,

I am Thomas and I made a school project that i like to share with you. The concept of my project is that parents can communicate with their students in a simple way. The communication is send between a device for the student and an interface for the parents. Your parents do not have to shout again from downstairs!

Everything runs on the Raspberry Pi (Database, Webserver, Backend).

In the next steps I will explain how to realise this project.

Supplies

It is very important to have all the requirements. This is a list of all the components that you need for the electronic work. So let's begin!

Requirements:

- Raspberry Pi 4 (2/4GB Ram)

- Breadboard 3.3-5V Power Supply

- Mini PIR sensor infrared

- Rotary Encoder

- CCS811 Gas Airquality sensor

- LED Stick NeoPixel

- Buzzer

- Mini vibrator

- Push button

- Lcd display

- Male-Male Cables

- Male-Female Cables

You can download my 'BOM' (bill of materials) document for more details (price, specific names).

Soldering the Components

Extend the litle wires with a longer one and a male endpoint so you can put it in the breadbord easily.

- Push button

- Mini vibrator

Solder the pins on the printboard of your component.

- Air quality sensor

- Lcd display

Make the Circuit

electronica.png
breadbord.png

With the fritzing document you can easily recreate the circuit.

! Make sure you wire the components to the right voltage levels !

Setup Raspberry Pi

Follow the steps with attention, this is the big start of your project!

1) Log in on your pi

  • login with an ssh connection on your pi
  • add your wifi-network

2) Enable the required interface

  • 'raspi-config' command
  • enable the following interface: I²C

3) install the webserver and database

  • webserver: 'apt install apache2 -y' command
  • mariadb: 'apt install mariadb-server mariadb-client -y' command

Database

Screenshot 2021-06-11 at 10.15.28.png
Screenshot 2021-06-12 at 11.01.00.png

1) Setting Up the Database on the Raspberry Pi Via SSH

Make connection a SSH connection to your database on the Raspberry Pi. (screenshot)

2) Create the Database, tabels and relations

The database needs to collect two big things. It needs to collect all the messages that have been made and also the values that have been mesured from the different sensors.

In detail:

- Messages History(Autoincrement id's history, datetime of the message, datetime when the message alarm is toggled, text of the message, status of the message)

- Sensors History(Autoincrement id's history, id's from the devices, datetime of the measurement, measurement)

- Devices (id's, name, measuring unit, status of the device, type of the device)

- Room (id's, Firstname)

Devices and Sensors have a relation in the database as you can see on the ERD (Entity Relationship Diagram).

If you want to test your database with records, dowload the excel file and check if everything works! (excel)

Start Coding

Screenshot 2021-06-11 at 10.55.25.png

So now the setup is done, we can finally begin writing our program!

Visual Studio

Visual Studio is perfect for coding. You can connect to your Raspberry Pi with a SSH connection.

a) Connect the RPI to your laptop with a LAN cabel

b) Create a remote connection (https://code.visualstudio.com/docs/remote/ssh)

c) Open a new terminal and run these command

  • pip3 install flask-cors
  • pip3 install flask-socketio
  • pip3 install mysql-connector-python
  • pip3 install gevent
  • pip3 install gevent-websocket

c) Dowload the code from my Github (code)

Make a Case

IMG_20210602_110241.jpg
IMG_20210609_190650.jpg
IMG_20210609_124557.jpg
IMG_20210609_122212.jpg
IMG_20210612_161338.jpg
IMG_20210612_161327.jpg
IMG_20210615_154106.jpg
IMG_20210615_154140.jpg
IMG_20210615_154114.jpg

This is the way i made a case for my project.

1) Draw a sketch of your case on paper with the required measurements

  • 2x 20cm x 15cm wood
  • 2x 8cm x 15cm wood
  • 2x 8cm x 20 cm wood
  • 2x hinges
  • Extra wood to finish the product

2) Drill or saw holes for the components.

3) Add the wood to each other with nails or wood glue.

4) Glue the components in the case where needed.

5) Make finishing touches with silicone and extra wood.