analogWrite accepts values from 0 to 255. ( not 1024)
thanks for information, I control firing TRIAC with program
Hello again,
You might start with the simplest of all tests, which is to make sure your circuit can turn the triac fully on and fully off by using a very long pulse of say 10 seconds on, then 10 seconds off. If that does not work, then nothing will work so you will have to troubleshoot and fix that first. Once this works you can move on to the more involved timing tests. An issue that may come up is that you need to use the right gate polarity depending on the actual triac being used.
Hii

yap, you're right
If your circuit is connected properly you should see this result no problem.
You can look at the pulse too as you have been doing to make sure it turns on at 90 degrees and 270 degrees.
This is a procedure which if successful will tell you that you are probably doing everything right. If not successful you'll most likely never get it to work with other delays, so troubleshoot the basic circuit first then.
Also note that you need at least some resistive load or else it may appear that the triac does not turn off correctly.
I'd like to see how well you make out with this, so please let me know how it goes.
ya, I tried to copy some circuit that I get in youtube, international journal, I replicated it. but the result still different. If I not bother you, can I get your tested circuit? I will make it in my simulation using proteus, if that different software, its OK. I will remake in proteus
I will message you the project progress later.
thanks
That is very silly the Arduino is running at 16MHz and half a mains cycle is 100Hz, so in half a mains cycle you can have 160,000 processor instructions. That is plenty fast enough and then some.
in topic 2 based my post #28.
in osciloscope, I try to convert half wave ADC (voltage and current input) to digital,
the green one is signal that define XOR between voltage and current by using bitwise XOR in my program,
the red one is same signal but using XOR component,
as we see that, the green frequency not same as input frequency,
that silly people said, we know that arduino hae 16Mhz its for couple pin like interrupt can do that, and unfortunatelly its only for digital. it can properly run in ADC pin.
and someone tell about post #48
can you explain about this?
To synchronize the program code to the zero crossing, you have to have a loop that waits until the zero crossing occurs. Use a while loop for this. What signal do you get on a zero crossing?

that must be yellow one, from voltage sensor, its from main trough step down transformator and comparator which is digital input.
If the current and voltage are out of phase then the triac might never turn off. That is why you have power correction to bring them into ( or close to ) in phase with each other. But don't start with an inductive load. Get your circuit to use first of all a resistive load like an incandescent light bulb.
Unfortunatelly, I used inductive load, since my purpose to correction bad power factor.
I used resistor and inductor component. since it just kinda prototype, so there I take sample.
No the waveforms look like that because they are not synchronized together and there is no triac firing which would cause the input waveform to collapse once it is conducting. In other words the top waveform is not measured at the correct place.
No idea for this one, I tried many reference. but dont work well for me, others do
I got design from here
application noteIs english your first language ?
And likely destroy your oscilloscope.
400 V on mine.
Can you provide a link to where you found this diagram ?
main voltage around 400 phase to phase, ya
its very dangerous
I decide to take double rubber glove next time.
Oscilosope using 10x magnitude, it can read that
there I got diagram
http://www.littelfuse.com/~/media/electronics/application_notes/switching_thyristors/littelfuse_thyristor_phase_control_using_thyristors_application_note.pdf.pdf