I am beginner of the arduino. I am doing some power factor improvement project by arduino. There is one problem which is killing me out. I have sampled, analog voltage signal by offsetting it by certain dc voltage level and I have successfully reproduced the alternating voltage signal inside arduino.In my project I have to find out the zero crossing of the signal and provide pulse( about 1ms) to drive optocoupler to trigger the TRIAC. If I just use delay command together with digital write my sampling gets affected and I will not be able to calculate the Vrms of the signal. What should I do?? please help me out.
please help me out.
You need a zero crossing detector made by sending the AC signal to trigger the LED of another opto isolator, the output should edge trigger an interrupt and the interrupt service routine will do the delay and then pulse the original opto isolator.
Thanks for your reply, and sorry for your inconvenience.
Actually I detected zero crossing and generated pulse about 1ms. Problem about my project is that I have to continuously monitor voltage signal(to calculate rms value of voltage)and also generate pulse in zero crossing. If i wait for 1 ms my data gets affected and deviates from true value. So I just want to know if there is any background working internal interrupt from which I do not have to wait for 1ms of pulse duration.
I detected zero crossing and generated pulse about 1ms.
So you set the interrupt to trigger off the rising edge of the pulse, you don't need the pulse to finish, there is no delay.
I have to continuously monitor voltage signal(to calculate rms value of voltage)
Are we talking about a sin wave or do you actually need to take all those measurements and do the calculations? If it is a sin wave then you can take the peak reading with a peak detector and work out the RMS from that.