0
\$\begingroup\$

Can someone see what's wrong here? My 50 W LED light doesn't shine.

Physical connection-board

Snubber-circuit

Here is my code from the Arduino IDE:

const int AC_LOAD_PIN = 2;        // Output to Opto Triac pin
const int ZERO_CROSS_PIN = 3;     // Pin connected to the zero-crossing detector
const int MIN_DIMMING = 5;        // Minimum dimming level
const int MAX_DIMMING = 128;      // Maximum dimming level (0-128), 0 = ON, 128 = OFF
const int TRIAC_DELAY = 10;       // Triac on propagation delay in microseconds (for 60Hz use 8.33)

volatile int dimming = MIN_DIMMING; // Initialize dimming level to the minimum value
const unsigned long dimmingDuration = 60000; // Dimming duration in milliseconds (1 minute)
const unsigned long loopDelay = dimmingDuration / (MAX_DIMMING - MIN_DIMMING);
volatile bool reachedMaxBrightness = false;

void setup() {
  pinMode(AC_LOAD_PIN, OUTPUT);    // Set AC Load pin as output
  pinMode(ZERO_CROSS_PIN, INPUT);  // Set zero-crossing detector pin as input
  attachInterrupt(digitalPinToInterrupt(ZERO_CROSS_PIN), zeroCrossingInterrupt, RISING); // Attach interrupt for zero crossing
}

// Interrupt function for zero crossing, takes no parameters and returns nothing
void zeroCrossingInterrupt() {
  if (!reachedMaxBrightness) {
    int dimTime = calculateDimTime();
    delayMicroseconds(dimTime);      // Wait until firing the TRIAC
    digitalWrite(AC_LOAD_PIN, HIGH); // Fire the TRIAC
    delayMicroseconds(TRIAC_DELAY);  // TRIAC on propagation delay
    digitalWrite(AC_LOAD_PIN, LOW);  // No longer trigger the TRIAC (the next zero crossing will switch it off)
  }
}

// Function to calculate the dim time based on dimming level
int calculateDimTime() {
  // Firing angle calculation: 1 full 50Hz wave = 1/50 = 20ms
  // Every zero crossing: (50Hz) -> 10ms (1/2 cycle)
  // For 60Hz => 8.33ms (10,000/120)
  // 10ms = 10,000us
  // (10,000us - 10us) / 128 = 75 (approx.) For 60Hz => 65

  return (82 * dimming); // For 60Hz => 65
}

void loop() {
for (int i = MIN_DIMMING; i <= MAX_DIMMING; i++) {
  dimming = i;
  delay(loopDelay);
}
for (int i = MAX_DIMMING; i >= MIN_DIMMING; i--) {
  dimming = i;
  delay(loopDelay);
}
  reachedMaxBrightness = true; // Set the flag to indicate maximum brightness is reached
  while (true); // Keep the loop running indefinitely to maintain full brightness
}

Here I have connected my oscilloscope to pin 3 on the Arduino. Or pin 5 on 4N25. Scope probe ground is connected to GND on Uno R3.

Pin 3 on Arduino Uno R3

Zoom: Zoom Pin 3

Here I have connected my oscilloscope to Pin 2 on Uno R3. Scope probe ground is connected to GND on Uno R3. This is before the 220 Ω resistor.

Pin 2 on Arduino Uno R3

Zoom: Zoom Pin 2

Here I have connected my oscilloscope to 1 Anode on MOC3020M. The voltage drops. Scope probe ground is connected to GND on Uno R3.

enter image description here

Zoom: Zoom 1 Anode MOC3020M

UPDATE 22.03.21

I have made a readable wiring diagram using CircuitLab. I have also used ChatGPT to modify my code, but the circuit behaves the same way, so I can eliminate a software issue. I have updated the software in this post.

Wiring-diagram

Here is a picture of my oscilloscope with all three channels active at the same time:

Scopx3

When I upload the software I have a multimeter connected to L and N on the LED. The LED start flashing immediately between approximatley 100-185 VAC.

UPDATE 23.03.21

Thanks for all help and answers, I have updated my circuit and schematic with the following changes:

  • R4 is replaced with a 180 Ω resistor
  • R5 is replaced with a 680 Ω resistor
  • Added a snubber circuit for the TRIAC with 0.1 μF capacitator and a 2,4 kΩ resistor

Updated schematic-drawing

So now my circuit is a little bit better: when I upload the code I measure approx. 140 VAC out to the LED, it flashes a lot. See picture below captured at startup:

startup

So I obviously still have a challenge with my circut. The ZCD part looks good to me, so I'm struggeling with this. Why is the TRIAC trigger signal (blue) from pin 2 so unstable?

Here is a picture at approx. 215 VAC: A end

So when i zoom in on the the pulses i can see that something is happening with the yellow ZCD-pulse between the 5V-peaks. Whatever it is that seems to be triggering the blue triac signal?

zoom noise

Here i have zoomed in at the noise? bewteen the 5V ZCD-pulses that seems to trigger the blue triac signal:

extra zoom noise

WORKING!!

I changed the 4N25 to EL817, and the circuit works fine! I tried several other 4N25 but then it is only flashing.

Wokring

\$\endgroup\$
27
  • 1
    \$\begingroup\$ What’s wrong? How is is supposed to work and what is observed? Please post oscillograms. \$\endgroup\$
    – winny
    Commented Mar 17, 2023 at 13:46
  • 4
    \$\begingroup\$ Are you really running 230VAC through a solderless breadboard? \$\endgroup\$
    – JRE
    Commented Mar 17, 2023 at 13:55
  • 2
    \$\begingroup\$ @Mickolini: Because solderless breadboards are generally only rated to low voltages (SELV.) There are exceptions, but in general they are not intended for use with line voltage. Then there's the whole safety aspect - you've got bare wires all over the place carrying 230VAC. \$\endgroup\$
    – JRE
    Commented Mar 17, 2023 at 15:30
  • 1
    \$\begingroup\$ It looks like you have a USB cable attached to the Arduino, which in turn has connections to your mains. It may be "safe" due to the 100k resistors to each side of mains (current limited to about 2 mA), but it would be best to disconnect the USB before powering your circuit. Also, show where your scope probe ground is connected when you show waveforms. \$\endgroup\$
    – PStechPaul
    Commented Mar 17, 2023 at 21:05
  • 1
    \$\begingroup\$ @Mickolini - The MOC3020 need 15-30mA to trigger. Your calculation is wrong. There is a IR-LED inside of the MOC Best case scenario: R=(5V - 1.15V) / 0.015A = 256 Ohm | Worst case scenario: R=(5V - 1.5V) / 0.030A = 116 Ohm | Data source: docs.rs-online.com/71ee/0900766b814e88cc.pdf You have to try with the low value and then increase the value till the MOC does not do his job any more. The MOC3023 only need less than 5mA. \$\endgroup\$
    – MikroPower
    Commented Mar 22, 2023 at 0:03

1 Answer 1

1
\$\begingroup\$

The MOC circuit is not right. Use this circuit for the MOC instead and be very carefully with the voltage. enter image description here Source: https://www.silicon-ark.co.uk/datasheets/moc3020-datasheet-motorola.pdf

Your oscilloscope is able to make pictures and store it on a USB-drive.

The MOC3063 is able to make this zero crossing by himself.

\$\endgroup\$
10
  • \$\begingroup\$ Thanks for the tip, will defenetly check out MOC3063. But i cant see why my MOC-circut is not right? I have connenced the same way exept for the extra resistors and capacitators. \$\endgroup\$
    – Mickolini
    Commented Mar 20, 2023 at 8:11
  • \$\begingroup\$ @Mickolini you have the MOC3020 connected between A1 and gate. It should go to A2 as shown above, and should have current limiting resistors. \$\endgroup\$
    – PStechPaul
    Commented Mar 20, 2023 at 21:47
  • \$\begingroup\$ @PStechPaul Good observation! I have switched connection on A1 and A2 so now it goes from A1 to the LED and from A2 phase L. I also have a current limiting resistor of 200kOhm between phase L and 6 on MOC3020. After this my LED flashes, good news! But i still can dim the light smooth, i have tried several codes. I can only change the intensity of the flashing.. \$\endgroup\$
    – Mickolini
    Commented Mar 21, 2023 at 7:39
  • \$\begingroup\$ @PStechPaul - What type of LED are you using? Some LEDs are not dimmable by design. \$\endgroup\$
    – MikroPower
    Commented Mar 21, 2023 at 21:14
  • \$\begingroup\$ @Mickolini The current limiting resistor should be around 500 to 800 ohms. Please update your schematic with the changes suggested. Preferably using CircuitLab. Also, how much current does your lamp load draw? There is minimum holding current for your triac. \$\endgroup\$
    – PStechPaul
    Commented Mar 21, 2023 at 21:23

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.