01 Objective

The goal of this project was to design and develop a proof-of-concept of a smart thermostat for a water heating system that could be controlled remotely through a user-friendly web application.

The prototype would also have the capability to integrate with energy providers and allow for dynamic control of water temperature based on real-time energy pricing. Furthermore, the project aimed to add an API to allow for accessing and controlling the thermostat by the energy and efficiency institute for research purposes, with the user's consent.

The initial key objectives of the project were:

  • To add cloud connectivity to the existing prototype of a physical device based on an ESP32 microcontroller
  • To research and select an appropriate communication protocol, and subsequently design and implement a cloud infrastructure to support its utilization
  • To design and develop a user-friendly web application that enables remote control of the prototype via cloud connectivity
  • To prepare for future integration with energy providers by designing and implementing a framework for communication via various APIs that will be made available in the future
  • To effectively achieve the objectives outlined above within a 7-day timeframe

There was an additional key objective that came up once the initial PoC has been delivered:

  • To implement an API in the prototype that would allow for accessing and controlling it by the energy and efficiency institute for research purposes with the user's consent.

02 Solution

To address the challenge of designing and developing the PoC taking into account the time constraint, the following steps have been taken:

  1. WebSockets have been chosen as the communication protocol due to the low cost of its usage on Amazon Web Services (client's cloud provider) when implemented with Serverless (API Gateway WebSockets) but also given the simplicity of integration with Web technologies such as React.js, JavaScript, or Node.js that were used to build the User Interface.
  2. Aforementioned React.js framework has been utilized along with TypeScript and TailwindCSS to quickly implement the web UI application and then AWS S3, AWS CloudFront, and AWS Route53 to deploy it to the cloud as a static Single Page Application.
  3. In order to speed up the development process of the server part of cloud-microcontroller connectivity Serverless Framework has been used to create an infrastructure with AWS Lambda function acting as a WebSocket server that has been placed behind AWS API Gateway WebSockets.
  4. ESP32 firmware has been modified to handle WebSocket communication and prepared for 3rd party API integration with energy providers.
  5. Finally all of the above has been tested with success and delivered in 3 days fulfilling the initial objective of PoC.

Once the initial prototype had been delivered additional key objective was introduced that we have fulfilled in around a week. An API for the research institute was added to the server implementation in order to allow for remote control of the device.