Software apps and online services
This sump pump monitoring project aims to highlight how easy it is to build on Particle by developing a monitoring system for sump pump basins. The system is designed to detect and alert users of potential problems with the sump pump before they lead to flooding and water damage.
The system utilizes the Particle Photon 2, a Wi-Fi enabled development board, to perform edge computation, connect to the internet, and transmit relevant data to the cloud. To expedite the hardware design phase, and minimize development time, off-the-shelf sensor Click boards from MikroE and a SparkFun sensor were used.
The system is programmed to continuously monitor the water level in the sump pump discharge pit and send alerts to the user's mobile device or email if the water level rises above a predetermined threshold. Additionally, the system collects and transmits data on the temperature and humidity levels in the surrounding area to help users identify potential issues with the sump pump or the environment.
Once the data is sent from the edge to the cloud, the data is captured in a Losant dashboard for visualization and a database for historical records. In addition, when warning/fault messages are sent from the edge, the cloud sends SMS and email messages to alert users.
The sump pump monitoring project helps users prevent costly water damage by providing early warning of potential problems with their sump pumps. By utilizing Particle Photon 2 and MikroE Click hardware, the system is reliable, efficient, and easy to use.
You may need to adjust the details based on your specific sump pump basin, the specific layout of your basement, and the exact components you're using, but the basic principles should hold.Feather Click Shield
The Feather Click Shield is designed to make learning embedded system design fun. It serves as an adapter board that facilitates rapid prototyping by enabling the integration of Adafruit Feather-compatible baseboards, like Photon 2 with a variety of Click boards.
The Feather Click Shield comes equipped with two proprietary mikroBUS sockets. These allow any Click board devices to interface effortlessly with Feather boards. Click boards can be easily installed by placing them on top of the mikroBUS socket and clicking them into place. The Shield also provides an additional 5V power supply for more power-demanding Click boards, thereby extending the range of devices that can be interfaced.AC Current Click
The AC Current Click is designed to measure alternating current (AC) in a non-invasive way. It uses a sensor that works on the principle of electromagnetic induction, similar to a transformer, to measure the current running through a conductor, such as a cable.
The hardware features a 3.5mm jack connector for attaching the sensing probe and a low-noise 12-bit Successive Approximation Register (SAR) Analog-to-Digital Converter (ADC) that converts the sensor voltage. This ADC, along with a dual operational amplifier, helps ensure reliable and protected readings against electromagnetic interference and radio interferences. The device provides conversion data via the industry-standard SPI interface and also has an analog signal path available to users, allowing for various usage scenarios.
The AC Current Click is equipped with the MCP3201, a 12-bit SAR ADC with an SPI interface from Microchip, and the MCP1501, a high-precision buffered voltage reference IC. It uses these to sample the input voltage generated by the current sensor.Temp-Hum13 Click
The Temp-Hum 13 Click is a compact and versatile board for measuring temperature and humidity. It is built around the HTU21D-F sensor, which is a new digital humidity sensor with temperature output, providing calibrated, linearized signals in digital, I²C format. This sensor offers a fast response time and a very low self-heating effect.Terminal Click
The Terminal Click is a compact and versatile board which provides an easy and elegant solution for adding the external connection capability to your MikroBUS socket. This is a passthrough for the Click and also used to connect other sensors, HC-SR04 in this case.HC-SR04 Ultrasonic Sensor
The HC-SR04 is an ultrasonic distance sensor that provides non-contact measurement functionality ranging from 2cm to 400cm with an accuracy that can reach up to 3mm. The module includes an ultrasonic transmitter, a receiver, and a control circuit. It is designed to be easy to set up and use for range-finding projects.Step-down Power Converter
The step-down converter is a buck converting taking the 12V automotive battery down to a consistent 5V rail. This powers the Photon 2 via the USB plug.Assembly
The only modification required is to use wiring from the Click pins on the Terminal Click and wire between the HC-SR04 sensor and corresponding header. The pins used in the project are PWM (Echo), INT (Trig), 5V (VCC), and GND.Firmware
The firmware leverages existing MikroE Click libraries that were ported over to the Particle development environment using this porting procedure along with using a Particle Community library for the HC-SR04 sensor. This was done to minimize the firmware development and leverage known good example code.
To upload the firmware to your device, clone or download the GitHub repository mentioned at the end of this tutorial and open the folder in your Particle Workbench. You can then compile and flash the firmware over USB.
The Firmware has multiple sections of logic for the various features including
- Sensing the water level (Ultrasonic Sensor + Terminal Click)
- Cycles on the sump pump (AC Current Click)
- Measuring the ambient temperature and humidity (Temp-Hum13 CLICK) in the closet
- Publishing status messages at a set interval
The software used for this project is simple, leveraging the Particle cloud to get data from the edge to the cloud and then using Particle’s Integration Engine to create webhooks to route data to a Losant Dashboard.
Allows the end user to reset the message warning/error counts. Users can pass any value through the function. These counts are used to ensure when warnings/errors occur, data operation usage is minimized, but the user is still notified. Note that these counts reset automatically when the system returns to normal operation.Stop Message Function
Allows the end user to stop warning/error messages. Users can pass any value through the function. This functions sets these message counts to the max message count to stop publishing messages. Note that these counts reset automatically when the system returns to normal operation.Losant Webhook Integration
This project uses Particle's Integration Engine to create a set of webhooks, seven in particular, to route data from the Particle Cloud to a Losant Dashboard. The main webhook is the System Status webhook, while the other six are used for SMS and Email Alerts.Losant Dashboard
A Losant dashboard was created for this project as it is one of the quickest way to build a dashboard and add some logic to manipulate the data using their low to no code approach. Plus Losant also has built in SMS and Email outputs which were requirements for this project. Other services were evaluated like Datacake and Blynk, but Losant was ultimately chosen due to my familiarity with it and the SMS and Email alert requirements.