I am working on a project in which I need to monitor the current and if the current increased a particular value then switch off the device. the problem here I am facing is sensing ac current I have gone through sites but not able to get the logic. 1. if we are using ADC how it will be interfaced with microcontroller is the ADC available with microcontroller or separately we have to use. 2. can we use hall effect sensor if yes how. 3. if you have any other method kindly explain
You have a lot many options and choices to make here. Start by answering the following questions :
- What's the range of AC current you plan to measure?
- Do you need a true RMS sensing or would a rectified average be good enough? The later is good enough if you are sure the wave shape & frequency of the AC current is always going to be the same. In that case you could use a mathematical average to rms conversion after average sensing.
- Do you need isolation between the current you are sensing and the microcontroller ? Most probably yes!
- Hall effect sensor is a good solution, that typically provides an output voltage proportional to the instantaneous input current. It also provides isolation. But then you would need to sense the sensor's output voltage in uC/ADC and still perform RMS/average calculations. Can your uC handle the sampling and calculation overheads?
Once you have an answer to the above, you need to design the circuit block that would somehow convert the current to be sensed to a proportional voltage within the ADC range of the uC. Make sure that this block handles positive and negative currents both, while still generating only positive output voltage to be fed to the ADC.
After this, in uC software, you need to perform an RMS calcualtion as follows:
- Choose a sampling frequency. For example, if the AC current is 50Hz, you can choose a sampling frequency like 20kHz so that you have 400 samples per sine cycle.
- Next, have some sort of zero crossing detection circuitry in hardware. This should help you detect the start and end of a sine cycle.
- For all the samples within a sine cycle, performs the sample->square->accumulate operation.
- After every sine cycle (i.e. 400 samples in my example above), perform mean & square root operation.
And that's how you calculate AC RMS current!
I have tried measuring ac current using hall effect sensors too. And I am telling it is not as simple as it seems. Your first concern will be to find the peaks. You can use sampling as explained in a answer here. You need to store the read value of ADC to the peak variable until the next occurring value keeps exceeding the previous. Second concern will be noise filtering. You will have to implement offset settings before starting the measurement. It is up to you how you relate offset and measured value. Other method is filter design. Also, it will be helpful to take multiple iterations of the measurement cycle and calculate the mean/average. This will give you better measuring technique. But do not exceed the number of measurements. Be ready to change the averaging method. For e.g. when you are getting varying results like say, 5,10,7,6,8,1,1 the last two ones will contribute to a bad average or a lower average value which you don't want. So you'll discard anything below 4. Good luck. Please inform if this info was helpful or useless. :)
Hall Effect Sensor yes. You say you did Google, found this on first try. http://www.instructables.com/id/How-to-Measure-AC-Current-using-Hall-Effect-Sensor/