# Analog switches exposed to high voltages when off?

Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
I am attempting to roughly measure the resistance of a relay coil with a MCU's AtoD input. The circuit is 5V to a pot (or voltage divider) to the relay coil and then to ground with the output of the pot going to the ADC. My problem is when I'm finished reading the relay coil, rectified 120VAC (positive peaks to 170V) or 330VDC may be switched in it's place. The simple solution is to put a relay (not the one being read) between the pot and the relay coil and just disconnecting the high voltage when not doing AtoD's. That works fine but with the complexity of my circuit, I'm already using over 30 of these isolation relays.
I'm considering using a 74HC4066 analog switch in place of the isolation relay but when the switch is turned off, you'd think that the max voltage on either side of the switch would be the devices VCC. But from the last sentence in the following data sheet note, I can't tell whether high voltages are allowed or not.

Notes (nY and nZ are input/output pins)
1. To avoid drawing VCC current out of pin nZ, when switch current flows in pin nY, the voltage drop across the
bidirectional switch must not exceed 0.4 V. If the switch current flows into pin nZ, no VCC current will flow out of
pin nY. In this case there is no limit for the voltage drop across the switch, but the voltages at pins nY and nZ may
not exceed VCC or GND.

Hopefully someone here can tell me if I can have up to 330VDC on one of the two switch pins when the switch is off or direct me to a discrete analog switch circuit that would withstand HV when off.

#### Irving

Joined Jan 30, 2016
3,186
Can you show a schematic? Why is such HV being applied to a relay coil?

Its very unlikely that the analog switch will survive 330v DC but there are things you can do, the circuit below gives an example.

R1/R2 are your potential divider, high impedance, but low compared to the input impedance of the AD8244 buffer. Being high impedance it serves to limit current from the HV through the diode which clamps the AD8244 input to the VDD rail. 470k limits the 300v to 0.65mA and will dissipate 200mW. When measuring the resistance of the coil, the input bias current for the buffer is just 2pA representing an additional voltage drop of just 940nV in R1, and therefore has no impact on the values read by the ADC. The gain of the buffer is 1 ±0.05%.

Last edited:
Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
Thanks for taking a look! Your circuit will work well for the HV but not so well for putting current through the relay coil for the ADC as you pointed out.
I'm still puzzled what was meant in the 74HC4066 spec that said "In this case there is no limit for the voltage drop across the switch". I hope the circuit I've included will shed some light. Basically I will look at a pin on a connector that could be one of four possible states. The diode to pot to ADC circuit will take care of the High Voltages. And if it doesn't see any HV, the relay will close and 5VDC will go to another pot to coil to GND with the ADC, via the pot, determining the coil resistance or an open circuit. The relay works OK here but as I mentioned initially, I'm having to use over 30 of them and would like to come up with a solid state replacement.

It appears your circuit might be from KiCad? If it is, maybe you could tell me how you did it without doing a screen capture and then exporting to .pdf.

#### Attachments

• 566.7 KB Views: 4

#### panic mode

Joined Oct 10, 2011
2,360
yes that screengrab shows KiCad. and relay there does nothing to isolate MCU from test circuit. lower side is still connected to A0 of the MCU.
but you still did not answer, why measuring component of low resistance requires such high voltage.

Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
Sorry I didn't do the math but my circuit is only conceptual at this point. 5VDC is used to bias the coil since the MCU ADC works in the range of 0-5V. The pot will be sized to give a meaningful reading in this range. The lower pot will be sized to not exceed it's current rating at 330VDC and it's wiper adjusted to not exceed 5V when <= 330VDC is connected. It is always connected so the MCU can "see" if any HV is connected in which case the coil reading relay will not be activated.

I'm not very experienced with transistors so I'd like to run a possible replacement for the isolation relay by you. I've found an NPN bipolar transistor (BUJ100LR,412) that has a Vceo = 400v, Vceo = 700v, and a collector-emitter saturation voltage of 240mv. What do you think?

Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
CORRECTION: Vcbo = 700v

#### panic mode

Joined Oct 10, 2011
2,360
and you keep on barreling forward with your own idea, completely oblivious to questions and suggestions of those trying to help.
relay coil is a piece of wire. wire is a conductor. conductors have low resistance. relay coil may have many turns but it is still a low resistance. measuring low resistance can be done with 5V circuit. there is no need to go to 330VDC or 120VAC. higher voltages are used in some tests (megger for example) but this is not needed for measuring resistance.

#### Irving

Joined Jan 30, 2016
3,186
Can you explain the purpose of measuring coil resistance on a regular basis?

@panic mode while its not entirely clear I think these might be 120v AC/DC relays -the HV is activation voltage, the 5v is to ascertain coil resistance butwhy thats necessary isn't clear - if we knew that maybe other approaches would suggest themselves.

Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
Well thank you for acknowledging that a relay coil can be measured with the 5V/pot circuit I described. But maybe I haven't explained well enough what I'm trying to accomplish.
Here is what I wrote on the schematic:
The above represents a single pin on a socket that can be one of four possible states but is unknown at the time of connection.
I do not know which of, and only one of, the four states, 330VDC, 120VAC, a relay coil to GND, or an open circuit, that I will be faced with when the connection is made. The HV is not being used to test any coil resistance.
If this helps clear things up, please share your thoughts on somehow substituting the transistor I mentioned, or some other solid state device, for the isolation relay.

#### panic mode

Joined Oct 10, 2011
2,360
What is the purpose of using HV?

#### panic mode

Joined Oct 10, 2011
2,360
there is a problem with way you try to go about this.

your RV value will need to be large to survive HV. also problem is that one can turn it all the way and then things will smoke.
better option is to allow RV to be set anywhere without destroying anything. this could be done by inserting larger value resistor between each RV and relay. but in both cases large resistance well be between analog inputs and circuit under test. this is not good when measuring resistance since it is only done at low voltage.

trying to do multiple things with one set of components fixed to some value is always going to be a challenge.
better idea is to split each circuit into each of possible cases and condition each separately (so that each case produces safe 0-5V for MCU). then you can switch one of them in as needed (selector switch or relay or transistor).

#### eetech00

Joined Jun 8, 2013
3,418
Hi

Maybe use a Galvanically Isolated Current Sensor IC at the front end like ones from Allegro.
The MCU reads the output of sensor and determines the state of the connection based on the expected voltage drop across the sensor.
A relay or analog switch wouldn't be needed.

Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
To Irving: The purpose of measuring the coil is to see if it is shorted or open ... a continuity test would do but since I have an MCU with ADC, why not check the resistance?

To Panic: In your last sentence it appears you're suggesting close to what I'm already doing. If HV is connected, the circuit with the diode and high value RV trim pot (only set once) will inform the MCU not to turn on the isolation relay for the coil test. (no cap is included in the HV circuit since I'm also measuring AC phase) Otherwise the MCU will energize the isolation relay and a second circuit will cause current to flow through a lower value trim pot and the relay coil under test using 5V. So ... the "idea is to split each circuit into each of possible cases".

I think I've over complicated things by including a circuit that is not relevant so I'm going to work up another circuit and try to ask my question more simply. Thanks for all the input and I'll post the new circuit later.

#### drjohsmith

Joined Dec 13, 2021
541
To Irving: The purpose of measuring the coil is to see if it is shorted or open ... a continuity test would do but since I have an MCU with ADC, why not check the resistance?

To Panic: In your last sentence it appears you're suggesting close to what I'm already doing. If HV is connected, the circuit with the diode and high value RV trim pot (only set once) will inform the MCU not to turn on the isolation relay for the coil test. (no cap is included in the HV circuit since I'm also measuring AC phase) Otherwise the MCU will energize the isolation relay and a second circuit will cause current to flow through a lower value trim pot and the relay coil under test using 5V. So ... the "idea is to split each circuit into each of possible cases".

I think I've over complicated things by including a circuit that is not relevant so I'm going to work up another circuit and try to ask my question more simply. Thanks for all the input and I'll post the new circuit later.
So is the idea of the circuit to detect that the coil is short circuited ?
sorry Im not 100 % clear on the description of what you want to do
"
a single pin on a socket that can be one of four possible states but is unknown at the time of connection.
I do not know which of, and only one of, the four states, 330VDC, 120VAC, a relay coil to GND, or an open circuit, "

Your connecting to a "pin"
And want to detect if its
a) coil to gnd ( Do you know the coil Impedance ? assuming coil is low impedance, then thats gnd )
b) 330 V DC
c) 120V AC, is this 50 / 100 Hz or 400 Hz or what ?
d) open circuit

What other requirements do you have
you have mentioned in passing measure AC phase , with reference to what ?

Is the relay coil ever driven whilst your connected to it ?
if so then you are going to have to worry about the voltage and the back EMF, if not then great

Is this a one off design for yourself or are you hoping to sell this,
what does the professor that's set this homework say ?

#### Irving

Joined Jan 30, 2016
3,186
Ah, if continuity is all you're concerned with then this an example of how I might approach it. Isolation is key, MCU and high voltages don't play well together. Detecting the prescence of 120vAC or 330v DC safely isn't so easy, you end up with big power resistors; this solution avoids too many large resistors by using a capacitive dropper. Here R6 & R7 are 1W and D4 is 5W, the other zeners are 1.5W. D6 is a 400v rated,1W bridge.

/HV_ON is low if 330v DC or 120v AC is detected. If not detected, MCU can put TEST high, turning on Q1 and if the test-pin has continuity to ground of <1k approx, /CONT will go low. An isolated 5v DC to 5v DC 1W supply is used to provide continuity test power and can drive approx 30 pins simultaneously. Note the HV side has a separate ground rail, GNDS. I'd keep them separate, but if you must, tie GND to GNDS at one physical location only. Q1 needs a BVds rating of > 400v and a Vgs(th) of <2v otherwise other parameters are not critical.

Thread Starter

#### 3Dirk

Joined Feb 18, 2014
10
Sorry I haven't gotten back sooner but trying to replace the relay with some sort of transistor wasn't working because of the possible 120VAC. But I think I've found it in the solid state relay below. Irving's solution looks very safe but I have a number of pins to test and the part count would go up pretty quickly. The machine I'm testing has low frequency signals in the 1V RMS range and they share GND with the 330VDC supply. But I am concerned about Irving's comments about HV, MCUs, and large resistors. So below is my next attempt using 1/2W resistors. Please let me know if you think this has a chance.

As I noted earlier, if HV is detected with the diode/divider circuit, the SSR will not be turned on to test the relay coil so the SSR must block 330VDC or 120VAC while off. Also there is no cap on the divider circuit because I'm comparing the phase of these AC peaks to an AC reference to determine which leg of AC I'm looking at.

#### drjohsmith

Joined Dec 13, 2021
541
Sorry I haven't gotten back sooner but trying to replace the relay with some sort of transistor wasn't working because of the possible 120VAC. But I think I've found it in the solid state relay below. Irving's solution looks very safe but I have a number of pins to test and the part count would go up pretty quickly. The machine I'm testing has low frequency signals in the 1V RMS range and they share GND with the 330VDC supply. But I am concerned about Irving's comments about HV, MCUs, and large resistors. So below is my next attempt using 1/2W resistors. Please let me know if you think this has a chance.
View attachment 276627

As I noted earlier, if HV is detected with the diode/divider circuit, the SSR will not be turned on to test the relay coil so the SSR must block 330VDC or 120VAC while off. Also there is no cap on the divider circuit because I'm comparing the phase of these AC peaks to an AC reference to determine which leg of AC I'm looking at.
I hope your not going to use this system on anyone but yourself
one resistor / track / wire failing to the 5k1 resistor will put 330 v dc on the chip !

It could certainly never be sold

#### Irving

Joined Jan 30, 2016
3,186
Irving's solution looks very safe but I have a number of pins to test and the part count would go up pretty quickly.
Although I very much prefer the safety aspect of full galvanic isolation, I accept your point. What you suggest will work but don't use a single 330k resistor, use at least 2 - I'd use 3 x 110k 1% so that the voltage across each is only 110v and ensure that appropiate spacing is maintained and/or board routing is applied.

#### Irving

Joined Jan 30, 2016
3,186
To follow on from @drjohsmith 's point, if this is going to have any sort of UI or connectivity onto other systems then you must isolate the MCU with appropriate galvanic isolation and power it from an isolated +5v supply rail. I would also delegate UI to a seperate MCU on the 'safe' side,

#### eetech00

Joined Jun 8, 2013
3,418
Sorry I haven't gotten back sooner but trying to replace the relay with some sort of transistor wasn't working because of the possible 120VAC. But I think I've found it in the solid state relay below. Irving's solution looks very safe but I have a number of pins to test and the part count would go up pretty quickly. The machine I'm testing has low frequency signals in the 1V RMS range and they share GND with the 330VDC supply. But I am concerned about Irving's comments about HV, MCUs, and large resistors. So below is my next attempt using 1/2W resistors. Please let me know if you think this has a chance.
View attachment 276627

As I noted earlier, if HV is detected with the diode/divider circuit, the SSR will not be turned on to test the relay coil so the SSR must block 330VDC or 120VAC while off. Also there is no cap on the divider circuit because I'm comparing the phase of these AC peaks to an AC reference to determine which leg of AC I'm looking at.
one important part of the “test pin” voltages you haven't shown is the DC grounds and AC return for the loads. Can you provide please.

Similar threads