Thank you Christopher Stanton and element14 for the opportunity to Build Inside The Box! It was great fun.
Getting the box was a moment of great joy and great panic as the reality of "I've got to build something!" really hits home. I retreat to my basement lair and begin to think.
Think. Think. Think. THUMP, Thump, thump. Argh! Silly sump pump. I don't remember it being so loud.
Think. Think. Think. THUMP, Thump, thump. ARGH!!! That's it! I'm buying one of those silent check valves!
What integrates temperature, a switch and something with an op amp? What can I make with the op amp? THUMP, Thump, thump.
So... I'm not quite sure how I came up with this as an idea.
As the title indicates, the plan was to use the components to make a monitoring system for my sump pump to alert me of abnormal conditions and to give an indication of how often the pump runs. "All the time" and "I can't remember the last time" are not very accurate time measurements.
The write-up should be a shortened version of the video.
Vishay Photo Interrupter
The photo interrupter as part of a high water level float switch just made sense.
Microchip Temperature Sensor IC
By living in a house with a sump pump, I've learned a few of the quirks of the system - like when the outlet freezes, the water doesn't go anywhere - so the pump just keeps on running. In this scenario, the sump water acts as a heat sink for the long running pump. This, of course, warms the water - quite a bit, from the two incidents that I can remember. It wasn't until I did some experimenting for this build that I discovered how slow the water temperature rises - which is a good thing for the longevity of my sump pump. 0-1023 analog in. It moves about 25 in 30 minutes, worst case (zero flow, almost no water added to the sump during the 30 minutes). To get to the bath water temperature that I remember, my pump must have been running for hours.
Moving ahead, I just needed to place the temperature IC in the water near the pump and read the output. I attached leads to the IC, put on some heat shrink to prevent shorting, stuffed it into a plastic tube and sealed the end with hot glue.
I will use the analog in value for processing as the actual temperature doesn't improve the functionality. I do not plan to display it - because the system will sit in the corner of a basement, unattended, alone (most of the time).
My plan was to use this quad op amp as my non-contact voltage sensor. I tried a number of circuits, but most did not function as advertised. I decided to try a very simple circuit and it worked better than the rest. It did not behave on the Arduino as it did on the test bench. On the test bench, I got about a one volt swing between output with power on and output with power off. On the Arduino, the readings cycled between 1023 and 0 on the analog input when power was ON, usually in sets of three. The input remained at 1023 when power was OFF. To detect this, I took 10 samples and looked for a 0. Other than that adjustment in code, the circuit performed as expected. I could detect loss of AC power.
ST Range/Gesture Sensor 53L0-SATEL-I1
This is a VL53L0x sensor and the board is an I2C device. I chose to use the Adafruit library and the sensor worked reasonably well. I say "reasonably well" because one must have realistic expectations when bouncing a laser off of water. I wound up using the fluctuations in distance readings to my advantage in triggering the begin and end of a fill/drain cycle. Average 6 readings. If four of these average readings in a row are increasing, the pump must be draining the sump. The time difference between cycles is divided up to display in weeks, days, hours or minutes. I probably should have added seconds as well - in retrospect.
One of the two sensors in the kit seemed a little finicky - until it stopped working. It won't initialize. The other one is still performing as expected.
Midas MDOB128032EV-WS OLED Graphic Display
This display has an SPI interface even though the screen printing would lead someone to assume I2C. The [Buy Now] button said the interface was SPI so that was what I ran with. I connected SDA to MOSI (D8) and clock to clock and it worked.
Again, the vision was to use all of the above components in a sump pump monitoring system. I chose to use a more graphic build plan. You can see some of the notes and corrections (like adding the resistors on the photo interrupter circuit).
The "as built" isn't quite as neat. Vcc is the upper string of WAGO connectors. Ground is the WAGO in the white mount and a 3-pack just to the right of the Vcc buss.
The third picture is the completed project. I'm still waiting for that inspirational moment around the "packaging". The case is functional, but I want something cooler.
MULTICOMP PRO Portable USB High Capacity Power Bank - 10000mAh
Finally, the device that powers it all... the power bank. In an ironic twist of fate... this one confounded me for a bit - and I was one of the folks that recommended putting it in the box.
I had completely forgotten about the Auto OFF feature of large power banks. Serves me right.
I did a little experimenting to see how low a current draw I could get away with to keep the bank alive, but had to opt for a 100mA draw as a balance between enough draw and hearty enough on-hand components.
I do want to build a 555 controlled pulse draw device to decrease battery drain, but that is for another day.
This challenge was amazing! It really helped me dust the cobwebs off of some skills that I thought I still had. I made fewer mistakes in the coding as time went on. I spent most of my bench time trying to get a decent AC detection circuit. I spent most of my coding time trying to get a reasonably accurate cyclic timer system. A current sensor would have been easier, but the time of flight sensor is cooler. I really must figure out if I can recover the one that won't initialize. With that, maybe I could add a detection circuit that only turned on the display when someone was within range.
Thank you again to element14 for allowing me to play along.
UPDATE May 8th, 2021: As I read some of the other builds, I see some folks received a SD card. I did not but I thought I addressed this in the blog. I did not. Must have been one of those fat-finger oops edits. They happen. If I needed to use the SD card, it would simply have been used as a data logger. The next evolution would have been to play audio clips for an alarm instead of using the buzzer. "Hey! Hey! I'm flooding here!" - Mike