Home> Blog> IoT Helps Optimize Water Usage: IoT Environmental Monitoring

IoT Helps Optimize Water Usage: IoT Environmental Monitoring

IoT environmental monitoring
PCBONLINE Team Mon, Nov 11, 2024
82
IoT environmental monitoring PCBA

IoT environmental monitoring camera

The Internet of Things (IoT) helps us measure and improve things by collecting, monitoring, and optimizing data. IoT has been vital in monitoring and finding solutions for environmental challenges.

In this blog, we will discuss environmental monitoring with IoT using an example of IoT monitoring water usage. We will specifically discuss how IoT can help us conserve water, one of our planet's most valuable resources for life.

Example of water level monitoring & optimizing with IoT

To give you a basic idea of how IoT helps optimize environmental factors, we will set up a prototype project that monitors the water level as an example. The applications of monitoring water usage can be used in reservoirs involving people living and public safety, cooling towers for circulating cooling water in many factories, etc.

In this IoT environmental monitoring example project, we will monitor the water level in a tank.

Basic Setup

To do so, we need an ultrasonic sensor. It sends out sound waves, and when the waves hit an object, they are reflected to the sensor. The sensor then measures the time taken for the waves to return.

In addition to the ultrasonic sensor, we need a microcontroller, which can read the raw data of the duration and convert that to distance. Then it sends the data to some application interface so that we can see the real-time water level.

The ultrasonic sensor can be placed on top of the tank, and we will measure the length of the tank. For example, if the length of the tank is 400cm and the ultrasonic sensor gives us the value of 400cm, that means that there is no water. If the ultrasonic sensor gives us a value of 100cm, that means the water level is 300cm.

Schematic

Based on the above setup, we can draw a schematic, we can use an ESP32 microcontroller with built-in WiFi that is ideal for IoT projects. The schematic is given as follows.

IoT environmental monitoring example schematic

Code

To program our ESP32 microcontroller, we will use Arduino IDE or you can use the wokwi simulator for simulation of the code. We will upload the following code.

#define TRIG_PIN 18 // ESP32 pin connected to Ultrasonic Sensor's TRIG pin
#define ECHO_PIN 5  // ESP32 pin connected to the Ultrasonic Sensor's ECHO pin
const float SOUND_SPEED = 0.0343 / 2; // Speed of sound in cm/µs (divided by 2 for round-trip)
const int WATER_LEVEL_THRESHOLD = 30; // Threshold distance in cm to indicate low water level
const int Tank_size = 400;

float duration_us, distance_cm;

void setup() {
  Serial.begin(9600); // Initialize serial communication

  pinMode(TRIG_PIN, OUTPUT); // Set TRIG pin as output
  pinMode(ECHO_PIN, INPUT);  // Set ECHO pin as input
}

void loop() {
  // Trigger the ultrasonic pulse
  digitalWrite(TRIG_PIN, HIGH);
  delayMicroseconds(10);
  digitalWrite(TRIG_PIN, LOW);

  // Measure duration of pulse from ECHO pin
  duration_us = pulseIn(ECHO_PIN, HIGH);

  // Calculate distance in cm
  distance_cm = duration_us * SOUND_SPEED;

  // Light up LED if distance is under the threshold
  if (distance_cm < WATER_LEVEL_THRESHOLD) {
    digitalWrite(LED, HIGH); // Turn on LED if water is below threshold
  } else {
    digitalWrite(LED, LOW); // Turn off LED otherwise
  }

  // Print the distance to Serial Monitor
  Serial.print("Water Level: ");
  int water_level = Tank_size - distance_cm;
  Serial.print(water_level);
  Serial.println(" cm");

  delay(500); // Delay before next reading
}

Results

The above code calculates the distance using sound waves. It then converts the time taken by the sound waves into distance, using the speed of sound and a distance formula. By comparing this distance to the length of the water tank, it can determine the water level in the tank. If you simulate the project using wokwi, you will see the following results on the serial monitor based on the ultrasonic values.

water level IoT monitoring results

Fig: Water level in centimeters

That shows the water level is 253cm. Also, for the sake of simplicity, we have shown the data in the serial monitor. But in real scenarios, the deployed sensors are mostly at remote places, and in this case, we can use the IoT protocols to send and receive data.

Optimization of the IoT environmental monitoring example project

To optimize the water usage monitoring project, users can record the level of their water tanks over some time. Once enough data is generated, they can use the AI algorithms to find the patterns in the changes in water levels. Based on these patterns, strategies can be developed to optimize water usage.

While this example demonstrates IoT's potential on a smaller scale, similar technologies are being used in broader contexts, such as agriculture, water quality monitoring, and leak detection. Let's explore some of these applications in detail.

There are a number of different sensors which could help us measure critical parameters. Using this data-driven approach and AI-based algorithm we can draw correlations. It will not only enhance our learning but also help to predict future trends and potential risks.

Applications of IoT Environmental Monitoring

Let's explore how IoT can help in monitoring environmental factors, such as conserving water resources.

Smart meters and leak detection

Environmental monitoring IoT can be used for smart meters and in detecting leaks.

Smart meters are IoT-enabled devices that record real-time water consumption. The tracking of the water allows the homeowners, farmers, and city administrators to find the patterns in their usage, helping them detect waste, and manage water usage effectively.

An IoT water meter can manage hundreds of single water meters, which saves a lot of resources. The water management department no longer needs to read water meters manually, as all the things are done on the cloud, and all water bills can be paid via mobile phones.

water usage and leakage detection

Smart irrigation system

Smart irrigation systems are IoT solutions that use various sensors, like soil moisture and temperature sensors, to monitor weather data and crop needs. This data helps determine the ideal amount of water required, ensuring water is only used when needed, rather than relying on traditional guesswork.

smart irrigation

The IoT PCBA manufacturer PCBONLINE used to make such a PCBA project for smart plant irrigation. Below, the PCBA that will be inserted into the soil near the plant root is applied with conformal coating.

smart irrigation PCBA

Water quality monitoring in natural bodies

IoT can help monitor water quality by measuring various parameters using sensors such as pH value, temperature, dissolved oxygen levels, and pollutant levels. This monitoring can help us get real-time data and allow the environmental authorities to quickly detect and reverse contamination or harmful changes.

water quality

Flood and Drought monitoring

IoT systems can help us monitor floods which are crucial for evacuation and prevention of property damage and economic losses. IoT systems used for such scenarios use sensors to measure the water levels in the river, rainfall amounts, and soil saturation. The real-time analytics allows us to predict such events in advance.

Similarly, IoT systems using climate data, soil moisture level agriculture water usage, and groundwater level can help us predict droughts in advance which can allow the authorities to make policies and implement water conservation plans.

flood and drought

Wastewater treatment

IoT helps us manage and test the quality of the treated water. Since the water we have on this planet is limited, the water has to be treated to fulfill the needs for consumption.

treated water

IoT systems using sensors help us collect the data of treated water which allows us to test the quality of the water and to find the risks involved.

IoT PCBA Manufacturer PCBONLINE

If you need electronics manufacturing services for your environmental IoT monitoring project, you can work with the one-stop IoT PCBA (printed circuit board assembly) manufacturer PCBONLINE.

IoT PCBA manufacturer PCBONLINE

PCBONLINE focus on PCBA manufacturing and box-build assembly for IoT devices, including the IoT environmental monitoring devices. It has two large advanced PCB manufacturing bases, one PCB assembly factory, stable supply chains, and an R&D team.

Advantages of PCBONLINE in IoT PCBA manufacturing

PCBONLINE can do the R&D for your IoT environmental monitoring project, or take part in your project development from the early stage.

PCBONLINE offer free prototype/sample, PCBA functional testing, and design for manufacturing (DFM) to ensure the smooth and successful IoT PCBA massive production.

One-stop IoT PCBA manufacturing services for IoT environmental monitoring from ideas to end devices, including R&D, prototypes, PCB fabrication, component sourcing, PCB assembly, PCBA value-added, enclosures, and final device box-build assembly.

High-quality IoT PCBA manufacturing certified with ISO 9001:2015, ISO 14001:2015, IATF 16949:2016, RoHS, REACH, UL, and IPC-A-610 Class 2/3.

PCBONLINE has rich experience in reflow/wave soldering oven temperature control and jig design to ensure successful IoT manufacturing. Besides, it has long-term cooperation with the top 3 mold and enclosure manufacturers in China.

No matter what quantity of IoT PCBA you want, PCBONLINE offers one-on-one engineering support until delivery. To get a quote for your IoT environmental monitoring project, please contact info@pcbonline.com.

Conclusion

IoT excels at connecting systems to address environmental challenges effectively. The IoT not only monitors environmental factors such as water usage and works automatically, but also provides data analytics on behavioral patterns that identify the opportunities for optimization. To put your IoT environmental monitoring project into fabrication, chat with the one-stop IoT PCBA manufacturer PCBONLINE from the online chat window.

© This article is an original work of the PCBONLINE team. Please indicate the author PCBONLINE if you reprint. If the article is reproduced without permission or indicating the author's source, PCBONLINE reserves the right to investigate the infringement.

View and save our product information
PCB assembly at PCBONLINE.pdf

GET A FREE QUOTE

File Upload