all projects

Smart AC Control: An End-to-End IoT Solution

pythonflaskfastapisqlalchemywebsocketsmqttgcpnextjs 15typescriptreacttailwind cssshadcn/uivercelesp8266arduinoplatformiopostgresql

This project, developed for an internship at Ellipsis Infotech, is a complete IoT ecosystem for centralized air conditioning control in workspaces. The system allows multiple AC units to be controlled remotely through a unified dashboard, enabling efficient climate management across large workspaces.

Core Features & Functionality

The AC Control system is packed with features designed to provide a complete and seamless user experience:

  1. Real-time Dashboard: The dashboard provides an at-a-glance overview of the entire AC system, including key statistics like total devices, online devices, active devices, and configured zones.

  2. Device Management: Users have full control over individual AC units, with the ability to turn them on or off, and adjust the mode, temperature, and fan speed.

  3. Zone Control: To simplify management, devices can be grouped into zones based on their location, such as "Living Room" or "Upstairs".

  4. Batch Operations: The system supports batch operations, allowing users to control multiple devices at once, even across different zones.

  5. Secure Authentication: User accounts are protected with JWT-based authentication to ensure that only authorized users can access the system.

Technical Architecture & Stack

The system is comprised of three main components: a FastAPI backend, a Next.js frontend, and ESP8266 firmware.

  1. Backend: The backend is built with FastAPI, a modern Python web framework, and uses SQLAlchemy for asynchronous database operations with a PostgreSQL database. It handles user authentication, device management, and real-time communication via WebSockets and MQTT.

  2. Frontend: The frontend is a responsive web application built with Next.js, React, and TypeScript. It uses Tailwind CSS for styling and Shadcn/ui for its component library, providing a modern and intuitive user interface. The application is deployed on Vercel.

  3. Firmware: The firmware for the ESP8266-based IoT devices is built using the Arduino Framework and PlatformIO. It uses an IR LED to send commands to the AC units and communicates with the backend via MQTT. The firmware also supports Over-the-Air (OTA) updates for remote maintenance.

Security Considerations

Security was a key consideration in the design of this system:

  1. Secure Communication: The system uses MQTT over TLS and JWT authentication to secure communication between the frontend, backend, and IoT devices.

  2. Device Authentication: Each device has a unique secret key for authentication with the backend.

  3. Password Security: User passwords are not stored in plaintext; instead, they are hashed using bcrypt.

System Capabilities

  1. Multi-tenancy: The system is designed to support multiple customers or organizations.

  2. Scalability: The backend is deployed on Google Cloud Run, which provides serverless auto-scaling to handle a high volume of requests.

  3. High Performance: The use of asynchronous operations and optimized database queries ensures a responsive and efficient system.

Estimated reading time: 4 minutes