Go Down

Topic: Calculating Power Factor Using ARDUINO UNO (Read 9995 times) previous topic - next topic



I am new in ARDUINO field. Can somebody please help me with the code to find power factor ?

James C4S

That's a pretty common calculation.  Why are you looking for something specific to Arduino?
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com


Power factor ? What is that ?
Does it have to do with the mains ? Perhaps you can find information at the openenergymonitor site : http://openenergymonitor.org/emon/



a little more info, please. What is your project? Give specifics if possible, and we can help with the code!


Of what?

could you please share with me arduino uno programming for calculating power factor........ input to the arduino will be current zero crossing and voltage zero crossing ( for this i use the zero crossing detector)....... both are square wave and have zero and one(e.g 5v). my load is three phase induction motor and i am working on single phase and control the rest of two with them.


If you know the delay between zero crossings of current and voltage you need only convert delay to phase difference in degrees or radians to calculate the power factor.


i have problem for finding power factor from zero crossing circuit through arduino i have achieve the voltage and the current signal through zero crossing detector now the problem is to calculate the delay between these two signal and calculate power factor from them
pleas help me in this programing


Dec 06, 2014, 05:19 pm Last Edit: Dec 06, 2014, 05:28 pm by gremlinc5
Um, I think you need a Fast Timer to understand Phase shift, if you want a PF with 0.01 precision your timer will need 50Hz of main * 100 = 5 kHz.

In that timer you will increase a phase shift variable.

With the square voltage cross you will activate an interrupt that put to zero the phase shift variable for next evaluation.

With the square current cross you will activate an interrupt that evaluate the PF.

With 50 Hz main you will get a 100 max value.
I think this is the phase shift so needs to be normalized to radians: (pi)*(phase_shift/100)

EDITED: you need (pi) and not (2pi) because you are using a zero crossing detector without knowing if that voltage or current is a positive or negative value

After calculate PF as cos(value_normalized)

Some suggestion? I hope it helps, if you are using it on a motor :)


Hello.. I am new for arduino uno microcontroller. I am working on power factor correction of single phase inductive load. I need a code for power factor calculation, I am using zcd circuit for voltage and current.


timings gives you all you need to calculate the phase difference in radians, power factor is cos(phase_delay).
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Hello sir actually i am working on TCR(Thyristor controlled reactor) so that i am also using peak detector   to sense 90 degree bcz in TCR SCR will conduct in 90 to 180 nd 270-360 interval. so my question is that can i use 2 ZCD and 1 peak detector with arduino uno microcontroller...??

Also in this case when my load will pure inductive at that time my current wave will be not pure sine wave so at that time zcd's result would be wrong..!!

give me a suitable suggetions


Then you need to sample at a high rate and sum up the power and calculate total power, rms
current and rms voltage.  power factor = true_power / (rms current x rms voltage)
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


Thanks for your suggetion. bt In my project i am getting both the value of Vrms and Irms by using voltage and current sensing circuits but what about True power..?? How can i find it..??
 Can you give me some coding of it..?


i want to calculate the power factor using ardino.i need the code for this.

Go Up