Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] AC signal processing in PIC

Status
Not open for further replies.

denujith

Member level 5
Member level 5
Joined
Oct 5, 2010
Messages
85
Helped
6
Reputation
12
Reaction score
6
Trophy points
1,288
Activity points
1,886
I am processing an AC waveform using a PIC and I need to know when the signal crosses the point marked in red circle. Y axis is volts.
waveform.jpg
If someone can help me how to get this done, that would be great. Please let me know whether you need more information.

waveform.jpg
 
Last edited:

Use ADC and put condition like If ADC out = 0V for two cycle (or desired time )

Caution: Isolation Pic circuit from AC wave and convert to DC
 

As smijesh mentioned, that is exactly what you might do. But sometimes, this is one of the case where we overestimate the power of software on microcontrollers. Well depending on the frequency of your AM signal, you may be better off with an hardware demodulator, followed by a zero crossing detector. Unless your software has little other job to do apart from this ADC
You should probably state what pic you are using and the frequency of the carrier in your signal

Just say you have a carrier of about 100Hz. That's not too fast a frequency even for a midrange PIC
 
Objective:
is designing a synchronizer (connect a micro hydro plant with the grid) and I want to know when these two signals are in phase to close the breaker.

Plan:
was to get the difference between the signals and when it reaches 0 (as close as possible), it means that the signals are in phase. Resulting waveform of the difference is like the waveform I have attached to this thread already.

To implement above plan, I needed a way to know when it reaches this point.

I would have explained in detail in the first place. Is there a better way to achieve this?
 

Hey Denujith,

You should implement zero crossing detector in your hardware..
You will get many circuits in on the internet for that
I personally prefer PC814 based circuit
I hope you must be having proper isolation and signal attenuation before interfacing that high voltage to your microcontroller

According to me better idea is to have one digital input pin to detect zero crossing
and another analog input pin to get voltage level after proper attenuation
we must continuously sample the adc voltage and register peak voltage between two zero cross
then you can compare the successive peak
if your peak is less than you next as well as your previous peak that was the point you are looking for...
but this approach will not give you hard real time response
you will get that point with delay of one cycle (if it is accepted in your application)
Otherwise you have to set minimum threshold by trial and method and compare your peak value with that threshold
if it is less than your minimum threshold you can declare that as you desired point....
 
@denujith
Have you information about the original modulation of that signal, whether modulates just in amplitude, or also in phase ?
 

hello,

some PIC have internal thresholds and correspondant interrupt capability ..
so hardware allready include inside the PIC, and quick reactivity
by software you could define upper and lower threshold wich will activate special interrupt
if your minimum amplitude is inside this 2 threshold ..
even during a fixed time by a associated timer ..

is your average DC ampltitude (offset ) constante ?
 

Have you information about the original modulation of that signal, whether modulates just in amplitude, or also in phase ?

It is a resultant of addition of two 50 and 50.5 Hz Sin waves.
 

Plan:
was to get the difference between the signals and when it reaches 0 (as close as possible), it means that the signals are in phase. Resulting waveform of the difference is like the waveform I have attached to this thread already

How can a 50Hz and 50.5Hz signals be in phase.
And even if the frequency is equal, crossing zero point at the same time doesn't imlply being in phase either. Could be 180 out of phase.

Being in phase means the average of the difference will always be zero at all points, not just at a point.
 

Sounds to me as though you need a phase detector to compare the phases of the two signals rather than a zero-crossing detector (or similar).
Also you would probably need the phase comparator running all of the time to ensure that your generator stays 'in-phase' (depending on how it is implemented - I know there are systems that self-synchronise once they are on-line).
Susan
 

Hi,

The given signal is only true, when both signals exactely have the same amplitude.
Is this the case?

Klaus
 

The given signal is only true, when both signals exactely have the same amplitude.

Yes, both the voltages are equal.

- - - Updated - - -

How can a 50Hz and 50.5Hz signals be in phase.

Yes they are not in-phase all the time. Since frequencies are different, they will be in in-phase for a brief period of time. That's what I want to know. I want to know the time when these two signals are in-phase.
 

Hi,

Is it a synchronising tool?
Then i'd rather go to measure both signal independently.

Klaus
 

Hi,

Do you mean to measure voltages of the two signals at the same time and determine the phase angle using formula?

Yes, something like this.
Should it have a display, or is it a part of an regulation loop?

The output (leds, display, analog values...) what update rate do you want to achieve?

Is it a commercial product, or only for your own.?

Klaus
 

Is it a commercial product, or only for your own.?

One of my friends owns a micro hydro power plant and he is planning to connect it to the grid. I want to design a synchronizer.

'samson A.' suggested to have a hardware demodulator followed by a zero crossing detector and I think it might work.
 

Hi,

I want to design a synchronizer.

An automatic synchronizer, without display?
Or a synchronizer "display" for manual speed control?

Klaus
 

V, A and f meters are in the display. V and f is manually adjusted. Technically it is a 'Synchro Check Relay' which closes the breaker when V, f are equal and phase angle is zero. I need to find a way when the phase angle becomes zero.
 

I feel that I need to add a word of caution about what you are trying to do here.
Connecting anything directly to the grid has legal and safety as well as technical limitations associated with it. The grid is capable of pushing enough power into whatever you connect to it to destroy it, and possibly cause harm to people (electrocution) and property (fires etc.).
Please treat this as an academic exercise. If you do want to connect anything to the grid, then please check the local legislation and regulations around doing this and and get professional/certified advice to ensure that you have covered all electrical, technical, personal and property safety concerns.
Susan
 
Yes, I can understand/know the scale of what I am trying to do. There are all the risks as you have mentioned. As you said this will be an academic exercise and I am gathering all the things that can happen and all the things I have to consider when designing a synchronizer. Still I am months away before implementing the synchronizer.

I admire your advice with full respect. I have an electronic background but not related to grid stuff. Therefore, I need to be careful.

At first I will be using two standalone generators for testing.

Thank you!
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top