STEP 1 / 6ESP + IOT

IoT Water Flow Meter using ESP8266 & Water Flow Sensor

In this project, we'll learn how to use ESP8266 and a water flow sensor to make an IoT-based water flow meter. We will connect the NodeMCU ESP8266 Board to the YFS201 Hall Effect Water Fl…

IoT Water Flow Meter using ESP8266 & Water Flow Sensor - source illustration from page 1190
PROJECT#459
TRACKIoT
PARTS04
STAGES06
STEP 1 / 6 · Overview

Know the mission before touching a wire.

Understand what you are making, prepare the right tools, and make the workbench safe.

01

Project details

IoT Water Flow Meter using ESP8266 & Water Flow Sensor is a iot project. In this project, we'll learn how to use ESP8266 and a water flow sensor to make an IoT-based water flow meter. We will connect the NodeMCU ESP8266 Board to the YFS201 Hall Effect Water Fl…

Source pages
1190-1196
Named parts
4
Build goal
Working, tested prototype
02

Tools you need

  • Digital multimeter
  • Wire stripper and side cutters
  • Soldering iron with a fine tip
  • Current-limited bench supply
  • Computer with a data-capable USB cable

Use eye protection, good lighting, and a clean insulated surface throughout the build.

03

Safety precautions

  • Disconnect every power source before changing a connection.
  • Check component polarity, pinout, and supply voltage twice.
  • Use a current limit for the first power-up.
  • Keep liquids, loose metal, and uninsulated wires away from the bench.
Ready to continue?
STEP 2 / 6 · Parts library

Gather, identify, and understand every part.

Use the standardized inventory, then open What's this? to learn each part's role, advantages, limitations, handling, and specifications.

NAMED PROJECT INVENTORY4 PART LINES
PARTTYPEQTYREADY
MNodeMCU ESP8266MODULE1
What's this?Image, role, pros, cons, handling & specifications
NodeMCU ESP8266 development boardMODULE LEARNING VIEW

NodeMCU ESP8266

A programmable controller that reads inputs, makes decisions, and drives the project's outputs.

What it does here

It is the control centre and must use the documented board, pin map, supply, and logic level.

Buy / compare this part

Advantages

  • Reprogrammable and reusable
  • Large learning ecosystem
  • Complex behaviour remains changeable

Limitations

  • GPIO voltage and current are limited
  • Some pins affect boot or communication
  • Loads normally need a driver

Handling

  • Disconnect power before rewiring
  • Avoid static discharge
  • Never power motors, relays, or pumps directly from GPIO

Specifications to verify

  • Use the exact model, value, package, and rating listed for NodeMCU ESP8266; similar-looking parts are not always interchangeable.
  • Confirm operating voltage, logic level, pinout, memory, USB interface, and maximum GPIO current.
MWater Flow Sensor (YF-S201 Hall-Effect Water Flow Sensor)MODULE1
What's this?Image, role, pros, cons, handling & specifications
IoT Water Flow Meter using ESP8266 & Water Flow Sensor - source illustration from page 1190MODULE LEARNING VIEW

Water Flow Sensor (YF-S201 Hall-Effect Water Flow Sensor)

A sensor converts a physical condition into an electrical signal the circuit can measure.

What it does here

It provides project input as an analogue, digital, resistive, frequency, or calibrated signal.

Buy / compare this part

Advantages

  • Adds real-world awareness
  • Can usually be tested independently
  • Often supports calibration

Limitations

  • Readings can drift
  • Placement affects results
  • Some sensors need warm-up or calibration

Handling

  • Protect the sensing surface
  • Observe supply voltage and polarity
  • Keep signal leads away from noisy power wiring

Specifications to verify

  • Use the exact model, value, package, and rating listed for Water Flow Sensor (YF-S201 Hall-Effect Water Flow Sensor); similar-looking parts are not always interchangeable.
  • Confirm supply range, output type, measurement range, accuracy, response time, and pin order.
MOLED DisplayMODULE1
What's this?Image, role, pros, cons, handling & specifications
IoT Water Flow Meter using ESP8266 & Water Flow Sensor - source illustration from page 1190MODULE LEARNING VIEW

OLED Display

An output component turns an electrical control signal into light, sound, motion, switching, or displayed information.

What it does here

It presents the circuit result or acts on the physical world.

Buy / compare this part

Advantages

  • Makes system state visible
  • Can be tested separately
  • Supports clear troubleshooting

Limitations

  • Loads may exceed controller current
  • Polarity or driver direction can matter
  • Inductive loads create voltage spikes

Handling

  • Use the documented driver stage
  • Check polarity and load current
  • Add flyback protection for inductive loads

Specifications to verify

  • Use the exact model, value, package, and rating listed for OLED Display; similar-looking parts are not always interchangeable.
  • Confirm voltage, current, polarity, interface, driver requirements, and duty cycle.
BConnecting Wires Jumper WiresBUILD1
What's this?Image, role, pros, cons, handling & specifications
IoT Water Flow Meter using ESP8266 & Water Flow Sensor - source illustration from page 1190BUILD LEARNING VIEW

Connecting Wires Jumper Wires

A named project component whose exact role is defined by the source circuit and build guide.

What it does here

It performs a documented electrical, control, interface, or construction function in this project.

Buy / compare this part

Advantages

  • Selected for this project
  • Can be checked independently
  • Supports modular troubleshooting

Limitations

  • Substitutes may differ
  • Generic names can hide variants
  • Pinouts and ratings vary

Handling

  • Compare the received part with the source
  • Keep it labelled
  • Do not force connectors or adjusters

Specifications to verify

  • Use the exact model, value, package, and rating listed for Connecting Wires Jumper Wires; similar-looking parts are not always interchangeable.
  • Confirm dimensions, ratings, connection method, polarity, and environmental limits.
Ready to continue?
STEP 4 / 6 · Source code

Confirm the hardware-only control path.

This project does not include firmware in the source. The circuit itself provides the required behaviour.

01

How to connect

  1. Match every controller label to the circuit view and source pin map.
  2. Join grounds before signal wires when separate low-voltage supplies are used.
  3. Keep motors, relays, pumps, and other loads on a suitable driver and external supply.

Common mistakes

Reversed VCC/GND, board-label versus GPIO-number confusion, missing common ground, and charge-only USB cables.

Troubleshoot

Disconnect loads, continuity-test one path at a time, then test with a current limit.

02

Software preparation

No IDE, board package, library, or firmware upload is required for this project.

If you add a programmable controller as an extension, document its pin map separately.

03

How to upload code

The original design is implemented entirely in hardware, so proceed after verifying the circuit and supply.

Ready to continue?
STEP 5 / 6 · Build

Assemble, deploy, test, and troubleshoot.

Use the complete source notes in build order, then pass the final checks before calling the project finished.

ASSEMBLY

Build in functional stages

  • Power and regulation
  • Controller or processing stage
  • Inputs and sensors
  • Outputs and loads
  • Enclosure and strain relief
TEST

Power up safely

  • Inspect unpowered continuity first
  • Apply the lowest safe current limit
  • Measure supply rails before signals
  • Add one load at a time
  • Record expected and actual results
TROUBLESHOOT

Work from simple to complex

  • Confirm power, ground, polarity, and orientation
  • Compare each pin with the source
  • Test inputs separately from outputs
  • Replace only one variable at a time
  • Power off before every correction
PROJECT-SPECIFIC BUILD NOTES

Follow the documented instructions.

These notes come from this project's source and remain in their original order.

01

Project overview

Project build note

In this project, we'll learn how to use ESP8266 and a water flow sensor to make an IoT-based water flow meter. We will connect the NodeMCU ESP8266 Board to the YFS201 Hall Effect Water Flow Sensor. On a 0.96′′ OLED Display, we will show the water flow rate and the total volume. After that, we'll connect the hardware to IoT Server. Thingspeak App will be used for the IoT Server. The water flow rate and volume data can be uploaded to Thingspeak Server and viewed or monitored from anywhere in the world. A key part of City Management is the Water Management System. Managing water means giving out water only when it is really needed and not wasting any. So, it is very important to measure how fast and how much water flows. Almost nothing can be done about water without measuring these parameters. Also, it has become very important to be able to check the

water's volume, flow rate, and quality from anywhere with an Internet connection. So, there is a need for an online system for water management. There are a lot of Water Flow Sensors on the market, but they cost too much to use and buy. Because of this, you need a low-cost water flow meter. So, we'll use the YFS201 Hall Effect Water Flow Sensor with the ESP8266 to make a simple IoT-based water flow meter. Hall-Effect Water Flow Sensor YF-S201 The YF-S201 Hall-Effect Water Flow Sensor is shown in this picture. This sensor has both an inlet and an outlet, so it can be hooked up to the water line. A pinwheel inside the sensor measures how much liquid has passed through it. Here is a magnetic Hall effect sensor built in that sends out an electrical pulse every time the motor turns.

02

The sensor comes with three wires

Project build note

Red (5-24VDC power) (5-24VDC power) Black (ground) Yellow (Hall effect pulse output)

By counting the pulses that come out of the sensor, you can figure out how fast the water is moving. About 2.25 milliliters are in each pulse. This Sensor is the cheapest and best, but it's not the most accurate because the flow rate/volume changes a little depending on the flow rate, the pressure of the fluid, and the way the sensor is positioned. A lot of calibration needs to be done to get more than 10% accuracy. With this Sensor, you can make a simple IoT-based water flow meter. The pulse signal is a simple square wave, which makes it easy to record and convert to liters per minute using the following formula. Pulse rate (L/min) = pulse rate (Hz) divided by 7.5 IoT Water Flow Meter with ESP8266 and Water Flow Sensor: Now let's connect the YF-S201 Hall-Effect Water Flow Sensor to the Nodemcu ESP8266 and OLED Display. The OLED Display will show how fast water is flowing through the pipe and how much water has gone through it so far. After every 15 seconds, the same Flow Rate and Volume data can be sent to Thingspeak Server. If you want information right away, you can switch to the Blynk App. Using the MQTT Protocol is another way to improve wireless communication.

03

Part Required

Project build note

NodeMCU ESP8266 Water Flow Sensor (YF-S201 Hall-Effect Water Flow Sensor) OLED Display Connecting Wires Jumper Wires Breadboard Circuit Diagram.

Since the Water Flow Sensor is a digital sensor, its output pin can be connected to any digital pin on the ESP8266. In my case, I linked to GPIO2, which is also called D4. The sensor works with 5V and can be hooked up to the Vin port on the ESP8266. In the same way, the I2C OLED Display SDA and SCL pins are connected to D2 and D1 on the ESP8266. Since the OLED Display works at 3.3V, it can be connected to Nodemcu's 3.3V pin.

04

Setting up Thingspeak

Project build note

Now we need to set up the account for Thingspeak. Follow these steps to

05

set up Thingspeak

Project build note

Step 1: Go to https://thingspeak.com/ and fill out the information to make an account. Step 2: Make a new channel by clicking " Channel " and filling in the information shown in the figure. Step 3: Click on API Key. The "Write API Key" button will appear. Make a copy of the API Key. This is very important, and Code Part will need it.

Step 4: You can click on "Private View" and change the way the window looks to suit your needs. So, the Thingspeak Setup Part is over. Monitoring Water Flow Rate & Volume

Once the code is uploaded, the OLED display will start working and show the flow rate and volume. The flow rate will start out at 0 liters per minute (L/M). Also, the total volume will be shown as 0 liters (L). Once the motor is turned on and water starts to flow, you can see the Flow Rate (F) and Volume (V) on the OLED Display (V).

Water Flow Rate & Volume Data can now also be tracked on Thingspeak Server. You just need to go to the Thingspeak Dashboard's Private View.

Ready to continue?
PROJECT ACHIEVED

You built IoT Water Flow Meter using ESP8266 & Water Flow Sensor.

You followed the full workflow from understanding the mission to testing the finished project. That is a real engineering achievement - well done.

IoT Decibel meter with Sound Sensor & ESP8266 project thumbnail featuring ESP8266, NodeMCU, LCD display
NEXT IOT ADVENTURE

IoT Decibel meter with Sound Sensor & ESP8266

Ready to reuse what you learned in another project from the same track?

Start this project
Browse all 500 projects