How would you measure Power factor with Microcontroller?

I know I have to measure the time between Voltage’s zero-crossing and Current’s zero-crossing, using the Timer Register… but I’m having trouble on the Current.
I used an optocoupler (4N35) and I’m getting a square wave that switches from 0 to 5V and 5V to 0, and so on (everytime Voltage = 0), so I don’t have a problem with the voltage.
But what to do with the Current? How can I get a clean wave of its zero-crossing to send it to the Microcontroller?

Most Battery elimanating circuts (bec)or even electronic speed controls (esc) in some cases. Most of them have signal level lines putting out analog interuptation of amps and volts.
You should have one of these keeping the brains of your project safe so your cpu board doesn’t get nosie power or brown outs from high drain items like motors in your projects sharing the same power source.
Try this one. … apmpwr.htm
Sorry Pololu I suspect they may have such devises.