Author Topic: Double switch: mains and low voltage safety question  (Read 1352 times)

0 Members and 1 Guest are viewing this topic.

Offline LusuTopic starter

  • Contributor
  • Posts: 21
  • Country: ro
Double switch: mains and low voltage safety question
« on: December 19, 2018, 09:55:19 am »
Hi,

Please bare with me, it's my first post here and English is not my native language...

I am doing a schematic + PCB layout for a microcontroller controlled board. In short it does among others AC dimming for lights. I did include a "manual bypass" switch (ON - OFF - ON) that can turn the lights "full on" or "full off" in case of faults or other reasons (see crude block schematic attached). All is fine with this, but I do want to use a double switch that will connect 2 inputs of the microcontroller to ground (one for each "ON" state of the switch).

The switch itself is isolated, but I worry about faults in the switch where the AC mains may reach the microcontroller pins.

Are there any reasons to be worried about the switch sending AC mains over to the MCU? If yes, what can I do to protect against? Should I put in optocouplers just to be safe?

Additional info:

Thank you.
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Double switch: mains and low voltage safety question
« Reply #1 on: December 19, 2018, 11:04:30 am »
If you want or need to comply with standards and regulations, you most probably cannot use this kind of switch in the way you want to. This is because the switch probably doesn't meet safety insulation ratings between its two poles. Can't tell this from the datasheet, but usually these switches aren't made for your application.
So yes, it would be strongly recommended to a safety isolate the circuit by some other means (e.g. the mentioned optocouplers).

If it's a one-off for your personal use, I would hesitate a bit, but most probably just do it the way you describe.

Edit: No, I wouldn't, but for some other reason: The kind of contact used in these switches isn't made to work reliably on 3.3V ... 5V and a few mA levels. The contacts may get unreliable over time in your non-isolated circuit. One would operate them at voltages above 12 ... 24V. This is due to oxide or whatever coating that happens with this kind of power contacts, and this coating requires a minimum operating voltage and current to break through. 5V usually isn't enough.
« Last Edit: December 19, 2018, 11:07:53 am by capt bullshot »
Safety devices hinder evolution
 

Offline LusuTopic starter

  • Contributor
  • Posts: 21
  • Country: ro
Re: Double switch: mains and low voltage safety question
« Reply #2 on: December 19, 2018, 11:18:11 am »
It does not need to meet any compliances, it will basically replace all my light switches in my house. I am not worried about the ON contact resistance because all I need to detect is in which position is the switch. The internal pull-up resistance of the MCU is 25-50K, so even 1K contact resistance will beat that (will be few tens of millivolts which will still read as a "zero"). Also, if I'm doing my job properly, the switch will not be used at all, it will just sit in "Auto" position.

I do not need to test if AC is present or anything else... It is not mandatory to have this detection, but I want it :)
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Double switch: mains and low voltage safety question
« Reply #3 on: December 19, 2018, 11:23:06 am »
The issue I mentioned isn't about contact resistance in the milliohm range. The oxide layers cause high resistance (as high as "isolated") to a closed switch if not enough voltage is applied while the switch is in "open" state. The switch would look like an open circuit to your microcontroller, so the uC can't detect the switch is closed.

Anyway, if it was my design, I'd try to get away with a single pole switch and do the sensing by some other arrangement and maybe one additional optocoupler.
Safety devices hinder evolution
 

Offline rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Double switch: mains and low voltage safety question
« Reply #4 on: December 19, 2018, 04:00:17 pm »
Usually the problem with using 'industrial' type switches for logic:  First, the logic voltage isn't high enough to break through any oxide layer on the contacts and second, the current flow isn't high enough to keep oxide from working back in.  If you look around, you will find that logic level switches have gold plated, bifurcated, contacts with a very low current rating.

https://www.nkkswitches.com/pdf/switchcontactmaterial.pdf

The next to the last paragraph recommends gold over silver contacts for your application because the gold will work for logic levels and the gold will vaporize off the power contacts leaving the preferred silver.

I wouldn't do it that way...

Side issue:  In the bad old days, the pull-up resistor for switch inputs was quite low - maybe 1k - to guarantee at least 5 mA of current.  It's a waste of power but low resistance values is one way to get around the contact problems.
 

Offline LusuTopic starter

  • Contributor
  • Posts: 21
  • Country: ro
Re: Double switch: mains and low voltage safety question
« Reply #5 on: December 19, 2018, 05:33:31 pm »
Asumming the following:
  • The max. current for AC in the circuit is at most 230V @5A (~1100 W), because I will not need 11x 100W lightbulbs on one circuit, not by far (but that's the upper limit I designed the PCB)
  • The load should be purely resistive, as I plan to dimm only lightbulbs (I'm not sure if LED-based ones are purely resistive too)
  • I would like to put to ground the MCU pins using the internal pull-up resistor (25-50K, that's 0.1 - 0.2 mA @5V if i did the proper math) and read that as a logic 0, or if required I can use external pull-ups/pull-downs
  • I would need to be "safe" to mix AC on one switch and DC on the other
  • The switch must be panel mounted, ON-OFF-ON type, similar to the one I've shared

Are there some switches that will work in my scenario in the long run (20+years)?

Also, how "safe" is to have this combination on the switch? I am afraid of the switch putting AC in the low-voltage circuit due to a fault in it, either by ground/VCC line or by MCU pins. This is why I do not know how to proceed... I need it to be safe, so I will be better off with no switch position detection at all if that's the only way.

If I put an optocoupler, I need to power it from somewhere, and AC input does not look like a "good idea" becuase then I would need to process the AC cycles too... unless I make it DC with some bridge rectifier and caps... (and it requires that AC is present), but I'm open to suggestions...
 

Offline capt bullshot

  • Super Contributor
  • ***
  • Posts: 3033
  • Country: de
    • Mostly useless stuff, but nice to have: wunderkis.de
Re: Double switch: mains and low voltage safety question
« Reply #6 on: December 19, 2018, 05:50:20 pm »
I'd suggest something like I've sketched here.

If the switch is at "Auto", OK2 senses the line voltage and gives you the zero cross timing for the dimmer. Don't care about OK3 here.

If the switch is at "On" and the dimmer doesn't fire the triac, OK2 should see nothing and OK3 senses the line voltage.

A bit of software needs to be done to cope with it, but it uses an AC only single pole switch. There's still a risk of getting trouble in "On" mode, because the triac might fire unintended or leak, so OK2 can give false information. It might need a bit of experimentation and testing.
Safety devices hinder evolution
 

Offline LusuTopic starter

  • Contributor
  • Posts: 21
  • Country: ro
Re: Double switch: mains and low voltage safety question
« Reply #7 on: December 19, 2018, 05:57:52 pm »
Thank you! It looks great and I may be able to squeeze the extra opto on the free MCU pin... then I would have to do double-pin zero-cross detection instead of one, and report via IIC to the main MCU the situation...

That's a lot of help, greatly appreciated!
 

Offline LusuTopic starter

  • Contributor
  • Posts: 21
  • Country: ro
Re: Double switch: mains and low voltage safety question
« Reply #8 on: January 27, 2019, 06:05:36 pm »
Unfortunately this turn out not working, the triac does not fire. It may be because the MOC is in series with the light bulb?

Edit: That was the issue. I've modded the board and connected the MOC to the other anode and now it works.
« Last Edit: January 27, 2019, 07:10:15 pm by Lusu »
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf