Home Hub

Technologies Used:

  • React
  • Next.js
  • Firebase
  • Raspberry Pi
  • MQTT
Home Hub
Home Hub

The Home Hub is a smart home dashboard that I created to help me keep track of the various hand-built sensors and devices in my home. I wanted a way to see all of the information in one place, so I built a dashboard that displays the current temperature and humidity in my home, as well as soil moisture levels for my plants, details about incoming package deliveries, and helpful reminders about things like trash day.

Using a public internet service like Arduino Cloud was an option, but I decided to develop my own solution for two reasons: maintaining data privacy and gaining a deeper understanding of data sharing methods over a network. There's no need to send my data out to a cloud service since all of the devices are on the same local network within my home.

The dashboard is built using React for the UI and MQTT to receive sensor data over my local network. It uses third-party APIs to get package information from UPS and USPS, which is then stored in a Firebase database to deal with issues tracking packages for a while after delivery (the API stops returning data once a package is delivered). I use a Raspberry Pi to run the dashboard and display it on a wall-mounted tablet. The Raspberry Pi subscribes to an MQTT broker to receive updates from my sensors and devices, and then my React components display that data in the UI.

Challenges

The biggest challenge for this project was finding the best way to send data in real-time from each sensor to the home hub. I initially explored using Bluetooth for the project because I was familiar with it from my consumer electronics. I abandoned this approach, though, due to the inconvenience of reconnecting sensors to the home hub after power outages or reboots. In addition, the Node.js bindings for managing Bluetooth connections on a Raspberry Pi were poorly supported at the time. I had also considered using the Web Bluetooth API to connect devices through the web browser, but the available browsers for the Raspberry Pi didn't support it.

Realizing that all devices were on the same network, I opted to employ the MQTT pub/sub protocol for data transmission. MQTT's widespread support across operating systems and programming languages made it straightforward to implement on the Raspberry Pi. I configured the Raspberry Pi used for the Home Hub as an MQTT broker and subscribed it to the channels associated with each sensor. I also updated each sensor to publish data to their respective channels whenever the sensor data changed. The React application running on the Raspberry Pi listens to these subscriptions, updating the UI whenever new data is received.