Just a short post to follow up on the how-to Raspberry Pi post. I went into detail on how to get one going, but I never really said what I was doing with the thing. So, in case anyone is curious:

First I installed all the software I wanted. I set the Pi up as a headless (no monitor, keyboard or mouse) network-controlled computer. I installed a wifi dongle so it became a headless, wireless network-controlled computer. And then…

I set the Pi up to control a relay board, where the relay’s normally closed (when unenergized) contacts normally allow power to feed through an otherwise vanilla extension cord. Into the extension cord, I plugged my salt tank’s active filtration pump. So the Pi is plugged into the wall, and the filter pump’s power is switched by the relay.

Then I wrote a little (very little) thing in Python that lets me activate the relay for a period of time, during which the pumps become disabled.

That worked fine, so I put in an hour’s effort and wrote a “relay server” in Python that waits for TCP messages from clients that tell it to turn the relays on or off.

Then, into the second relay, I plugged my micro-aeration system’s air pump. A client program tells the server to turn it on a 9:30 at night, and run it for eight hours. Why? Because the bubbles are so small that it takes them a while to be absorbed, they don’t really float, and this noticeably affects the visibility in the aquarium. By running aeration only at night, I make sure they’ve got good gas suffusion, but the tank is maximally clear during the day when we’re looking at it.

What the first relay on the filter pump is used for is, first, when I feed the fish and corals, I don’t want the food for the fish and the micro-organisms for the corals pulled into the filter, clogging it sooner than otherwise would occur, wasting the food, and increasing the bio-load on the tank to no purpose. Second, when I clean or change the filters, I don’t want the pump running as it can dump debris from the filter chambers, temporarily without the filter media, into the tank.

So I start a client that tells the server to shut down the pumps for about 45 minutes, I feed the waterkids or deal with the filter media, and walk away. 45 minutes later, without my having to worry about it or hang around to see it done, the pump turns back on, and all is good — no fuss, no muss.