Go Down

Topic: Prototype PMU: measure phase difference of two sine waves using arduino (Read 1 time) previous topic - next topic

Grumpy_Mike

Quote
Is it possible to check the both signals simultaneously and read the time when both the signals are becoming non zero??
No.

DrDiettrich

It's possible, provided the controller has enough timers with time capture feature for two signals, and external zero-crossing detection is added. The benefits of such a solution are in the eye of the user.

Sudi

Okkk....then Please tell me what should I do if I want to do this project with as minimum external componenets as possible. What are the componenets I require and how to proceed further.

cattledog

Quote
Please tell me what should I do if I want to do this project with as minimum external componenets as possible. What are the componenets I require and how to proceed further.
Take a look at this AVR application note for how to perform zero cross detection without additional hardware if you can get your sine waves reduced to a safe current for the digital inputs.

http://www.atmel.com/Images/Atmel-2508-Zero-Cross-Detector_ApplicationNote_AVR182.pdf


DrDiettrich

The AN circuit requires that the controller is connected to mains Ground, and that this Ground is the same for all phases. A connection to other Grounds (USB, wall wart...) can disturb the signals.

sudiptakar484

Take a look at this AVR application note for how to perform zero cross detection without additional hardware if you can get your sine waves reduced to a safe current for the digital inputs.

http://www.atmel.com/Images/Atmel-2508-Zero-Cross-Detector_ApplicationNote_AVR182.pdf


this AVR application is using ATmega 163, can I use Atmega 328P for same purpose?

cattledog

Quote
this AVR application is using ATmega 163, can I use Atmega 328P for same purpose?
Yes

sudiptakar484

Yes
Are PD2 & PD3 pins equivalent to D2 & D3 pins of atmega328p? How to use two external interrupts at the same time?

Grumpy_Mike

The pinout of the AT163 and AT328 are identical.

What do you mean by the same time? If two interrupts happen simultaneously one ISR will have to wait until the other is finished before running

sudiptakar484

What do you mean by the same time? If two interrupts happen simultaneously one ISR will have to wait until the other is finished before running
As I have two signals, I want to give these inputs in two pins D2 & D3, is that alright? Now please tell me how to use ISRs to measure time differences between edges of two different signals.

As per the zero cross detector AVR application document, signals from ac main is directly given to PD2/EXT INT0 pin, but previously you told me to rectify and clip the voltage within 0-5V only as beyond that limit pins may get damaged. Which should I follow?

Grumpy_Mike

Quote
Now please tell me how to use ISRs to measure time differences between edges of two different signals.
ISR 1 - save the value given by millis() into a variable.
ISR 2 - subtract that variable from the value given by millis() save the result in an other variable. That value is the time between the two pulses.

cattledog

Quote
As per the zero cross detector AVR application document, signals from ac main is directly given to PD2/EXT INT0 pin, but previously you told me to rectify and clip the voltage within 0-5V only as beyond that limit pins may get damaged. Which should I follow?
The direct input requires series resistance on the input (1 Megohm recommended in the application note) to limit the current through the protection diodes to less than 1 ma or else the pins will be damaged.

The other considerations with this method are the lack of isolation of the high voltage from the board, the potential for noise on the high resistance input, and some slight timing issues for zero cross.

I personally would be using an optocoupler like the H11AA1 for zero cross detection, but you are the one insisting on "minimum external components".

Grumpy_Mike

Quote
As per the zero cross detector AVR application document,
That application note is only for people who know what they are doing, sudiptakar484 clearly doesn't. I don't think he appreciates the significance of:-
Quote
lack of isolation of the high voltage from the board

sudiptakar484

The other considerations with this method are the lack of isolation of the high voltage from the board, the potential for noise on the high resistance input, and some slight timing issues for zero cross.
yes I understand this above mentioned point, I will appreciate the technique of isolation using  optocoupler but problem is that I am not facilitated with all external equipment required.
I am not really aware of coding part of arduino and I am learning this part, so it will be helpful if I get some help related to this, Thank you

Grumpy_Mike

Quote
I am not really aware of coding part of arduino and I am learning this part, so it will be helpful if I get some help related to this,
So what was reply #40 then?

Go Up