Control mains sockets with Cayenne and Pi?

Hi guys,

As part of my project to control my aquarium hardware with a Pi and Cayenne, I’m looking for a way of controlling the state of 4x UK mains sockets (tank lights, heater, filter etc).

I have actually purchased a relay board and some sockets, with the original intention of wiring these sockets directly into the relay, but reading some of the “issues” with this, have decided against that!

One elegant solution i’ve seen recommended is to use those RF controlled sockets and the associated piBoard:

So, questions would be:

  1. Would Cayenne see and be able to control those sockets, via the board?
  2. I already have a few “wifi” sockets - which are a bit rubbish TBH. At a push, would Cayenne see these on the network?
  3. Whats the “best” or “most common way” of controlling mains sockets with Pi / Cayenne, I’m sure Im not alone with this requirement! :slight_smile:

Hi Charles nice to have another westy on here and You do have a nice project.
The energenie rf sockets are a good unit but I have not been able too use them with cayenne ( I have not given up on them as yet. )
My understanding of them they work by sending a code with 4 Gpio pins are set ether high or low with a 5th as a trigger to send the code to switch the socks on so the on code say is 0010 and off is 0011 you would need a program or some hardware to set the code and then use cayenne to trigger the 5th pin.
If that makes sense.

So at the moment I would go with the relays.
Could you list the items you would like to switch and there power ratings.

Good man - thanks for coming back to me @4Andy :slight_smile:

OK, so at the moment I have bread-boarded and working:

1 x temp sensor
1 x 8 channel relay

Both work as expected, and report to Cayenna as hoped.

Im away from home at the moment, so I’ll just look up the product pages for what I want to power:

1x LED light bar

1x Canister filter

1x internal heater

The other “hurdle” I have is finding a case for the sockets… If I keep the 3 pin plugs on those devices, the project box I’d need would be rather large and expensive…

I had thought of chopping the plugs off and using barrel connectors - which would be nice and tidy - but I dont believe they’ll take mains voltage… ?

Is there a comparable (ideally waterproof) connector, or similar nature (m>f), of similar size (smaller than 3 pin) that could be used?

Thanks for taking an interest in my project! :slight_smile:

That heater @ 200w
LED light @ either 25w or 39w (? see that page)

Looking at the Eheim site, a simmilar filter (I forget the exact model at the moment) as:

Power(50 Hz) to 10 watt
Power(50 Hz) of 35 watt

An elegant way of doing this would be to have the pi, relay etc in one project box - with the output of the relay controlling each socket in a commercial “4-way” socket bar…

Is this possible, perhaps with one of those individually-switched socket bars?

Great stuff all are OK to use on the common 10amp relays.
So if I was going to wire it up I would loose the pugs and bring in the each of the units into to fuesd terminal connection Which would add a bit more safety into the project. (Probably a 3amp fuse)
then having your live incomer daisy chain to each input on the relays (from a 10amp fuse plug socket)
With the swiching live side of the fittings coming from your fused terminals to the N/C side of your relays so if your pi or network goes down you don’t loose power to your filter and heater.
If that all makes sense.
But like me being a poor Yorkshire men we have to use what is available so if it comes down to using a Tupperware tub and some chop block just try to think safety mains voltage can kill.
If you look on my projects it may give you some ideas

1 Like

Great project. For your project, you can use also mosfet.
If the led or anything you want use are 12 V, you can use a transistor or better mosfet like a switch. Now on my blog I want write an article to describe this.
Also if you want add more pin to board you can use MCP23009. This adds 8 digital input/output.