determination cos phi (phase between current and voltage )

good morning
my project is to determination cos phi (phase between current and voltage ) with arduino.
can you help me plz

What, exactly, are you measuring now?

i will mesured the current and voltage

If the current and voltage are at 60 Hz, this is fairly easy. Take samples of the voltage and the current (600 samples per second would be a good starting point) and measure the difference in time between the maximum voltage and the maximum current. (Zero crossings would work also and might have more accuracy one they are linearly interpolated but you have to work out whether the slope of the zero crossings are positive or negative).

At 60 Hz, 16.667 milliseconds is equivalent to 360 degrees or 2*PI radians. Anything less (down to zero milliseconds) is linearly proportional. A floating point version of the map(...) function would be helpful, or you can just multiply everything by 1,000 or 10,000 and use the map(...) function. The map(...) function is so trivial, I would be tempted to just make the floating point calculation in the code.

This will give you phi in degrees or radians. The Arduino can easily calculate cos(phi) once phi is converted to radians.

If the frequency is unknown, you have a bigger problem to solve. You will have to:

  1. Figure out the frequency or the period.
  2. Use the time of the period to figure out how many degrees.

Is this for homework? My undergraduate college degree is in Electrical Engineering. How much credit do I get?