You can use H11AA1 optocoupler to execute a concept of Zero Crossing Detection. It will turn on the phototransistor for every half cycle of the main AC signal. By detecting this signal using an MCU such as Arduino, we can find the frequency of the signal. Here is a simple workout of Arduino code for zero cross detection.
#define ZCD 2
#define LED_PIN 13
volatile byte counter=0;
if( counter == 60)
The program is developed for blinking an LED once for every half of a second.You can develop this program further according to your requirement.
As per chris'suggestion, I have tried to expand my answer for detailing. Here is the circuit of Arduino and H11AA1 for zero cross detecting. What I have made here is, simply connecting an output of optocoupler to the Arduino's interrupt pin which will sense an output from optocoupler for every zero-cross detection of the input supply. Then, interruption is requested to the controller and controller will stop other activity and call's the function 'zerocrossing' in the program. Then the function increments the counter value and blink an LED if the value reaches 60. Since, for a single AC cycle, two zero crossing events happens, LED will blink for every half of a second. You can print the counter value in a serial monitor to see the frequency value. I have developed the program by assuming that the frequency value is 60Hz.