Proposed circuit to detect Mains AC and High Voltage DC with a Microcontroller

Thread Starter

3Dirk

Joined Feb 18, 2014
10
I'm attempting to design a universal remote controller to replace several other non-universal ones that are currently being used to control several different machines. These machines all do the same thing but are wired differently. Unfortunately if you don't make the correct controller/machine combination, the best case is they won't work, the worst case is you WILL burn sh_t up. To complicate matters further, the connectors on the single cable between all controllers and machines are identical! Therefore a circuit in the universal controller must make tests on some of the machine connector pins before routing to them.

Since this is my first time dealing with Mains and High Voltage, it was pointed out to me that the MCU based circuit I came up with was unsafe and problematic. One modification suggested by @Irving because of HV, was to replace a single resistor with several ... 1) 300k -> 3) 100k's.

1664227904197.png

The schematic shows a single pin connection between the universal remote and a machine. Another pin not shown connects GND between the two and the SSR (K1) is initially open restricting the input pin to F1, C1, and the triac circuit. One of the triacs is connected to the Hot leg of AC and the other to Neutral therefore if the input pin is the Hot AC line, triac D6 will turn on via optocoupler U2 and pull down D10 on the MCU. D5, U1, and D11 will operate similarly if the pin is Neutral. Note that K1 will not turn on if D10 OR D11 is low.

So if D10 AND D11 are both high, no AC is present and the MCU will turn K1 on. If 330VDC is present, it will be blocked from the triacs by C1 and routed to an ADC pin on the MCU via D2 and the dividing resistors. If 330VDC is not present and as previously determined, no AC is present, the MCU will turn on Q1 and if a relay coil is present, send current through pot RV1, blocking diode D1, and the relay coil to GND. The wiper of RV1 is connected to an ADC pin so the MCU can determine the coil resistance.

There are probably isolation issues I haven't addressed, or maybe things (like F1?) that aren't necessary. If you have any comments or suggestions that could improve the circuit or make it safer, please let me know!
 

eetech00

Joined Jun 8, 2013
3,951
Here's a circuit to consider for AC H or N test.

The circuits shown in the dashed box represent the Logic performed by the MCU and are only there for discussion purposes.
There is a clear isolation boundry shown by a verticle dashed line. Line hot or Line Neutral is switched by SSR's under control of the MCU. Each SSR has 1NO and 1NC contact. The SSRs are arranged so that only one test (LH or LN) can be performed at time. The opto LEDs light during either the pos or neg half cycle, and that information is used to trigger the D-flip flops. One FF will trigger before the other based on the phase of the AC Line detected at the test PIN. If Q1 is high, then the test pin is connected to LH, if Q2 is high, then the test pin is connected to LN. I'm not sure about using the PC817 with 120VAC so that will need to be verified.

I haven't tested any of this (it works in the LTspice simulator) so if you decide to try it be sure to HW test first.

1664325204316.png
 
Top