Project tutorial
Alexa Enabled, Arduino Powered Hot Water Monitor

Alexa Enabled, Arduino Powered Hot Water Monitor © GPL3+

Do you ever run out of hot water in the shower? Make this Arduino-powered monitoring device, and then ask Alexa, "How long can I shower?"

  • 13 respects

Components and supplies

D1 mini
Everything ESP Wemos D1 Mini
WeMos D1 Mini Protoboard Shield
Can substitute any protoboard cut down to size.
uxcell G3/4" Hall Effect Liquid Water Flow Sensor Switch Flowmeter Fluid Meter 2-45L/min
This particular flow meter has the right fittings for easily adding to most hot water heaters.
Flexible Copper Water Heater Connector 3/4 FIP
Longer hoses are easier to fit into place. These will be in stock at your local hardware store. Make sure to get the connectors with rubber washers in the ends.
31820 block diagram fxiuw00ovq
Maxim Integrated MAX31820 1-Wire Ambient Temperature Sensor
3 pin JST SM Male Female plug
This connector matches the plug on the flow meter, and an additional one is used to connect the temperature sensors.
Amazon echo dot
Amazon Alexa Echo Dot
Or any other Alexa device or mobile app.
1260 00
Adafruit Flora RGB Neopixel LEDs- Pack of 4
Note: You only need 1 pixel of any type. I used one LED cut off an LED strip that I had left over from another project. This LED is used as a status light, and can be replaced by a simper LED or left off alltogether if needed.
08377 02 l
Resistor 330 ohm
Used for the signal connection on the Neopixel LED.
Mfr 25fbf52 4k75 sml
Resistor 4.75k ohm
Used to tie the data pin on the temperature sensors high.
Mfr 25frf52 100r sml
Resistor 100 ohm
Used to connect the data pin of the flow meter to ground.

Necessary tools and machines

09507 01
Soldering iron (generic)
3D Printer (generic)
This is optional but adds a nice finished look.
Crescent Wrench
You may need two.

Apps and online services

About this project

My oldest daughter is nearly a teenager, and I've learned that the length of hot showers frequently expands to the capacity of our hot water heater.

Hopping into the shower, only to discover that the hot water is nearly gone is a chilling experience. I designed and built the Hot Water Monitor to measure hot water flow and the water temperatures necessary to approximate the heated state of my hot water heater.

Now I have an Alexa Skill, and I can ask "How long can I shower?"

Getting Started

This project has many components and things that must be configured properly. The code auto configures itself whenever possible, but that isn’t always possible. The code is currently set up to work with an electric hot water heater, and report values in gallons. Adjustments can be made to accomodate gas heaters as well as report values in metric units.


I highly recommend building this on a breadboard first for testing, and then wiring it up on a protoboard. If you don’t have one for the Wemos D1 Mini, you can easily use any generic protoboard cut down to the right size.

Most of the connections are Ground and Vcc (3.3v) connections. Each of the three components have a resistor as well.

Flow Meter

The flow meter comes with a female JST connector. I found the easiest way to test this on a breadboard was by soldering some header pins to a male JST connector for easy connection to the breadboard. The 100 ohm resistor is used to pull the data pin to ground.

The specs indicate that the flow meter expects 5 volts, but it works reliably at 3.3 volts. You can (carefully) run water through the sensor from a faucet to test, but blowing through it works fine for generating test data.

Temperature Sensors

We use two identical temperature sensors to measure the temperature of the inbound and outbound water temperatures on your hot water heater. You’ll need to measure the sensor placements in advance to know how long to make the wires.

These MAX31820 sensors are 1-Wire sensors, and are connected to the same pins on the Arduino.

A 4.74 kohm resistor ties the temperature sensor data pin high. 1-Wire devices can use power from the data pin, but I supplied power to the power pins anyway.

Neopixel Status Light

The Neopixel status light will help indicate problems with the wifi connection. You’ll see it change color when it connects, and if it fails to report values, it’ll change colors to help you know that is happening as well.

Any Neopixel will work here. I used one pixel from a strip leftover from a previous project, but you can use any other form factor and it’ll work fine.

Do remember to use a 330 ohm resistor on the data pin. The connection was short enough that I just used the resistor as the data wire!

If you don’t want to spend for a neopixel, you can leave it off or modify the code and replace it with a simple LED.

Installing the Flow Meter

Installing the flow meter will require adjusting your water input pipes, but doesn’t require general plumbing skills. We’ll be installing the sensor on the water input pipe. This pipe will generally be colder when hot water is running. Don’t leave the flow meter connected to your microcontroller when you do this. There is a risk of water splashing out onto your board and causing issues.

Before you loosen the existing pipe connections, make sure to turn off the hot water heater and TURN OFF THE WATER SUPPLY. You can shut off the whole house, or just turn off the water input to the hot water if you have a valve there. Even with the water turned off, you’ll have some water come out of the connection. Depending on your plumbing setup, this may be a few gallons or more. Have a few towels on hand and a small bucket or plastic tub to catch the water. When you loosen the connection, don’t undo it all the way until water has stopped draining out. I ‘paused’ it several times by tightening the connection, and then emptying my plastic tray. Some of this water may be hot, if water is being pushed backwards through the hot water heater during draining. If the water is too hot, give it a few hours for the water to cool down before continuing.

Unscrew the one end, then screw the meter in on the end of the old pipe. Make sure you get the flow direction correct for the flow meter. There is an arrow on the outside indicating proper flow direction. Screw your new section of flexible pipe on the end of the sensor, then back onto the pipe you disconnected it from earlier. You’ll need to use your wrenches to tighten the connection, but don’t over tighten them. The rubber gaskets in the end of each pipe will compress to form a watertight seal.

You’ll need to bend the flexible copper pipes to get them into position. Go slowly, and be careful not to crease the pipe. If you do crease the pipe by bending it too tightly, you’ll need to replace that pipe or risk a water leak. You may want to make sure you do this installation during hours when a hardware store is open, in case you need another pipe.

When you have all the connections made, slowly turn the water back on. You’ll hear some water flowing to replace the water that drained out, but no water should be leaking from any of your connections. If there is any water leaking at all, turn the water back off and tighten the connection.

Setting up AWS Lambda

For both Lambda and the API Gateway, you’ll need an AWS developer account. You can get started for free, and limited use falls within a free tier. Get your account and login to the AWS console at (

We’ll need two lambda functions: HotWater_Update for receiving new data from the device, and HotWater_Alexa for answering Alexa requests. The code for both of these functions is in the code repository. Each folder in the awslambda code directory contains a file with the source code, and a zip file. It is best to upload the Zip file, as dependencies are packaged up with the source. After uploading, you’ll be able to view and edit the source using an online editor.

  • Sign into the AWS Console
  • Navigate to AWS Lambda

Do the following twice, once for HotWater_Update and HotWater_Alexa:

  • Click Create Function Button
  • Select Author from Scratch
  • Name the function: HotWater_Update
  • Python 3.6
  • Create Custom Role
  • IAM Role: Create a new IAM Role
  • Role name: HotWater_Update
  • Now Choose HotWater_Update under Existing Role
  • Your new function will now display.
  • Under Code Entry Type, select ‘Upload a .ZIP file’, and select the appropriate zip file for the function from the code repository.
  • Hit the Save button (upper right)
  • Now, you can see and update the code. HotWater_Alexa has several configuration variables that you may need to update. Edit them and then hit the Save button again.

In the HotWater_Alexa function, copy and paste the ARN of the function. You’ll find it at the top right of the page, and it looks like arn:aws:lambda:us-east-1:000000000:function:HotWater_Alexa. You’ll need this when you configure the Alexa Skill later on.

  • Now your functions are uploaded but we need to add some permissions first. Navigate to the Identity and Access Management (IAM) section of the AWS console.
  • First, click Policies in the left menu.
  • Click Create Policy, then on the JSON tab.
  • Copy and paste the contents of the CloudWatchMetricAccessIAMPolicy.json file.
  • Click Review Policy, and name it “CloudWatch_Full_Metric_Access
  • Click Create Policy.

Next, we need to give our new roles access to this policy.

  • Click on Roles in the left menu, and you should see your HotWater_Update and HotWater_Alexa roles in the list.
  • Click on each, then on Attach Policy.
  • Change the filter to Customer Managed, and you should see your CloudWatch_Full_Metric_Access policy.
  • Click the checkbox, and click Attach Policy.

API Gateway

We will use the AWS API Gateway to allow our microcontroller to send data updates over HTTPS.

  • Navigate to API Gateway in the AWS Console.
  • Click Create API, then Import from Swagger
  • Copy and paste the contents of HotWaterAPI-swagger.yaml into the textbox, and click Import.
  • Click POST under /HotWater_Update.
  • Integration Type: Lambda Function
  • Check the Use Lambda Proxy Integration checkbox
  • Select us-east-1 or whatever region you created your Lambda functions in.
  • For Lambda Function, type HotWater_Update. This should auto-complete.
  • Click Save, then Ok, when asked to confirm adding a permission to the lambda function.
  • From the Actions menu, select Deploy API.
  • Deployment stage: [New Stage]
  • Stage Name: prod
  • Click Deploy
  • Copy the Invoke URL, and save it for later. You’ll need to update the Arduino code with this URL.

We’ll create a special API key for use in calling this API. This prevents anybody else from calling this API method.

  • Click API Keys on the left menu.
  • Click Actions, then Create API Key.
  • Name: HotWater
  • Click Save
  • Select API > HotWaterAPI
  • Select Stage > prod
  • Click Add.
  • Click Show after API key, and copy and save the API Key for later. You’ll need to update the Arduino Code with this value.

3D Printing

Included with the project files are a 3D printed case for the electronics, and some clips to hold the temperature sensors to the input and output pipes. These are not necessary for the correct functioning of the project, but do make it look nice. During testing, you can just secure the temperature sensors to the pipes with blue painters tape, and even tape the electronics to the wall. If you use a board different than the WeMos D1 Mini, you’ll need to modify the case to make it fit.

You can use any filament, though translucent filaments will best show the status light. I used a blue translucent filament, because that's the only translucent option I had at the public library where I printed the case and clips.

Arduino code

You’ll need the Arduino IDE (

You’ll also need to install additional board configurations. You can get these by Opening File > Preferences, and adding this to the Additional Boards Manager URLs:

Open the hotwater-arduino.ino, and update the following information

  • Update apigateway destination
  • Update apigateway accesstoken
  • Update wifi ssid and password
  • Update wattage and efficiency

Plug in the WeMos D1 Mini, select the proper port, and upload.

Alexa Skill

You’ll need to create a new Alexa Skill in the Amazon Developer Console ( Note that this is different from the AWS Console.

  • Hit Create Skill
  • Name it HotWater, and hit next.
  • Select Custom model, and hit create skill button.
  • Under Interaction Model on the left, choose JSON Editor. Drag the AlexaSkillInteractionModel.json file onto the box, or copy and replace the displayed JSON with the contents of the file.
  • Hit Save Model, then Build Model. The building will take a few minutes.
  • Select Endpoint from the left menu, and choose AWS Lambda ARN.
  • Copy and Paste the ARN from the HotWater_Alexa Lambda Function that you built earlier.

Use it!

At this point, you should be ready to go! Use your Echo device or mobile app, and try out the commands that are available.

The skill is called Hot Water, so begin by saying “Alexa, open Hot Water”

Then you can try any of the included phrases:

  • How long can I shower.
  • How much water is left.
  • How much did we use today/yesterday/this week/last week/etc.
  • How much did we use in the last 3 days/17 minutes/3 hours/etc.

For just a quick question, you can just give it a single phrase, like this:

“Alexa, ask Hot Water How long I can shower” This will give you an answer immediately, and then exit the skill.

This project uses AWS CloudWatch to store data for its use. For extra fun, you can log into the AWS console and see the graphs it uses in the CloudWatch console.


Hot Water Monitor Arduino Code
This code runs on the WeMos D1 Mini Arduino microcontroller. Be sure to update the configuration values in code for the API Gateway, Wifi Connection, and your hot water heater parameters.
Hot Water Monitor AWS Lambda Functions
The monitor uses two AWS lambda functions: One for receiving data from the microcontroller, and another for serving Alexa Requests. Be sure to update configuration values within the code. There are also IAM permissions and API Gateway Configuration that will need to be setup. See Project Instructions for additional details.


Fritzing Wiring Diagram
This will detail the required connections. See written Project Instructions for additional details.


Similar projects you might like

Wise Shower Driven by Alexa Skill

Project in progress by Virgilio Enrique Aray Arteaga

  • 3 respects

DIY Air Humidifier with Backlight Controlled by Alexa

Project tutorial by Andrii Romanenko

  • 6 respects

Alexa BBQ/Kitchen Thermometer with IoT Arduino and e-Paper

Project tutorial by Roger Theriault

  • 9 respects

Hygge Home - Alexa Smart Bath

Project tutorial by J Howard

  • 18 respects

Alexa Enabled USB Power Switch

Project tutorial by Stephen Harrison

  • 29 respects

Dooreo - The Alexa Powered Automatic Door Opener

Project tutorial by Keith Caskey

  • 13 respects
Add projectSign up / Login