Inspiration
We have all been there: lying in bed wondering if we turned off the lights, or coming home to find the fan and AC running all day. Physical switches are scattered around the house, and for elderly people or people with limited mobility, walking around to use them is not always easy. We wanted to build a single place where a person can see every device in the house and control it with a click.
What it does
SmartHome is a simulated smart home control system. A user signs up, logs in, creates rooms such as a bedroom or kitchen, and adds devices to each room. Five device types are supported:
- Light: ON/OFF and brightness from 0 to 100%
- Fan: ON/OFF and speed from 1 to 5
- AC: ON/OFF and temperature from 16 to 30 °C
- Fridge: ON/OFF and internal temperature from -5 to 10 °C
- Door Lock: lock and unlock
The dashboard shows the total number of rooms, the total number of devices, and how many devices are currently active or inactive, so the user always knows what is running.
How we built it
The project was built in two stages.
1. C++ console version. We designed the core system using Object-Oriented Programming. device is an abstract base class with pure virtual functions, and light, fan, AC, fridge and doorlock inherit from it. A room stores its devices as base-class pointers, so one list can hold any device type and the correct behaviour is chosen at runtime (polymorphism). Devices are created with dynamic memory and freed in the room's destructor. Static members generate unique device IDs, and operator overloading is used for comparing and printing devices. We also drew a class diagram with Draw.io before writing the code.
2. Web dashboard. We then built a browser-based interface with HTML, CSS and JavaScript so the same ideas could be used with buttons, sliders and cards instead of a text menu.
Challenges we ran into
- Turning a text-based C++ menu system into a visual dashboard that follows the same logic.
- Keeping every device within safe limits, such as fan speed, brightness and temperature ranges.
- Managing memory correctly in C++ when devices are added and removed from a room.
- Making the interface simple enough that anyone, including elderly users, can understand it.
What we learned
We learned how abstraction, inheritance and polymorphism work together in a real project, how to manage heap memory safely, how to plan a system with a class diagram before coding, and how to turn a console program into a visual interface.
What's next
- Timers and scheduling, for example "turn off the light in 30 minutes"
- Energy usage tracking
- A security system with motion detection
- Saving data permanently, since it currently resets when the page is refreshed