IoT: Wired Light Switch Relay Design Ideas?

Discussion in 'The Projects Forum' started by ti_chris, May 22, 2018.

  1. ti_chris

    Thread Starter New Member

    May 22, 2018

    I'm currently designing a system so that I can enable/disable my lights, plugs and various other appliances remotely. I understand that there's a lot of solutions out there, but it's about the journey for me and not 100% about the destination.

    My requirements:
    • Low-power (think one for every plug/light switch of your home)
    • Can be wired or wireless with a hub
    • The usual impossible trifecta (low-cost, low-power, low-component count)
    • Should work with a typical light switch
    • Must be able to alternate the state of the lights with the manual switch
    • Ideally want to know the state of the switch (on or off)

    Some ideas I've thought about:

    • SonOff (
      • +It can be had cheap for ~5$/ few components to purchase
      • +Can be modded to support a switch
      • -Not so great on power (0.5W Idle, 0.7W active) relies on Wifi
    • Optocoupler with SPDT with a 3-way switch
      • Use of an opto-coupler for protection and the 3way switch can be treated like another SPDT such that you can XOR (ping/pong) the on/off state between the relay and the switch. 120VAC relay + MOC3063 should do the trick
      • -A little pricey (120VAC relays aren't exactly as cheap as the low-power relays)
      • +really low power (~0W Idle, ~0.3W). Could also go solid state and lower the power requirement even more
      • -No good way to monitor the output's state (could possibly add an optocoupler to return the state on another line)
    • Optocoupler with SPST with a micro-controlled switch
      • Let the micro completely control the state of the switch and use the switch as an input to the micro
      • -If the micro fails, you no longer have a way to change the light's state since you need the micro to do some work
      • +cost (Pretty low cost, few components [opto + relay]

    Any other thoughts that people have to set this up easily? I'm debating working in 120VAC vs using an inline power transformer and working in 5VDC or less (ex: HSK-PM01). The nice thing is that 5VDC relays tend to use less power, but then I have to pay for the cost of converting 120VAC to 5VDC all the time as well as the inefficiency of the conversion. I would also have to power the micro all the time. Granted it could be pretty cheap if setup properly and using an IRQ, but there's still a phantom load that will constantly be there.
  2. ebeowulf17

    Distinguished Member

    Aug 12, 2014
    If it were my house, I wouldn't want all lights and appliances to be totally dependent on a micro, unless you plan on since heavy duty planning with backup systems, redundancy, error checking, etc. For me, the third option is totally out.

    I don't know anything about SonOff, but if part of your goal is the experience of doing it yourself, why not go with option 2, including the status monitoring optos?

    If you want to reduce the amount of wiring, you could do distributed subsystems for rooms or groups of rooms, and have the subsystem microcontrollers communicate with each other through Ethernet or WiFi.
  3. ti_chris

    Thread Starter New Member

    May 22, 2018
    Thanks for the reply. More below:

    I agree. I'd feel much better knowing that I can still open my lights even if the micro stopped working. It's an option, albeit not a really great one.

    That's an interesting idea. Definitely worth considering. It would also save me from having to design a GPIO extension board (since most micros won't have enough GPIOs to accommodate).