Software apps and online services
Hand tools and fabrication machines
Needed to solve the issue of not knowing if the sump pump was working. Added cloud service and water level monitoring.
Remove the plastic window that comes attached to the top of the enclosure. At first, the sensor doesn't fit because the two metal cylinders are two big for this opening. Modifying the opening is required.
- Option 1. If comfortable with power tools, use a drill and large bit to make the opening fit the cylinders. Rub the spinning drill bit against the plastic until it takes the round shape.
- Option 2. Use a metal file. File away the plastic using round metal filer until the sensor fits snugly
Next fit the Photon Redboard in the enclosure. Be sure to leave enough clearance to fit the USB power connector. If the Photon sits too deep, there is a lot pressure on the connector and it could break the USB off the PCB. (I found out the hard way):
Use wire jumpers long enough to allow case to open. Use electrical tape to secure loose wiring, jumper junctions, and to prevent electrical shorts. Use a 5V. DC, (1A minimum) Transformer to power the Photon.
Pinout from Sensor to Photon:
- VCC to V-USB
- Trig to D2
- Echo to D6
- GND to GND
If you already have a Ubidots account, skip this step. Make a user account at Ubidots.
- Locate your Token from "API Credentials" details
Create 5 variables to track water level statistics and locate their Variable IDs:
Create a new application and include the HTTPCLIENT library. Copy and paste the code included in this project and save. You will have to edit the Ubidots token as well as the 5 Variable IDs in order to see data on Ubidots.4. Testing Sensor
Connect the Photon to the serial monitor at 115200 baud (Arduino Monitor works fine) and you should see the measured distance in centimeters updated every 1 second. Use a measuring tape and verify the accuracy. Measure from the edge of the cylinder cap of the sensor to object. In this example, the sensor was mounted on a table pointed to the floor.
- Tape measurement: 29.5 inches
- Sensor measurement: 74.5 centimeters ( 29.33 inches )
- 1 minute Average: 70.8 centimeters ( 27.87 inches )
- +/- 1.5 inch error is fine for this project
The code in this project will use a 60 sample average to deal with this noisy signal. Additionally, use the centimeter output because it's more accurate than the one provided for inches. If inches are really needed just divide the results by 2.54f (float).5. Sensor Installation5.1
In order for the Photon to measure the sump basin water level correctly, measurements have to be taken to ensure the accuracy of the results of the HC-SR04 sensor. The following measurements are needed:
- Sensor height from bottom of sump basin
- If water marks are visible measure them (low and high level)
- Measure actual water present with the tape measure
- Measure where the level of the water is when the sump pump triggers
For the sump basin shown above (same as mine), the water level rises to 32 centimeters and the trigger on the sump pump causes it to discharge approx. 14 gallons. The pump isn't very efficient as it can't discharge all the water and 12 centimeters is left behind, that's why there is a low waterline present in this basin.5.2
After you have completed all your measurements, look at the particle published events to see what the Photon sensor is reporting. The majority of these published events are commented out in the code as Ubidots provides a nicer interface.
This project's main functionality requires that it sends sensor information to the Ubidots cloud service. Once there, Ubidots provides charts, tables, and gauges to build a interface that can be viewed from any device.