# Simple voltage presence monitoring with negative power supply

I am switching a 230-240 V load with a TRIAC and relay while also monitoring the presence of voltage on both ends of the load (i.e. not measuring the amplitude -- just that the switch successfully opened/closed). Previously, I had a positive power supply referenced to L2, and life was peachy.

simulate this circuit – Schematic created using CircuitLab

simulate this circuit

(The 'MON' signals drive a small P-FET that switches optoisolator LEDs.)

This is when the TRIAC -- SW1 -- was optically isolated from the drive circuit. Now, however, I'd like to move to a hot-side microcontroller to control SW1 directly, which means converting to a negative supply in order to (easily) drive the TRIAC in quadrants II and III.

simulate this circuit

This presents a challenge since the 5 V source will now have to sink current if the existing monitoring circuits are used. This source is a IRM-03-5 that is not rated to sink current like this, and simulations show the monitor circuit behavior breaking down if an inline diode is placed at its output.

Is there a simple circuit that would accomplish this presence monitoring given the negative supply? Its output isn't too important -- either a pulse train, high, or low -- as long as it is differentiated between the phase being on or off.

Note: I also found an ST app note about driving TRIACs in QII and QIII with a positive supply, but would like to exhaust my options with a negative supply first.

I found an app note AN467 from NXP that details how to drive TRIACs with a microcontroller, and it provides one solution: simply connecting the signal to a hot-side microcontroller's input pin through a high-value resistance, relying on the internal clamping diodes of the microcontroller for protection.

This solution requires a bit of hardware architecture reconfiguration -- implementing a hot-side microcontroller for presence detection instead of driving an optoisolator -- but it seems to be a more straight-forward way of controlling TRIACs and detecting mains presence than using oodles of optos.

Here is the simulation schematic in LTspice:

The L1 monitor output:

(See the next simulation output for l2_sw waveform.) The DC value when the L1 switch is on reaches ~2.75 V -- enough to trigger a high state on a microcontroller's GPIO (else the 2 Meg input resistance can be lowered to increase this value). When the L1 switch is off but the L2 switch is on we get an oscillating input that can be filtered out by software. The capacitor C2 just smooths the ripple on the monitor signal when both L1 and L2 switches are on.

The L2 monitor output:

Monitoring the L2 switch is a bit easier since its signal oscillates symmetrically at mains frequency when on. The DC signal present when the L1 switch is on but the L2 switch is off can also be filtered out by software.