HomeNode is a smart home system that is radically cheaper than traditional products while offering many of the same functionalities, including monitoring and controlling many different factors of home living, home automation (ex: watering plants), and intruder detection.
See full code for project here.
Architecture of project.
Tools / Techniques Used
- GitHub for version control + collaborating code sharing
- docker-compose for faster build times + pushed to docker hub
- Digital Ocean droplet, server built by pulling the docker image from docker hub, then running it on the droplet
- Backend server written in NodeJS with TypeScript
- Express.js is the main library used for the server, to allow for middleware and routing
- Index file connects to MongoDB using the mongoose library, listens on port 80 with the server, and sets up cronjobs
- Server.js file sets up middleware for CORS, JSON, and serving static files.
- The API routing passes data to the sensors, intruders, home, or users as specified, and calls functions for getting data, posting data, putting data, and deleting data, as specified.
- Created in React.js with TypeScript
- UI was created using the npm library Chakra UI and code snippets from Choc UI
- Axios used to send HTTP requests to communicate with the backend server
- ReCharts was used to create the data visualizations
Raspberry Pi (Software perspective)
- Sends requests and reads responses from the Arduinos using the serial library in Python
- Converts the sensor data as Python objects with custom classes
- JSON + Requests library to format and send data to the corresponding API endpoint
Arduino (Software perspective)
- Algorithm to process raw sensor data and send significant average data to the central Raspberry Pi, by comparing to past data
- Wokwi for testing and simulation
- All Arduino boards are constantly checking the serial buffer to see if their respective address has been requested for data
I wrote code so that the raspberry PI reads from the serial line and converts that data into a Python dictionary. I implemented object-oriented programming to modularize the code and easily interface with all of the modules (intruder, sensors, and plants) as well as communicating with the server through the Python requests library. I also wrote unit tests and implemented continuous integration through GitHub actions for my Python code.