Sump Pump, Aquaponics & Aquarium water level monitoring

I seem to like flooding my basement… Usually by overfilling one of my aquariums, or intentionally putting 55 gallons of water in a 45 gallon aquarium. Sometimes, I overfill the swimming pool in the back yard.

So I decided to put together a monitoring system. It will monitor my sump pump, letting me know when it is getting used hard so I know to pay it more attention. It will monitor my Aquaponics grow bed, telling me when my flood and drain / ebb & flow grow bed isn’t functioning correctly. It will also monitor my fish tank water levels and let me know when the water is getting low, or more importantly when I am filling it and it gets to where it ought to be.

This is put together with Raspberry Pis. An older original B model for the fish tank because I have it and it’s close enough to Ethernet that I can run a wire to it. The Sump Pump is getting a Zero W as it is further away, and I needed to buy something and it was the cheapest option ($10).

I am measuring water height by 2 methods. An ultrasonic distance meter and a differential pressure setup.

I coded up the project a couple of different ways, learning as I went along. I ended up starting with the hardest methods first, and moving towards easier methods. Starting at OS level triggering of shell scripts, moving through python programming, and finally landed on Node Red. I am happy for the path I took as I now have a solid understanding of what a Raspberry Pi can do for me and how to control it at multiple levels. Node Red is how I will be building most of my projects going forward as it’s easier for the kids to understand.

Node Red

Node Red is a graphical programming environment that you use with a web browser. This means a quick tweak can be made from your cell phone! Not the best experience, a cell phone, but doable.

The core concept  of Node Red, is you drag ‘nodes’ or blocks onto your screen and set them up with the particular details that node needs. Configuration settings such as the specific pins on the raspberry pi you have a sensor plugged into, a login for an online service, etc.

You then connect the different ‘nodes’ together with lines, and the whole thing just starts working. Amazing, really.

You program a computer using the same methods you would use to explain a process to another person. Draw a bunch of boxes saying this box does this thing, and connect the various boxes together with lines showing how different events are chained together.

When you use the Node Red menu in the Raspberry Pi, it opens up a text window, with a bunch of stuff on the screen. In amongst that text, is instructions on how to set Node Red up to turn itself on automatically when the Pi starts. Now you have automatic monitoring even if the power goes out and comes back on.

Direct reading of water level via sonar

Ultrasonic distance meters turn to out to measure the distance to a water surface fairly well. The water needs to be reasonably flat & calm for it to work reliably.  The thing basically beeps at a high enough frequency that we can’t hear it, and listens to see how long until it hears it’s echo back. A little bit of math, which computers happen to be good at, and you have a distance measurement!

I picked up a bunch of HC-SR04 sensors for cheap from eBay.  You can get them from reputable sources for around $5 each.

The HC-SR04 sensor tutorial I followed when writing code is found at https://www.modmypi.com/blog/hc-sr04-ultrasonic-range-sensor-on-the-raspberry-pi

If you want to learn about all of this, it is good to work through the tutorial. I ended up dropping the tutorial method and used Node Red.

HC-SR04 Node Red sensor, calibration, and logging flow.

Node Red needs an add-on node to ‘talk’ to the sensor. The one I found is https://flows.nodered.org/node/node-red-node-pisrf . Install it according to the instructions, restart Node Red (or the Raspberry Pi if you haven’t figured out how to restart Node Red) and reload your browser window for it, and you can now start taking distance measurements.

Differential Pressure water level method

Have you ever noticed that if you hold your finger over the end of a straw, stick it in your glass, the water goes up the straw only a little bit? When you do that, you are increasing the air pressure inside the straw.

If you compare that air pressure inside the straw, to the air pressure outside the straw, you are working with differential pressure.  We can use this to simply see the cycle of water rising and falling, or calculate the actual height of the water inside the pipe. I don’t know what physics principle to use to do the math for calculating actual water height.

I used a BMP280 temperature and pressure sensor. The adafruit library didn’t work well for me. I did however find https://github.com/ControlEverythingCommunity/BMP280/blob/master/Python/BMP280.py which worked well.

The Node Red library has a bug in it at the moment. When you try to use it with the BMP280 module, it crashes Node Red. If you see this happen, the fix is simple, you need to call in the bigNumbers.js library in the right spot.  Once you do this, things work correctly.

The BMP280 had some issues with longish wires. I ended up using some Cat5 with the tip from https://www.raspberrypi.org/forums/viewtopic.php?t=82049 for how to pick the wires to get the best performance. This worked well, if a bit time consuming to pigtail the doubled up wires so I only had 1 wire to solder onto the printed circuit boards.

Seeing the data

I logged the data to io.adafruit.com using MQTT. The library I used is found at https://github.com/adafruit/io-client-python for coding things the hard way. Node Red has a built in MQTT node as well.

I used Adafruit’s IO tool because it’s cheap (free) and easy, and is great for learning how to do all of this. There are other options available from Amazon,  Azure, Google, IBM, and many many more. Adafruit’s tool is great to start out with.

Sensor readings in a Bell Auto Siphon Fail to Break mode
Sensor readings in a Bell Auto Siphon Fail to Break mode. The ‘gap’ in the middle of the chart is from the auto-siphon failing to break siphon. We see it in both the upper graph measuring the actual water height plus the lower graph measuring the pressure elevation in the stand pipe.

 

 

Internet of Things Phone Smart Charger

I pre-ordered one of the Samsung Galaxy Note7 phones. The ones in the news recently for being an explosion hazard.

I love the new phone – pocket computer really, the way I use it. I wasn’t about to give it up over some silly thing like spontaneous combustion.

I had read that Tesla runs their car batteries between 40%-80% for normal use to maximize the lifetime of their very expensive car batteries. I figured that cell phone batteries would benefit from similar treatment. A bit of research generally confirmed this, with http://batteryuniversity.com/learn/article/how_to_prolong_lithium_based_batteries being the most concise write-up. The first half basically demonstrates that you can get the same amount of total power to flow through the battery regardless of how much you charge it – summed over the total life of the power draw in the data tables. The 2nd half is more interesting. It says that high voltage charges and heat shorten the overall lifespan of the battery.

The Note7 is a sealed phone wihtout a replaceable battery. I can’t pull my usual trick of replacing the battery after a year of abusing it.

Heat seams to be the trigger for the phone explosions. So I can make my phone more safe, and make it last longer by managing the top voltage and heat in the battery.

I can do this.

I bought a wireless Qi charger to charge the phone because it charges slower. The fast charger can charge the phone crazy fast, but it gets HOT when it does this. Hot is bad. Thus, slow is good. The wireless charger will also reduce wear on the USB C port. A nice side benefit. No phone explosions while I sleep and burn the house down – this is a good thing.

I bought a Belkin WEMO wifi controlled outlet. It is If-This-Than-That (IFTTT.com) capable so I can control it from my phone. There are other smart plugs available that will work, this is simply the one I could find in a store that I could verify would work with IFTTT.

I configured IFTTT to have 2 different actions. One for turning the WeMo on, the other off. I set these up as Maker Channel triggered recipes. There are other triggers that you can use such as email or SMS, but I am a web developer, so web-based triggers are a natural fit for me.

Image of The Rules set up in IFTTT
The Rules set up in IFTTT
Photo of the IFTTT Off rule
The OFF rule in IFTTT. It uses the Maker Chanel for the trigger, which means a web request will trigger this. It turns off the WeMo controlling the wireless phone charger.

I installed Tasker on the phone and configured it to monitor charge state and battery temperature.

I created 3 tasks, one to turn the charger on, and two to turn it off.

photo of Tasker rules
The rules in Tasker to control the phone charging.

The ON trigger looks for the battery to be below 80% charged, and below 35 degrees Celsius. This will make a request to the IFTTT.com Maker Chanel URL for ON.

One OFF trigger looks at the battery temperature. 35.1 degrees or higher. The other OFF trigger looks for the battery charge to be 90% or higher. These two both make a web request to the IFTTT.com Maker Chanel OFF URL I set up.

So now as the phone battery heats up or gets close to full, the phone tells the charger to turn off. I let the phone have a 10% charge window so I am not toggling the switch and charger on and off all night long.

Tasker with both OFF rules turned on. The phone is both charged to 90% or more as well as running hotter than I would like.
Tasker with both OFF rules turned on. The phone is both charged to 90% or more as well as running hotter than I would like.

I also programed the WeMo to turn itself on a little while before my alarm is set to go off. This is to let the battery be closer to 90% charged rather than 80% charged when I wake up. I haven’t found the right time for this yet. I still need to play with it a bit.

I know there are other ways to make a smart phone charger. This is what I came up with. I will be getting an additional smart plug and building one for at the office so I don’t over-charge my phone when at work. I will try a different brand likely to see if I can come up with a cheaper way.

I built an Altoids tin multi-fuel backpacking stove

I spent an hour or two on Youtube the other night, coming up with ideas for this. So, none of the ideas are original to me, but I didn't see a multi-fuel setup or a capillary action alcohol stove out of a Altoids tin. 

97 grams as it currently sits. It will gain a little bit of weight as I add a small fero rod and jigsaw blade, wind screen and protective wrap. The tin will be the handle for the small saw. I am also going to add a leather wrap around the tin. The wrap is to contain the parts and also be used for a base for keeping tinder dry when making a campfire. The leather thong will be long enough for a bow-drill.

The capillary stove is pretty cool. The fuel wicks up inside the metal wick by capillary action. The metal gets hot, vaporizes the fuel, and it burns. The X shape of the wick is to increase the amount of flame area while providing good air flow to the flame. The X is a slice of a soda can, folded down to the shape.
Currently, I have a problem with boiling of the fuel before it can vaporize, so the stove will spit little fire balls nearly a foot away! It needs work yet.

In album 2015-02-11

Capillary action alcohol stove burning. The fluid wicks up between the thin gap in the soda can wick. The hot metal vaporizes the alcohol, which then burns well. This will burn like this for 5 minutes on 6ml of denatured alcohol and then burn out in a matter of seconds.

All packed up. Everything fits into a regular Altoids tin.

This is in liquid fuel mode. The burner sits inside the tin which has the bolt stand offs to hold the pot. The mesh grate isn’t used in this form.

Wood burning mode. Small sticks can be placed between the pot stand posts. The grate allows air to get under the fire for better burning.

The pot stand is sized to work with metal water bottles.

I tried making a water block for water cooling my MakerGear hot end this weekend…

I tried making a water block for water cooling my MakerGear hot end this weekend.

I failed.
       kinda…

A bit of background as to WHY I would want to do such a project can be found at http://mike.creuzer.com/2013/01/watercooling-my-makergear-prusa-reprap.html I wanted to improve over the coil of copper being that I am about to re-install my 1.75mm hot end for a few lbs of plastic. Going to try ABS for the first time at this size. Not sure if I am going to have problems with that or not.

My fail is I was too lazy to go out into the cold to drill a hole on the drill press. I managed to salvage my stupid hole with a bit of tubing. Hopefully it doesn't cost me too much in efficiency.

I really have no idea what I am doing when it comes to using a lathe. Learning from YouTube is difficult as many of the videos posted are by people with as much experience as me (about 3 hours at this point).

Well, the next iteration should be better, right? I enjoyed making this enough I wouldn't mind making it again. But with a drill press. I think I will drill that hole first so I know it's right.

In album Machining a water block FAIL

Using my UNiMAT lathe to fix my lousy hack saw cut and bring the aluminum block down to the right dimensions.

I turned down the black insulator a bit as I don’t have metric drill bits. The bigger tube is to couple airline tubing together on the OUTSIDE so I don’t get even more restrictions of water flow.

THERE I FIXED IT. I ran a bit of aquarium air hose through the buggered up hole. I am going to lose a lot of heat removal capability, but it lets me temporarily salvage this part. The water going through is in it’s mid 60s, so there is going to be a big difference, so it should pull heat well.

Until I make a new one.

I cut a piece of aluminium in half with a hack saw. The tray did a decent job of collecting the aluminum dust. Terrible surface finish on the cut. I did not do a good job of making the cut straight.

I tried drilling the hole using a hand drill because it’s COLD out in the garage where my drill press is.

I FAILED. I totally didn’t get things where they wanted to go. I’ve a hole on the inside, and a double hole on one end.

I can JUST snap the wooden clip in place with the water block installed. It’s going to be a royal pain to un-clip it.

The water block is small and light. It should work well I hope.

I think I invented something

A laminar flow pipe reducer for a pump housing. At least, a little bit of Google searching hasn't shown me another.

I am trying to find a cheaper way to heat the 75 gallon aquaponics system in the basement. It's really running closer to 125 gallons of water with a LOT of surface area. This bleeds heat quite quickly, so the electric submersion heaters are expensive to run and I simply don't have enough to keep up with the cold basement sucking the heat out of my tanks.

So, I did something stupid. I rigged up a water line to the furnace and water heater flue. This involved running about 25 feet of 1/4 inch tubing because that's all I had on hand that would go the distance. There are issues with copper being toxic to fish, and cooling the flue, causing Carbon Monoxide to fill the house. So this is not something you want to do yourself.

I needed more water flow. A 3/4 inch pond pump forced down to 1/4 hose just doesn't work very well. Too much restriction to get good flow.

I had to make a water tipper to help my grow bed siphon start and stop. This just fills up with water slowly and then dumps the water at once into the bed. The small water pulse surge is often enough to trigger a slow siphon.

This is fine and dandy, but I have a 3d printer. So I spent some time with a Fluid Dynamics textbook and openscad and came up with an adapter for running multiple hoses out of my pump – http://www.thingiverse.com/thing:54029 

I think it's a first. I haven't found anybody else who made a laminar flow reducer for a pond pump. This thing induces laminar water flow through a series of small honeycomb shaped features inside the adapter.

It was very challenging for me to make, as my math skills aren't up to par. I kinda had to trial and error it instead of solving the problem with math.

In the end, it's designed to be printed, with a center support column running up the center to make the upper section easy to print.

The best part is that the goofy thing works!. I get the same water flow out of the heater line as before PLUS I get 2 additional water lines that are providing a significant additional water flow. I'd expect it to work poorly do to all the plastic that's in the water flow, but it seems to be efficient enough to overcome all the extra gunk in the way.

In album

Seriously stupid going on. Aquarium water heater off the furnace flue.

Water tipper mocked up with various bits to induce a water surge to trigger the bell siphon

Honeycomb feature inside the adapter to induce laminar flow.

3 different hoses come out of this one pump adapter.

I broke the first print in half to verify that it printed the way I wanted it to. (It’s my story, let me tell it the way I want to)

The pump running 3 separate hoses.