I am building a clothes dryer circuit board. I have the following simpler/smaller schematic of the bigger circuit to highlight the problem(s) I am encountering.

Schematic of LTV844 connected to AC and Wemos D1 mini

I have hooked up the 48 V power supply in series with a 100 kΩ resistor and the LED side of the optocoupler and then the dryer door switch and finally to neutral.

The idea is that when the dryer door is opened, the 48 V power supply will stop providing power to the relay which is switching the heater coil.

My first problem is that the optocoupler U1 keeps fluctuating on the signal line D6 into the MCU. I have a pull-up resistor as well as internal pull-up on it, yet I keep getting a 0 or 1. The weird thing is that when I open the dryer door, I continue to get 0 or 1 continuously; it is not a stable high. What am I missing here? Isn't that how optocouplers are used to detect the presence of AC?

My second problem is that the second optocoupler U2 does not switch the PNP transistor to activate the relay coil during my testing. The idea was that I would take D1 low when the door is opened and thus switch off the relay for the 220 V heater circuit. And even if the door is closed back again, the user still has to press a push-to-start switch to restart the dryer (that is a separate circuit).

EDIT (added feedback and answer): I was already in the process of moving the optocoupler to read from the DC side of the power supply. I left the AC side directly connected to the door switch as suggested by @173919 and also later by @292884.

I still see a lot of fluctuations on D6 when the door is opened and even when the door is closed and I operate any other part of the dryer, like the PTS switch.

When the door is opened, the fluctuation continues. I have even added switch debouncing code but the fluctuations should die down after about a second if I leave the door open but it continues.

Here is the new schematic after I have made the change. I will definitely add the fuse later. Right now, my main concern is to get the input side of the HW interface stable and correct before I enable the output side. I have software flags in the MCU code to not signal on the output pins to control the relay transistors. I will remove them once the inputs are all predictable.

Here is the new schematic. I am not sure if I should remove the old schematic from the question.

New schematic after moving Optocoupler to read off of DC side of power supply

  • \$\begingroup\$ You really have the power input of the 60W psu going through 100 KOhm and the LEDs of the optocoupler? \$\endgroup\$
    – jonathanjo
    Commented Apr 1, 2023 at 4:13
  • \$\begingroup\$ I am sorry, I should probably fix that schematic. The power supply is actually a 20W unit VCE20US48. 48V, 0.42A. I forgot to rename it in Kicad. I couldn't find it in Kicad so I just used a representative psu and was going to rename it. But yeah, other than that correction, I do have all of those in series. \$\endgroup\$ Commented Apr 1, 2023 at 4:18
  • \$\begingroup\$ My question is really: why is the PSU in series with the optocoupler? What else does the PSU power apart from the relay? \$\endgroup\$
    – jonathanjo
    Commented Apr 1, 2023 at 4:20
  • \$\begingroup\$ The PSU powers two relays in parallel. This schematic is only for the heater relay. There is another relay for the dryer drum motor. Very similar circuit for that one too. \$\endgroup\$ Commented Apr 1, 2023 at 4:21
  • 1
    \$\begingroup\$ I understand the point of the optocoupler: why did you put it in series with the PSU. Normally you'd have the switch disconnect the PSU directly. You could then put the opto+resistor in parallel with the PSU input, or, much better, keep it away from the mains voltage altogether and put it on the DC side. Otherwise, you have all the current the PSU requires going through the LED of the opto. \$\endgroup\$
    – jonathanjo
    Commented Apr 1, 2023 at 4:37

1 Answer 1


There are several major flaws:

  1. R1 is in series with PS1. The power supply can't work properly (or at all) in this configuration. R1's current is unpredictable. Connect PS1 directly to mains live and neutral, and connect R1 directly to live.

  2. The output of optocoupler U1 will be pulsing at 100Hz or so, because its LEDs are being pulsed with AC. Add some capacitive smoothing there.

  3. R3 is too large. Insufficient LED current in U3 is causing its transistor to switch on too weakly to draw enough current from Q1's base. Lower R3.

  4. There's no diode to protect Q1 from the relay coil's back EMF. Add a diode. The fact that the relay never switched on may have saved Q1.

  5. No fuse. Use a fuse.

Here's the circuit I recommend:


simulate this circuit – Schematic created using CircuitLab

It would help to know the coil resistance, or rated coil current. If using the values shown, the relay still won't switch on, then reduce R4 until it does. Make sure R4 has a high enough power rating; \$P_{R4} \approx \frac{48^2}{R_4}\$

During each AC cycle, as opto-coupler transistor Q2 switches on, C1 charges almost immediately (via R2) to 3.3V, but when Q2 switches off again it must discharge much more slowly via R5. This means that the D1 signal remains low while AC is present, but will take about 0.1s when SW1 is opened.

This approach isn't necessary, as was pointed out in the comments. You could sense the door switch position on the DC side of the power supply (below left), even dispense with U1 altogether (right):


simulate this circuit


I don't think you should switch the 48V PSU (PS1) on and off each time the door is opened or closed. It should be "permanently" on, to avoid the extreme stresses that power cycling will impose.

Since one side of the door switch is connected to neutral, I assume the other must be connected to the lamp, which means that it goes between live potential (switch open) and neutral (switch closed). That's easy to sense:


simulate this circuit

Or, if you have access to the lamp terminals, sense the voltage across the lamp:


simulate this circuit

  • \$\begingroup\$ Thank you. I made some changes which you have suggested and also what @jonathanjo suggested earlier and edited my question because I could not see a way to add the new schematic. \$\endgroup\$ Commented Apr 2, 2023 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.