Converting dimmable 24VAC to LED

Hello this has been a long journey trying to convert 24-27VAC Dual SCR triac to LED. I have come up with a circuit that works except the audrino is powered by USB which wont work in production. I assumed I would get 5V output from pin 5 of 4N25 but instead I get opposite voltage (more brightness = 1.1mV, 10% brightness = 10mV) but no 5V,

The circuit below rectifies AC, triggers octocoupler, which triggers interrupt on audrino, which then does PWM out to a mosfet which switches a constant current LED driver. This circuit does work except dont know if its good/efficient, and still need to power audrino

You have the wiring of U1 and R2 wrong.

You need a switchmode "buck" converter to derive the 5 V for the Nano.

D5 would only be necessary for an inductive load, in which case a 1N4007 is incorrect for PWM. (You would need a fast recovery diode.)

HI, @drdreamnyc
Welcome to the forum.
Your schematic needs to look like this;

Tom... :grinning: :+1: :coffee: :australia:

Hey! Thanks! I tried that, but for some reason Audrino doesn't power up, multimeter reads 4.75V, but the dimming, it goes down to 1V so I think I do need buck converter which I dont know how to build haha

Buy one.
Google "LM2596 DCDC Buck Converter Stepdown Power Module 3A Adjustable Buck Regulator Blue"

Production? Best to get a design review first which would raise some significant issues:

  1. Why opto-couplers? Isolation is not required and certainly not a good choice for driving a mosfet.

  2. Unexplainable choice of a mosfet. Using a 2 ohm Rds device rated at 600 volts would suggest this is an internet copy of some other device not suited to your specific purpose.

Could we please start with a datasheet for L1? Without knowing what you’re trying to control, we cannot provide anything other than pointing out the obvious mistakes as has already been done.

Thanks @WattsThat for your comments. I am new to this, the first Octocoupler is because it gave clear zero crossings with much less EMI or noise, I had 2nd octo because when trying to connect the grounds together i got unexpected behavior on the breadboard.. Now I think I realize that it was getting two voltages (one from USB and one from 24VAC). Now I have eliminated one.

Yes for the mosfet above I found schematic on internet but would replace the parts during BOM review.

Now I have boost converter circuit that works on its own, and 5V regulator/zero cross detector that works on its own.. When I try to combine them in LTSpice, the simulation starts but I see no black window.. I dont know whats wrong since they seem to work independantly. I eliminated the mosfet for now as this circuit should illuminate the led at 60Hz, the final version will use audrino to modulate the led at 900hz


DimmerToLed.asc..zip (28.9 KB)

I believe you mean OPTOcoupler (as in "OPTICAL COUPLER)"
(never heard of an OCTO coupler but maybe it has something to do with horney
octopi)