{"id":15172753,"url":"https://github.com/mkaczmarski07/smart-home","last_synced_at":"2025-04-13T09:31:03.735Z","repository":{"id":227155840,"uuid":"759943468","full_name":"MKaczmarski07/smart-home","owner":"MKaczmarski07","description":"A smart home management platform based on Raspberry PI ","archived":false,"fork":false,"pushed_at":"2024-10-10T21:43:02.000Z","size":1408,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T01:12:20.667Z","etag":null,"topics":["embedded-systems","home-automation","ionic","python-script","raspberry-pi-4","rest-api"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/MKaczmarski07.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-02-19T16:18:15.000Z","updated_at":"2024-10-10T21:43:06.000Z","dependencies_parsed_at":"2024-03-11T22:49:14.980Z","dependency_job_id":"66602595-6ae8-46b8-93f5-b1c022a129bc","html_url":"https://github.com/MKaczmarski07/smart-home","commit_stats":{"total_commits":33,"total_committers":2,"mean_commits":16.5,"dds":"0.24242424242424243","last_synced_commit":"28f4b445d2396de6c57cf0e69c3edf53d42714c8"},"previous_names":["mkaczmarski07/smart-home"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKaczmarski07%2Fsmart-home","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKaczmarski07%2Fsmart-home/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKaczmarski07%2Fsmart-home/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MKaczmarski07%2Fsmart-home/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MKaczmarski07","download_url":"https://codeload.github.com/MKaczmarski07/smart-home/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248690760,"owners_count":21146200,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["embedded-systems","home-automation","ionic","python-script","raspberry-pi-4","rest-api"],"created_at":"2024-09-27T10:04:14.108Z","updated_at":"2025-04-13T09:31:02.905Z","avatar_url":"https://github.com/MKaczmarski07.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \n# Smart Home Management Platform\n\n  \u003cp align=\"center\"\u003e\n    \u003ci\u003eProject done for an engineering thesis\u003c/i\u003e \u003cbr/\u003e\n    Lublin University of Technology \u003cbr/\u003e\n    Faculty of Electrical Engineering and Computer Science \u003cbr/\u003e\n    Department of Electrical Engineering and Intelligent Technologies\n    \u003cbr /\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n\n## About The Project\n\n**Thesis title:** \u003ci\u003eDesign and implementation of a smart home management platform\u003c/i\u003e \u003cbr/\u003e\nThe main goal was to develop a system allowing for remote control of home automation devices using the HTTP protocol and a smartphone application. The project assumes creation of a low-budget electronic model using a set of sensors and actuators simulating the operation of real home devices. The brain of the whole system is a Raspberry PI microcomputer, responsible for managing connected devices and enabling remote communication with the end-user's smartphone application. This repository, along with the documentation below, can also serve as inspiration and help for people who want to start their adventure with IoT, embedded systems or RaspberryPi.\n\n![Mockup](https://github.com/user-attachments/assets/be52269e-f8ee-4582-b493-0c3fa09b6f28)\n\n## Features\n- Home arming function - Controlling the operation of the motion sensor and detecting intrusions.\n- Sending notifications and turning on the alarm when an intrusion is detected, with the option of turning off each of these functions.\n- Measuring current temperature and humidity in a room and displaying data in the application.\n- Remote control of the servo mechanism representing automatic blinds.\n- RGB lighting with the ability to set any color and brightness from the application.\n- Various lighting scenes.\n- Displaying current weather data based on the weather api.\n\n\n# Table of contents\n- [Part list](#part-list)\n- [Hardware Architecture](#hardware-architecture)\n- [Software Architecture](#software-architecture)\n- [Used Technologies](#used-technologies)\n- [Storing data and managing states](#database)\n- [Network Communication](#network)\n- [Ionic App - Architecture and setup guide](#ionic)\n- [Setup the Raspberry Pi](#setup-the-raspberry-pi)\n- [Setup Flask Web Server](#setup-flask)\n- [Expansion Possibilities](#expansion-possibilities)\n\n\n\u003ca name=\"part-list\"\u003e\u003c/a\u003e\n## Part list\n\n| Name  | Anmount | Description |\n| ------------- | ------------- | ------------- |\n| Raspberry Pi 4 model B | 1 | Microcomputer |\n| JustPi LT-4B03 | 1 | Cooling case for Raspberry Pi 4B  |\n| JustPi USB C 5V/3A  | 1 | Power supply for Raspberry Pi 4B  |\n| DHT11 | 1 | Temperature and humidity sensor |\n| Active buzzer 5V 12mm | 1 | Small sound generator |\n| PIR HC-SR501 | 1 | Motion sensor  |\n| MicroSerwo SG-90 | 1 | Precisely controlled rotation mechanism |\n| MB102 Power supply | 1 | Power supply module for the breadboard |\n| JustPi - 830 breadboard | 1 | Tool used to build circuits without soldering |\n| RGB LED diode, co-cathode | 2 | - |\n| Resistor 220 Ω  | 6 | - |\n| Resistor 1 kΩ  | 1 | - |\n\n\u003ca name=\"hardware-architecture\"\u003e\u003c/a\u003e\n## Hardware Architecture\n![scheme](https://github.com/user-attachments/assets/979696b2-025e-485b-8386-d008075ac5f7)\n\u003ci\u003eSome components should be directly grounded to the raspberry pi to work properly. However, it is not recommended to power components such as motors directly from the board pins, because too high current may damage the pin or the computer.\u003c/i\u003e \u003cbr/\u003e\n\n\n\u003ca name=\"software-architecture\"\u003e\u003c/a\u003e\n## Software Architecture\n![software architecture](https://github.com/MKaczmarski07/smart-home/assets/95142305/5c28e503-e384-4ae9-9a3b-06f5e70e3058)\n\n\n\u003ca name=\"used-technologies\"\u003e\u003c/a\u003e\n## Used Technologies\n\n### Programming Languages\n[TypeScript 🔗](https://typescriptlang.org)\u003cbr\u003e\n[Python 3 🔗](https://www.python.org)\u003cbr\u003e\n\n### Frameworks \u0026 Extensions\n[Ionic 🔗](https://ionicframework.com)\u003cbr\u003e\n[Angular 17 🔗](https://angular.dev)\u003cbr\u003e\n[Sass 🔗](https://sass-lang.com)\u003cbr\u003e\n[Flask 🔗](https://flask.palletsprojects.com/en/3.0.x/)\u003cbr\u003e\n\n### Libraries\n[Iro.Js 🔗](https://iro.js.org)\u003cbr\u003e\n[Flask CORS 🔗](https://flask-cors.readthedocs.io/en/latest/)\u003cbr\u003e\n[Adafruit CircuitPython DHT 🔗](https://docs.circuitpython.org/projects/dht/en/latest/)\u003cbr\u003e\n\n### Databases\n[SQLite 🔗](https://www.sqlite.org)\u003cbr\u003e\n\n\u003ca name=\"database\"\u003e\u003c/a\u003e\n## Storing data and managing states\nAll states and attributes are stored in the relational database in a table named states. Every IoT device and utility ( such as light scene ) is represented by a unique address.\n\n| Field  | Type |\n| ------------- | ------------- |\n| id | INTEGER PRIMARY KEY |\n| adress | TEXT UNIQUE |\n| state | TEXT |\n| attributes | TEXT |\n\n\u003ca name=\"network\"\u003e\u003c/a\u003e\n## Network Communication\nCommunication between the user's application and the server ( Raspberry PI ) takes place in the local network ( LAN ). This is a common solution used in IoT systems. Local network ensures reliable and secure communication. Devices can communicate with each other without the need for an internet connection and unauthorized access is more difficult. \u003cbr/\u003e\n\nRemote communication with the system via the Internet is also possible, e.g. by port forwarding. However, this solution requires an additional layer of security, including user authentication and protection against various types of external attacks.\n\n\n\u003ca name=\"ionic\"\u003e\u003c/a\u003e\n## Ionic App\n### Core Architecture\nIonic Framework is a collection of customisable UI Components and tools, allowing for cross-platform develompent. The same code base, written using popular web frameworks ( e.g Angular or React ) can work on many platforms and use native functionalities. It's possible thanks to the Capacitor - a native runtime built by the Ionic team.\u003cbr/\u003e\n\nFor this project, I decided to use Angular version 17 as the main framework. While the Standalone approach is newer and makes use of more modern Angular 17 APIs, the Modules approach is currently more supported in Ionic. Most of the Angular examples on documentation website use the Modules approach.\u003cbr/\u003e\n\nBreaking the application into modules allows for significant reduction of loading time. Main routing strategy uses [Ionic Tabs](https://ionicframework.com/docs/api/tabs) architecture, which also increases performance of the native application.\n\n### Setup Guide\nBefore you begin, make sure you have the following installed on your machine:\n\n- Node.js (version 18.13 or later) \n- npm package manager (version 9.0 or later)\n\nTo install all required dependencies, move to the app main workspace ( frontend folder ) and run:\n\n    npm i\n\nTo create a localhost port type:\n\n    ionic serve\n\nYour application is ready at port 8100.\n\n    http://localhost:8100/\n\n\n\u003ca name=\"raspi\"\u003e\u003c/a\u003e\n## Setup the Raspberry Pi\n\n### First steps\nThe first step is to upload the Raspberry  Pi OS image to the SD card. This can be easily done using the [Raspberry Pi Imager](https://www.raspberrypi.com/software/) tool available on the official website.\n\nAfter installing the system and initial configuration, you can connect to the microcomputer wirelessly using SSH. In the terminal on your computer, enter:\n\n```\n  ssh username@ipAddress\n  password\n```\nWhere the first part corresponds to the user account, and the second part is the IP address of the raspberry in the local network. The default user is \"pi\" and the default password is \"raspberry\".\n\n### Safe shutdown\nThe raspberrypi microcomputer should not be turned off by immediately disconnecting the power supply, as this may damage the system or the SD card. To safely turn off your device, in the raspberry terminal, enter\n```\n  sudo shutdown -h now\n```\nAnd wait until the green LED on the raspberry stops blinking\n\n\u003ca name=\"setup-flask\"\u003e\u003c/a\u003e\n## Setup Flask Web Server Manually\nFirst, install the required dependencies\n\n```\nsudo apt update\nsudo apt upgrade\n\nsudo apt install python3-pip\n\npip install Flask\npip install Flask-Cors\npip install adafruit-circuitpython-dht\n```\nThen, go to the backend folder and run the server.py file\n```\npython server.py\n```\n\u003ca name=\"expansion-possibilities\"\u003e\u003c/a\u003e\n## Expansion Possibilities\n- Due to the availability of funds, the project uses a wired connection to sensors and actuators, directly to the GPIO ports. In a full-scale home system, communication could take place wirelessly, e.g. via the ZigBee protocol or Bluetooth.\n- RGB LEDs can be replaced with a regular light bulb or an RGB bulb powered by the power grid. Such a bulb can be controlled using a relay that connects to the system wirelessly using a micro-controller such as ESP8266.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkaczmarski07%2Fsmart-home","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmkaczmarski07%2Fsmart-home","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmkaczmarski07%2Fsmart-home/lists"}