Introduction: A Real-Time Well Water Level Meter
These instructions describe how to build a low-cost, real-time water level meter for use in dug wells. The water level meter is designed to hang inside a dug well, measure the water level once a day, and send the data by WiFi or cellular connection to a webpage for immediate viewing and downloading. The cost for the parts to build the meter is approximately Can$200 for the WiFi version and Can$300 for the cellular version. The meter is shown in Figure 1. A full report with building instructions, parts list, tips for constructing and operating the meter, and how to install the meter in a water well is provided in the attached file (Water Level Meter Instructions.pdf). The water level meters have been used to develop a regional, real-time shallow aquifer monitoring network in Nova Scotia, Canada: https://fletcher.novascotia.ca/DNRViewer/index.htm... Instructions for building a similar meter that measures water temperature, conductivity and water levels is available here: https://www.instructables.com/id/A-Real-Time-Well-...
The water level meter uses an ultrasonic sensor to measure the depth to water in the well. The sensor is attached to an Internet-of-Things (IoT) device that connects to a WiFi or cellular network and sends the water level data to a web service to be graphed. The web service used in this project is ThingSpeak.com, which is free to use for non-commercial small projects (fewer than 8,200 messages/day). In order for the WiFi version of the meter to work, it must be located close to a WiFi network. Domestic water wells often meet this condition because they are located close to a house with WiFi. The meter does not include a data logger, rather it sends the water level data to ThingSpeak where it is stored in the cloud. Therefore, if there is a data transmission problem (e.g. during an Internet outage) the water level data for that day are not transmitted and are permanently lost.
The meter was designed and tested for large diameter (0.9 m inside diameter) dug wells with shallow water depths (less than 10 m below ground surface). However, it could potentially be used for measuring water levels in other situations, such as environmental monitoring wells, drilled wells, and surface water bodies.
The meter design presented here was modified after a meter that was made for measuring water levels in a domestic water tank and reporting the water level via Twitter, published by Tim Ousley in 2015: https://www.instructables.com/id/Wi-Fi-Twitter-Wa.... The main differences between the original design and the design presented here are the ability to operate the meter on AA batteries instead of a wired power adaptor, the ability to view the data in a time-series graph instead of a Twitter message, and the use of an ultrasonic sensor that is specifically designed for measuring water levels.
Step-by-step instructions for constructing the water level meter are provided below. It is recommended that the builder read through all constructions steps before starting the meter construction process. The IoT device used in this project is a Particle Photon, and therefore in the following sections the terms “IoT device” and “Photon” are used interchangeably.
Sensor – MaxBotix MB7389 (5m range) https://www.maxbotix.com/Ultrasonic_Sensors/MB738...
IoT device - Particle Photon with headers https://store.particle.io/collections/wifi/produc...
Antenna (internal antenna installed inside the meter case) – 2.4 GHz, 6dBi, IPEX or u.FL connector, 170 mm long
Battery pack – 4 X AA
Wire – jumper wire with push on connectors (300 mm length)
Batteries – 4 X AA
Plumbing and Hardware Parts:
Pipe - ABS, 50 mm (2 inch) diameter, 125 mm long
Top cap, ABS, 50 mm (2 inch), threaded with gasket to make a watertight seal
Bottom cap, PVC, 50 mm (2 inch) with ¾ inch female NPT thread to fit sensor
2 Pipe couplers, ABS, 50 mm (2 inch) to connect top and bottom cap to ABS pipe
Eye bolt and 2 nuts, stainless steel (1/4 inch) to make hanger on the top cap
Other materials: electrical tape, Teflon tape, solder, silicone, glue for assembling case
Step 1: Assemble the Meter Case
Assemble the meter case as shown in Figures 1 and 2 above. The total length of the assembled meter, tip to tip including the sensor and eye bolt, is approximately 320 mm. The 50 mm diameter ABS pipe used to make the meter case should be cut to approximately 125 mm in length. This allows sufficient space inside the case to house the IoT device, battery pack, and a 170 mm-long internal antenna.
Seal all joints with either silicon or ABS glue to make the case watertight. This is very important, otherwise moisture can get inside the case and destroy the internal components. A small desiccant pack can be placed inside the case to absorb moisture.
Install an eye bolt in the top cap by drilling a hole and inserting the eye bolt and nut. A nut should be used on both the inside and the outside of the case to secure the eye bolt. Silicon the inside of the cap at the bolt hole to make it watertight.
Step 2: Attach Wires to Sensor
Three wires (see Figure 3a) must be soldered to the sensor in order to attach it to the Photon (i.e. sensor pins GND, V+, and Pin 2). Soldering the wires to the sensor can be challenging because the connection holes on the sensor are small and close together. It is very important that the wires are properly soldered to the sensor so there is a good, strong physical and electrical connection and no solder arcs between adjacent wires. Good lighting and a magnifying lens help with the soldering process. For those who do not have previous soldering experience, some practice soldering is recommended prior to soldering the wires to the sensor. An online tutorial on how to solder is available from SparkFun Electronics (https://learn.sparkfun.com/tutorials/how-to-solder...).
After the wires are soldered to the sensor, any excess bare wire that sticks out from the sensor can be trimmed off with wire cutters to approximately 2 mm length. It is recommended that the solder joints be covered with a thick bead of silicon. This gives the connections more strength and reduces the chance of corrosion and electrical problems at the sensor connections if moisture gets into the meter case. Electrical tape can also be wrapped around the three wires at the sensor connection to provide additional protection and strain relief, reducing the chance that the wires will break at the solder joints.
The sensor wires can have push-on-type connectors (see Figure 3b) at the one end to attach to the Photon. Using push-on connectors makes it easier to assemble and disassemble the meter. The sensor wires should be at least 270 mm long so they can extend the entire length of the meter case. This length will allow the Photon to be connected from the top end of the case with the sensor in place at the bottom end of the case. Note that this recommended wire length assumes that the ABS pipe used to make the meter case is cut to a length of 125 mm. Confirm in advance of cutting and soldering the wires to the sensor that a wire length of 270 mm is sufficient to extend beyond the top of the meter case so that the Photon can be connected after the case has been assembled and the sensor is permanently attached to the case.
The sensor can now be attached to the meter case. It should be screwed tightly into the bottom cap, using Teflon tape to ensure a watertight seal.
Step 3: Attach Sensor, Battery Pack, and Antenna to IoT Device
Attach the sensor, battery pack, and antenna to the Photon (Figure 4), and insert all parts into the meter case. A list of the pin connections indicated in Figure 4 is provided below. The sensor and battery pack wires can be attached by soldering directly to the Photon or with push-on-type connectors that attach to the header pins on the underside of the Photon (as seen in Figure 2). Using push-on connectors makes it easier to disassemble the meter or replace the Photon if it fails. The antenna connection on the Photon requires a u.FL type connector (Figure 4) and needs to be very firmly pushed onto the Photon to make the connection. Do not install the batteries into the battery pack until the meter is ready to be tested or installed in a well. There is no on/off switch included in this design, so the meter is turned on and off by installing and removing the batteries.
List of pin connections on the IoT device (Particle Photon):
Photon pin D3 - connect to - Sensor pin 2, data (brown wire)
Photon pin D2 - connect to - Sensor pin 6, V+ (red wire)
Photon pin GND - connect to - Sensor pin 7, GND (black wire)
Photon pin VIN - connect to - Battery pack, V+ (red wire)
Photon pin GND - connect to - Battery pack, GND (black wire)
Photon u.FL pin - connect to - Antenna
Step 4: Software Setup
Five main steps are needed to set up the software for the meter:
1. Create a Particle account that will provide an online interface with the Photon. To do this, download the Particle mobile app to a smartphone: https://docs.particle.io/quickstart/photon/. After installing the app, create a Particle account and follow the online instructions to add the Photon to the account. Note that any additional Photons can be added to the same account without the need to download the Particle app and create an account again.
2. Create a ThingSpeak account https://thingspeak.com/login and set up a new channel to display the water level data. An example of a ThingSpeak webpage for a water meter is shown in Figure 5, which can also be viewed here: https://thingspeak.com/channels/316660. Instructions for setting up a ThingSpeak channel are provided at https://docs.particle.io/tutorials/device-cloud/w... Note that additional channels for other Photons can be added to the same account without the need to create another ThingSpeak account.
3. A “webhook” is required in order to pass water level data from the Photon to the ThingSpeak channel. Instructions for setting up a webhook are provided at https://docs.particle.io/tutorials/device-cloud/w.... If more than one water meter is being built, a new webhook with a unique name must be created for each additional Photon.
4. The webhook that was created in the above step must be inserted into the code that operates the Photon. The code for the WiFi version of the water level meter is provided in the attached file (Code1_WiFi.txt). On a computer, go to the Particle webpage https://login.particle.io/login?redirect=https://... login to the Particle account, and navigate to the Particle app interface. Copy the code and use it to create a new app in the Particle app interface. Insert the name of the webhook created above into line 87 of the code. To do this, delete the text inside the quotes and insert the new webhook name inside the quotes in line 87, which reads as follows:
Particle.publish("Insert_Webhook_Name_Inside_These_Quotes", String(GWelevation, 2), PRIVATE);
5. The code can now be verified, saved, and installed onto the Photon. Note that the code is stored in and installed onto the Photon from the cloud. This code will be used to operate the water meter when it is in the water well. During the field installation, some changes will need to be made to the code to set the reporting frequency to once a day and add information about the water well (this is described in the attached file Water Level Meter Instructions.pdf in the section entitled “Installing the Meter in a Water Well”).
Step 5: Test the Meter
The meter construction and software setup are now complete. At this point it is recommended that the meter be tested. Two tests should be completed. The first test is used to confirm that the meter can measure water levels correctly and send the data to ThingSpeak. The second test is used to confirm that the power consumption of the Photon is within the expected range. This second test is useful because the batteries will fail sooner than expected if the Photon is using too much power.
For testing purposes, the code is set to measure and report water levels every two minutes. This is a practical time period to wait between measurements while the meter is being tested. If a different measurement frequency is desired, change the variable called MeasureTime in line 16 of the code to the desired measurement frequency. The measurement frequency is entered in seconds (i.e. 120 seconds equals two minutes).
The first test can be done in the office by hanging the meter above the floor, turning it on, and checking that the ThingSpeak channel accurately reports the distance between the sensor and the floor. In this testing scenario the ultrasonic pulse reflects off the floor, which is used to simulate the water surface in the well.
For the second test, the electrical current between the battery pack and the Photon should be measured to confirm that it matches the specifications in the Photon datasheet: https://docs.particle.io/datasheets/wi-fi/photon-d... Experience has shown that this test helps identify defective IoT devices before they are deployed in the field. Measure the current by placing a current meter between the positive V+ wire (red wire) on the battery pack and the VIN pin on the Photon. The current should be measured in both operating mode and deep sleep mode. To do this, turn the Photon on and it will start up in operating mode (as indicated by the LED on the Photon turning a cyan colour), which runs for approximately 20 seconds. Use the current meter to observe the operating current during this time. The Photon will then automatically go into deep sleep mode for two minutes (as indicated by the LED on the Photon turning off). Use the current meter to observe the deep sleep current at this time. The operating current should be between 80 and 100 mA, and the deep sleep current should be between 80 and 100 µA. If the current is higher than these values, the Photon should be replaced.
The meter is now ready to be installed in a water well (Figure 6). Instructions on how to install the meter in a water well is provided in the attached file (Water Level Meter Instructions.pdf).
Step 6: How to Make a Cellular Version of the Meter
A cellular version of the water meter can be built by making modifications to the previously described parts list, instructions and code. The cellular version does not require WiFi because it connects to the Internet via a cellular signal. The cost of the parts to build the cellular version of the meter is approximately Can$300 (excluding taxes and shipping), plus approximately Can$4 per month for the cellular data plan that comes with the cellular IoT device.
The cellular meter uses the same parts and construction steps listed above with the following modifications:
• Substitute the WiFi IoT device (Particle Photon) for a cellular IoT device (Particle Electron): https://store.particle.io/collections/cellular/pr.... When constructing the meter, use the same pin connections described above for the WiFi version of the meter in Step 3.
• The cellular IoT device uses more power than the WiFi version, and therefore two battery sources are recommended: a 3.7V Li-Po battery, which comes with the IoT device, and a battery pack with 4 AA batteries. The 3.7V LiPo battery attaches directly to the IoT device with the connectors provided. The AA battery pack is attached to the IoT device the same way as described above for the WiFi version of the meter in Step 3. Field testing has shown that the cellular version of the meter will operate for approximately 9 months using the battery setup described above. An alternative to using both the AA battery pack and 2000 mAh 3.7 V Li-Po battery is to use one 3.7V Li-Po battery with a higher capacity (e.g. 4000 or 5000 mAh).
• An external antenna must be attached to the meter, such as: https://www.amazon.ca/gp/product/B07PZFV9NK/ref=p.... Ensure it is rated for the frequency used by the cellular service provider where the water meter will be used. The antenna that comes with the cellular IoT device is not suitable for outdoor use. The external antenna can be connected with a long (3 m) cable that allows the antenna to be attached to the outside of the well at the wellhead (Figure 7). It is recommended that the antenna cable be inserted through the bottom of the case and thoroughly sealed with silicon to prevent moisture entry (Figure 8). A good-quality, waterproof, outdoor coaxial extension cable is recommended.
• The cellular IoT device runs on a different code than the WiFi version of the meter. The code for the cellular version of the meter is provided in the attached file (Code2_Cellular.txt).