0
\$\begingroup\$

I'm trying to make a circuit that can output an 80 Hz PWM signal. I'm planning to use an Arduino to switch an optocoupler that will control the duty cycle.

Here is my circuit:

enter image description here

After building the circuit, I used a multimeter to measure the output voltage and frequency. The voltage was 11.5 V and the frequency was 0 Hz.

I also changed R1 and R2 to 1 Mohm resistors. The output voltage was 3.64 V and output frequency was 79.41 Hz.

My questions are:

  1. Why is the multimeter showing a different result with different resistance? In my understanding, it should provide a constant voltage and frequency with different resistance.

  2. Is MOC3032M suitable to control a DC PWM signal? If not, is there any optocoupler suitable for the task? After doing some research, I realize the zero crossing detection in my optocoupler could interfere with DC signal every time it got turned on and off, but I couldn't find a detailed explanation of this topic.

Here is my Arduino code if it helps.

    int relayPin = 8; // Assign the relay to digital pin 8
    
    void setup() {
      pinMode(relayPin, OUTPUT); // Set the relay pin as an output
    }
    
    void loop() {
      digitalWrite(relayPin, HIGH); // Turn the relay on
      delayMicroseconds(3750); // On time: 30% of 12.5 ms (80 Hz cycle)
    
      digitalWrite(relayPin, LOW); // Turn the relay off
    
      delayMicroseconds(8750); // Off time: 70% of 12.5 ms
    }

Here is the MOC3032M datasheet.

\$\endgroup\$
1
  • 2
    \$\begingroup\$ Triac is not used as DC switch. Use optotransistor. \$\endgroup\$
    – user263983
    Jan 18 at 2:04

1 Answer 1

3
\$\begingroup\$

The MOC3023M is most unsuitable for your project. It has a TRIAC output stage which is designed for AC supplies and, to complicate further, it has zero-cross switching. I have written a little about these on Opto-triacs and zero-cross detection.

enter image description here

Figure 1. Internals of a zero-cross detection circuit based on the similar G3MB-202P with 5 V input.

TRIACs have the characteristic that, once switched on, they stay on until the current through the TRIAC falls below the hold-on value. (That means something external to the TRIAC is required to turn it off. Usually that's the zero-crossing of the mains voltage.)

For your application you need an opto-isolator with a transistor output.

\$\endgroup\$

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.