SaferHouse is my (@abdallahmehiz), @motazzakoof and @ouchenehichem's graduation project.
It is a prototype of a home security system made with:
- Arduinos (ESP32 + Arduino Mega) as the microcontrollers.
- Spring Boot as the main framework in the back end.
- A Kotlin Multiplatform app for Android & iOS.
Let's talk about each one
Arduinos, by @motazzakoof
Through the use of a bunch of microcontrollers, each one responsible for displaying, collecting data or performing actions.
These are the microcontrollers used and tested in this project.
esp32 | Arduino Mega | 4x4 Keypad | 5 Volts Relay |
---|---|---|---|
MQ2 Gas Sensor | DHT11 Sensor | Flame Sensor | Water Sensor |
Buzzer | IC2 LCD | Motion Sensor | RFID |
The final arduino schematics looking like so:
The front end, by @abdallahmehiz
The app has the one job of handling communication between the back end and and the user, informing the user about the state of his house, give him the ability to perform actions and notify him in case of an emergency.
The app was made with the new Kotlin Multiplatform technology from JetBrains. so it works on both iOS (Tested it with a hackintosh) and Android.
It was built with Jetpack Compose as its ui library following Google's Clean architectural guidelines with an MVVM architecture.
We've used:
- Koin: for a dependency injection
- Ktor: for networking
- Kotlinx Serialization: for JSON manipulation
- Kotlinx DateTime: for working with dates
- SQLDelights: for the app's local database database.
- Voyager: for navigation
- Multiplatform Settings: for key-value data pairs storage.
- KMP Notifier: for notifications.
- Moko MVVM: for multiplatform viewmodels.
- Moko Biometry: for biometrics
- Moko Resources: for i18n/l10n
- Napier: for logging
And some other small libraries for like acra for Android crash reporting and few UI specific ones like Sonner for toasts and Materii's PTR for pull to refresh
Here are some screenshots of its homescreen.
Lights Page | Temps Page | Doors Page | Alarms Page |
---|---|---|---|
The app can be downloaded and tested here.
Note: The app's development cycle was less than 1 months long, and while using relatively new technologies that I wasn't that familiar with, expect bugs and crashes.
Note #2: To actually use the app, you'll need to self host the backend's api and provide the app with its url. I'll go into hosting it next.
The back end, by @abdallahmehiz
The project's back end was made with Spring Boot and Spring Framework.
A back end that follows most of the CNCF's recommendations for making a cloud native application.
I've made a publicly available Docker Image for the our backend's services all merged together here. You can choose to pull it by executing
docker pull saferhouse/api:latest
and configuring it. or just use this sample docker-compose.yaml file
Note: Be sure to fill in the smtp prompts or the email functionality won't work.
version: '3.8'
services:
database:
image: mariadb:latest
restart: always
hostname: database
container_name: saferhouse_database
environment:
- MARIADB_ROOT_PASSWORD=root
volumes:
- safer_house_db:/var/lib/mysql
networks:
- saferhouse
api:
image: saferhouse/api:latest
container_name: saferhouse_api
depends_on:
- database
networks:
- saferhouse
environment:
- DATABASE_URL=jdbc:mariadb://database:3306/safer_house
- DATABASE_USERNAME=root
- DATABASE_PASSWORD=root
- SERVER_PORT=8888
- MAIL_HOST= <>
- MAIL_USERNAME= <>
- MAIL_PASSWORD= <>
- MAIL_PORT= <>
ports:
- 8888:8888
- 8889:8889
- 8890:8890
volumes:
safer_house_db:
networks:
saferhouse:
driver: bridge
name: safehouse_network