Safely switching mains for Arduino

Discussion in 'Electronics & Electrics' started by ShadowBurger, Jul 29, 2020.

  1. ShadowBurger

    ShadowBurger Member

    Joined:
    Feb 19, 2008
    Messages:
    2,156
    Location:
    Melbourne
    Hey all

    Per title. Yep I'm aware I can get "relay modules" to suit my arduino, however these are DIY and obviously not legal.

    I'm wondering if anyone knows of any off the shelf products which are essentially the same thing but packaged as a sealed unit with a low voltage input designed for hobbyists to safely switch mains loads on and off? Bonus points for built-in anti-bounce to prevent fast switching.

    Cheers,
    Shads
     
  2. RobRoySyd

    RobRoySyd Member

    Joined:
    Jan 24, 2008
    Messages:
    8,228
    Location:
    Sydney
    Look for a "smart WiFi plug". I have one that's marketed under the "Brilliant" brand, I think it came from Bunnings, The only problem is getting an Arduino to talk to it.

    As for anything DIY so long as you're not wiring it into fixed wiring there's nothing illegal about making a mains powered appliance for your own use, at least not in NSW.
    On the other hand even an approved device that is designed to be wired into fixed wiring has to be installed by a licensed electrician.
     
  3. OP
    OP
    ShadowBurger

    ShadowBurger Member

    Joined:
    Feb 19, 2008
    Messages:
    2,156
    Location:
    Melbourne
    Had a quick look, thanks, but it defeats the point if I have to hack it to get it to do what I want

    starting with a search for "Smart WiFi plug with API" I did manage to find some solutions but I really don't want to have to depend on WiFi for this application. I'll keep looking
     
  4. oculi

    oculi Member

    Joined:
    Aug 18, 2004
    Messages:
    11,710
    servo driving a cam acting on a garden variety mechanical switch? I don't have a need for switching 240 Volts but figured I would use some kind of relay if I did (I worked out a cheap way to get an Arduino to switch relays a while back) I think I'll do it mechanically now as it's funnier.
     
  5. mtma

    mtma Member

    Joined:
    Aug 12, 2009
    Messages:
    5,612
    ShadowBurger likes this.
  6. kjparker

    kjparker Member

    Joined:
    Jun 28, 2001
    Messages:
    1,450
    Location:
    Sydney
    Those plugs use an esp8266 based controller in them, which can be reflashed with alternative firmware, one of the most popular being tasmota. This gives you an http interface and an mqtt interface. I have a few of these plugs, and I have had no issues to speak of with them so far.
     
  7. mAJORD

    mAJORD Member

    Joined:
    Jun 4, 2002
    Messages:
    11,442
    Location:
    Griffin , Brisbane
    So you want it to have an au mains socket on it off the shelf yeah?
     
  8. OP
    OP
    ShadowBurger

    ShadowBurger Member

    Joined:
    Feb 19, 2008
    Messages:
    2,156
    Location:
    Melbourne
    that sounds very doable, have you got links to the exact ones you got?
     
  9. kjparker

    kjparker Member

    Joined:
    Jun 28, 2001
    Messages:
    1,450
    Location:
    Sydney
    I have currently a mix of the Bauhn ones from Aldi, and the Brilliant ones from Bunnings. I bleieve the Arlec Gridsmart ones are also compatible, and can be flashed OTA using "tuya Convert" (google it). https://templates.blakadder.com/au.html will give you a template for the device to help with the config
     
  10. 7nothing

    7nothing Member

    Joined:
    Feb 15, 2002
    Messages:
    1,531
    Location:
    Brisbane
    I was trying to do it with 433mhz transmitter and existing remote switched powerpoint.

    After a short time trying to capture signal from the powerpoint remote, I wasn't getting any reading on the arduino. Bought a moderately cheap USB scope to see if there was output on the receiver connected to the arduino, haven't plugged it in yet.

    That was like 3 months ago and haven't progressed :)
     
  11. Higgsy333

    Higgsy333 Member

    Joined:
    Jan 19, 2002
    Messages:
    34
    Location:
    Adelaide
    ShadowBurger likes this.
  12. OP
    OP
    ShadowBurger

    ShadowBurger Member

    Joined:
    Feb 19, 2008
    Messages:
    2,156
    Location:
    Melbourne
    That's an awesome place to start, cheers.

    Looking into how an APC switched PDU is built inside, it only has 16A ~ 250v relays. I was sort of expecting something much more heavy duty especially with the inrush load of the capacitors in a server power supply. That does make me somewhat more comfortable with using a (quality) off the shelf relay for the kind of switching I want to do, even if I'd rather not build something myself



    I've had experience with my 400W LED grow light welding the relay contacts closed on a cheap arduino module, hence wanting to avoid them in future. Maybe all I need to do is swap out the relay for one I can trust
     
  13. rockofclay

    rockofclay Member

    Joined:
    Nov 10, 2002
    Messages:
    1,644
    Location:
    Melbourne, 3056
    How often were you switching the load? It may be worthwile going the SSR route. They can do a lot more cylces than a mechanical relay.
     
  14. OP
    OP
    ShadowBurger

    ShadowBurger Member

    Joined:
    Feb 19, 2008
    Messages:
    2,156
    Location:
    Melbourne
    twice daily
     
  15. rockofclay

    rockofclay Member

    Joined:
    Nov 10, 2002
    Messages:
    1,644
    Location:
    Melbourne, 3056
    Meh, shouldn't be too bad. I think 50000 cycles is pretty normal for a relay IIRC.
     
  16. mtma

    mtma Member

    Joined:
    Aug 12, 2009
    Messages:
    5,612
    Well if it's directly on an inductive load, the conditions may be a lot more severe. But SSR's of late seem to have been put on some undeserved pedestal, you need to make sure you have the right SSR and setup there for inductive situations too.
     
  17. callan

    callan Member

    Joined:
    Aug 16, 2001
    Messages:
    4,950
    Location:
    melbourne
    I have done precisely this with a Commodore 64 and a remote controlled mains switch, and a Vicā€Rel relay cartridge, and 10 lines of BASIC code. I just soldered wires directly to the controller button pads. Worked a treat, perfectly safe and perfectly legal.
     

Share This Page

Advertisement: