Offices are usually equipped with water coolers. There is one at ElifTech that was quite regular until recently: it consisted of a water bottle, two buttons for hot and cold water, and no guarantee that the bottle will not be empty right in front of your cup. We upgraded the device as part of our internal experiment - SmartOffice, so read below about the workflow and outcomes.

About the SmartOffice Project

We came up with the idea for ​​the experiment during a team brainstorm while we were talking about existing smart homes projects and automated home appliances. We decided to upgrade some existing office devices in order to test the Internet of Things technologies. A water cooler is one of the most used devices, so it became our pilot project, the "Smart Water Cooler" as we call it.

The Concept of the Smart Water Cooler

A struggle with the regular water cooler is that the water delivery is irregular and usually delayed. That often causes the team trouble by turning the office into a desert with no water to drink. The Smart Water Cooler monitors water supplies and automatically orders the next batch via SMS without human help. The team receives notifications from the system in a corporate chat, something like "there is water for only three cups of tea left." However, if a human still wants to be involved in the process, they can check the water level and its temperature from anywhere in the world.

Implementation

We upgraded to the Smart Water Cooler in three steps: we explored how a base model was designed, developed and programmed a hardware solution, and then we integrated it with Amazon Web Services.

The workflow was carried out as follows:

  • analyzing the solutions to determine the water level;
  • analyzing the platform and an MCU (Micro Controller Unit) for the project development;
  • exploring the structure of a regular cooler;
  • POC (Proof of Concept) development with minimal intervention in the hardware part;
  • software development for a microcontroller;
  • upgrading the Smart Water Cooler;
  • software development for monitoring;
  • UI development.

Integration of Water Level Determination

We found three options to determine the water level: a float level, a flow sensor, and a weight sensor.

After analyzing them, we rejected the float level because it makes contact with the water inside the bottle. The second option, the Arduino Water Meter, also needs to touch the drinking water, and it was not an affordable option. The weight sensor won. By knowing the weight of both full and empty bottles, we can calculate how much liquid is left.

An array of 4 sensors -  Load Cell, which is usually used in scales, was the best among the samples we tested. To connect the sensor to the MCU, we used the Load Cell Amplifier HX711.

Analyzing the Platform and an MCU (Micro Controller Unit) for the Project Development

Here we also had three options to choose from: Tessel 2, Arduino Nano + Ethernet / WiFi shield, and ESP8266. Tessel 2 is a much too powerful solution for our purpose. The Arduino Nano + Ethernet / WiFi shield won out over the ESP8266 because it has Wi-Fi, a powerful processor, and a sufficient number of ports on board. Additionally, its size and price are minimal. NodeMCU was used as the base firmware for the MCU. We were able to learn a new programming language during the process.

Exploring the Structure of a Regular Water Cooler

As it turned out, a water cooler is a surprisingly simple device that has a lot of empty space inside, which gave us good opportunities for the upgrade.

photo5.jpg

POC (Proof of Concept) Development

In order to test the concept, we developed a minimalistic software for the MCU. The data was transmitted to local MQTT broker Mosquitto® by using MQTT IoT standard. We attached an MCU to the water cooler and connected a thermosensor to the water container.

For a real-time graph showing temperature changes, we used the MQTT Dashboard Android application.

photo6.jpg

Software Development for a Microcontroller

We obtained data from two digital sensors: temperature sensor ds18b20 and weight sensor HX711. They are transmitted via a Wi-Fi connection in JSON format using MQTT protocol. Scripts are written in Lua and perform by NodeMCU firmware. When using an MCU, there is no option to use cryptography and certificates, which is why we launched a separate MQTT broker on the local network in the bridge mode, which uses AWS certificates and transmits data to AWS IoT.

photo7.jpg
SmartCooler/NodeMCU/cooler.lua on GitHub

Upgrading the Smart Water Cooler

To simplify the installation, we made an adapter board and integrated it into the water cooler, together with the additional power supply. We then connected the weight and temperature sensors.

Software Development for Monitoring

We configured Rule Action in AWS IoT, which stores the data received from the MCU in the DynamoDB database.

Serverless Lambda function serves as a monitoring software, which is being checked by AWS CloudWatch at a given time interval. Lambda checks the current entry in DynamoDB and decides what action to take.

photo10.jpg
SmartCooler/SupervisorLambda/index.js on GitHub

Lambda sends a message to the relevant AWS SNS (Simple Notification Service) thread, and then Lambda-functions receives it — that is how notifications are sent. To deliver messages to the messenger, one of the Lambda functions uses Slack Webhooks, and another works with Twilio service for sending SMS.

photo11.jpg

UI Development

We developed web UI on AngularJS and hosted it on AWS S3.

Backend for UI was implemented in the form of AWS Lambda called through the AWS API Gateway using the usual REST queries. Thus, the entire software works in a Managed Cloud Environment with no additional administration or need to lease a server/VPC. AWS Free Tier is enough to store all the needed data, and we pay nothing for that.

photo12.jpg

Tech Stack

  • NodeMCU and programming language Lua;
  • Twilio service;
  • AWS IoT;
  • AWS DynamoDB;
  • AWS Lambda;
  • AWS SNS;
  • AWS CloudWatch;
  • AWS API Gateway.

It took about a month of part-time work to develop the project. In addition to the fun we got from learning new technologies, the project helped simplify the office manager’s routine and saved the office from the probable drought.

photo12.jpg

photo14.jpg

We have several SmartOffice projects on our minds to develop: automation of the office alarm system, automated light control, and automated heating and air conditioning. So stay tuned!

photo15.jpg
Smart Water Cooler Developers team