Fish Feed Time – Wireless Socket Control with the Raspberry Pi
Being a bit of an unecessary geek, I’ve decided to pimp out my fishtank with a Feeding Time button!
“What’s one of those?” I hear you ask! Well… As it’s a Marine Reef tank, it’s a bit fiddly to feed some of the corals directly with the powerheads (underwater fans) running, so it’s often useful to turn things off that agitate the water.
I considered having hardwired relays going to each plugsocket that I wanted to control, but aside from the advantages (ability to verify state, confirming that a socket is on/off etc), I didn’t fancy playing around with Mains voltages- especially on something that’s so close to large amounts of water!
So, instead I opted to grab some Remote Control plug sockets, and control these with a Raspberry Pi (which I happened to have underneath the tank already… See: Aquarium Moonlight Controller)
There’s a few different types of Remote Control sockets, but the ones I opted for look like this:
I grabbed these from Amazon, but I’ve seen them on Ebay and a few other places too- I bought one pack of three, plus an additional standalone plug- which also means I have two remote controls too; not that I need them
[important]You can use pretty much ANY remote control sockets that have a Remote Control, but you will likely need to *manually* update the Remote Codes in the “switch” script! This involves a fair bit of technical faffing-about, but is well documented here: Hoagies House – RC Sockets
You can also find the original source code for the “switch” script here too![/important]
Now I had my plugs, I needed a transmitter. I went for this 433Mhz Transmitter LINK_HERE – but you should find that any similarly cheap 433MHz transmitter should work fine- just ensure you redesign the PCB and/or connect up the pins correctly as the pin layout may change between transmitters!
For the design, I wanted:
- An LED to signify when FishFeedTime was active
- A buzzer to signify “Start”, “Warning”, and “Stop” statuses.
- 433Mhz Transmitter to control the Sockets
- A Push Button to Start/Stop FishFeedTime.
I set out to prototype the kit on a breadboard, before drawing up a PCB to be fabricated by
To deploy the code, we assume you have SSH access to your Raspberry Pi (check the Raspberry Pi help pages if you’re unsure on this.)
- SSH to your Pi, as a User with “sudo” access!
- Get the code:
Create new user
- Deploy main and init scripts
- Configure Your Sockets
For this part- run the configuration script FIRST!:
This will configure each channel, one-by-one.
If you don’t care about being able to control the sockets individually in some other code (which I do!), then you can just stick them all onto Channel 1 if thats easier
For more detail: Fish Feed Time – Wireless Socket Control with the Raspberry Pi