# Power System Frequency Determination Using Arduino

25,851

26

6

## Introduction: Power System Frequency Determination Using Arduino

Introduction

AC power is generally distributed at 50 or 60 Hz.This project aims to "Calculate the live ac power system frequency using Arduino" kit and small transformer ckt setup. This project is build by our team Utsav, Venkat , Abhishek and I under Dr. S. R. Bhide.

Download Links

I have shared the details of the project on my Google Drive .
A quick Presentation on the project can be found here . (Download the presentation to see the animations.)

The problem

The live power signal consists of a voltage with magnitude of 230 V (or 110 V : this varies from country to country) and a frequency of 50 Hz (or 60Hz). Our aim is to measure this frequency accurately using the Arduino kit. The voltage rating of the microcontroller of Arduino is 5 V. So, any signal having amplitude of more than 5V can damage the microcontroller.
Thus, problem faced here is very clear that we have somehow convert the 230V power system supply to 0-5V so that Arduino can successfully analyze the sine wave provided by the supply. Another major obstacle is that Arduino cannot read negative signals. So, considering that we have to process the signal to calculate its frequency.

The approach

In order to measure the frequency of the power signal of such a high magnitude, the amplitude needs to be brought down to a lower magnitude so that the signal can be
fed to the microcontroller. However the frequency is kept unaffected. This can be done in the following steps:
1. Using a 230V/6V step down transformer, the voltage is first brought down to 6V.
2. Now, using a potentiometer the voltage is adjusted to 3V rms value (Vp-p = 3âˆš2 â‰ˆ 4.25 < 5V).
3. This signal is now fed to one of the analog pins of the microcontroller.
Now we have been successful in giving the modified signal to one of the analog pins of the micro-controller.

Arduino Software/Code

1. A set of continuous 250 samples of the voltage is taken in from the analog pin and stored in the microcontroller.
2. The time taken to read these 250 samples is calculated.
3. Now, the time taken to read one analog value of the input signal is the ratio of the total time taken to read 250 samples to 250.
4. It takes 28 milliseconds to take 250 samples. So, for one sample it takes 28/250 = 0.112 msec.
5. Thus, time taken to read one analog value is the sampling time interval of the inbuilt ADC of the microcontroller and it is calculated to be 0.112 msec.
Frequency calculation
It must be noted that the Arduino is unable to read one half cycle of the input AC signal i.e. the negative half wave and assumes it be zero.
So, when we observe the samples, it can be seen that we get a set of readings for which the value remains zero and then the value starts rising from zero to the peak
value of the input signal and then steadily gets back to zero and remains zero for some time. This cycle keeps on repeating.
Now we set up a counter at zero. We now start reading the voltage samples and the counter starts when the first non-zero sample is detected after zero value signals.
The counter stops when the next zero value signal is detected. It is mandatory to know that each sample is read at a time interval of 1 msec.
The frequency is now calculated:
Frequency (f) = 1000/ (2*k*0.112) … where k is the value of the counter.
Execution of the method
After the above mentioned tasks are accomplished, it is now time to carry out the method. Firstly, the power signal is fed to a step down transformer and the output is
adjusted to 3V using a potentiometer. The signal is now given to one of the analog pins of the micro-controller (analog pin A0 in this case).
Since the Arduino kit is interfaced with the computer, we can run the serial monitor of the Arduino software and see the calculated frequency.
The more details of the entire project can be found in the detailed project report (other improved methods are also discussed) where as just the description
on arduino part of the project can be found in the two writeups. Arduino code used is also attached.

This work is licensed under a Creative Commons Attribution 3.0 Unported License. Participated in the
Pocket Sized Electronics Participated in the
Arduino Contest

## 6 Comments

i know that this is an old post but i'll answer in case another reader had the same question

as simple as possible and without over explanation

you need your peak-to-peak voltage bellow 5v so you don't fry your arduino

and you can do that by adjusting a pot so when u measure your voltage it gives you 3v (rms) because since it's a sin wave

3 rms = 3 x 1.414 = 4.24 Vp-p