The Godfather talking
You think I am funny guy huh?
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 20, 2024, 12:23:23 12:23


Login with username, password and session length


Pages: [1]
Print
Author Topic: Project help needed. Phasemeter with microcontroller  (Read 3934 times)
0 Members and 1 Guest are viewing this topic.
canielsen
Inactive

Offline Offline

Posts: 2

Thank You
-Given: 3
-Receive: 2


« on: November 25, 2012, 01:09:10 01:09 »

Some times ago, i have designed and built a Phasemeter. On a voltmeter it can shows the phasedifference between two signals eg. input and output of a filter.
The meter can measure difference between -180° and 180°. responding to a output from the meter -1,80 V to 1,8 V
You can find the schematic on http://netload.in/datei8K0S6YmuSW/Phasemeter.pdf.htm
I use the meter for audio measurement.

Now i have got that idea, to make a new versison with a PIC microcontroller, with output to a standard 2X16 display ( Standard HD44780 display).
But i´m newbie to program PIC microcontrollers. So I need some help.
Any ideas how this can be done ?
Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 151
-Receive: 214


« Reply #1 on: November 25, 2012, 03:04:56 03:04 »

Not sure what help you need exactly but there are a lot of ways to do it.

Do you need help with coding?  Do you need help picking a processor?  Do you need help with an algorithm, with circuit design?

- You can sample complex waveforms and then use cross correlation to find the phase delay
- You can sample and look for zero crossings and calculate the delay between them
- Zero cross analog detection circuit coupling it's output into the capture/compare modules (probably requires an additional frequency counter input so you can calculate phase)

I'd imagine that unless you use some external analog tricks (like zero cross detection) the pure sample method won't have high enough sample rate to be very useful.  Most PICs won't go above a few hundred Ksps.  Though the newer DSPIC33E will go up to 1.1MHz sampling.

At max sample rate you need to be mindful of available processor time to execute whatever analysis you need to perform.

There ought to be libraries for the display pretty readily available.  You can probably find them in with microchip dev board demos
« Last Edit: November 25, 2012, 03:11:14 03:11 by Gallymimu » Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1823

Thank You
-Given: 655
-Receive: 900



« Reply #2 on: November 25, 2012, 03:22:58 03:22 »

Take your existing circuit, sum 1.8V to its +/- output via an op amp, feed that voltage into the ADC of the PIC as 0-3.6V.

Run a CLEAN 3.6V supply to the PIC's analog (ADC) power pin and 1024 (assuming 10 bit ADC) will be +180, 0 will be -180, 512 will be zero degrees. Do the math to interpolate the other ADC readings.

Then convert to ASCII characters or whatever your display wants to see.
Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 151
-Receive: 214


« Reply #3 on: November 25, 2012, 04:46:04 04:46 »

Take your existing circuit, sum 1.8V to its +/- output via an op amp, feed that voltage into the ADC of the PIC as 0-3.6V.

Run a CLEAN 3.6V supply to the PIC's analog (ADC) power pin and 1024 (assuming 10 bit ADC) will be +180, 0 will be -180, 512 will be zero degrees. Do the math to interpolate the other ADC readings.

Then convert to ASCII characters or whatever your display wants to see.

Yeah I was probably missing what he wanted.  He is probably wanting to just replace the multimeter portion of the system so this approach makes a lot of sense.

In that case you should be able to get away with any PIC with an A/D that has the bit resolution you need, and assuming  the phase delay you are measuring is fairly constant (as it would have to be for use with a multimeter).

I'm a fan of the PIC24H, F, or E series for something like this.  It's overkill but easy to work with.  If you want to be trim on resources then a 16F would certainly do the job.
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #4 on: November 25, 2012, 08:35:28 08:35 »

 I think a Multimeter is cheaper than a pic+LCD+pcb ... and other components. So, maybe canielsen want to do a new phase meter device with a complete new design.
 For this is not needed an AD conversion with a high sample rating (in AD conversion the main information is voltage amplitude), can be use comparator module for Zero crossing detection and an automatic counter trigger for start/stop counting. I am not sure but I think most microcontrollers have this functionality   
Logged
sarah90
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 7
-Receive: 11



« Reply #5 on: November 25, 2012, 10:47:17 10:47 »

The comparator is already in his design.  The circuit could be replaced from ic1b/ic1d onwards with a pic. Use interrupts to measure the time differences between the zero crossings. The lcd could display frequency and phase. Of course the circuit has to be modified to a single power rail, with the "zero" at mid voltage. Could be done for just 10 bucks.
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #6 on: November 25, 2012, 11:26:47 11:26 »

How can we use zero-crossing detection while the zero-crossing delay among the 3-phases is the same?
Logged
sarah90
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 7
-Receive: 11



« Reply #7 on: November 25, 2012, 12:23:32 12:23 »

Metal, I'm kinda missing your point. His device is measuring the phase between two signals not three.
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #8 on: November 25, 2012, 12:39:37 12:39 »

even if they are two signals
Logged
sarah90
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 7
-Receive: 11



« Reply #9 on: November 25, 2012, 12:50:06 12:50 »

Now I'm getting the point (I think). The comparator will notice the difference between falling and rising crossings. You will only look at one of them.
Logged
sarah90
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 7
-Receive: 11



« Reply #10 on: November 26, 2012, 06:02:28 18:02 »

It really depends on your own preferences. If you like pic, I would choose a pic18 device with enough pins for the lcd and at least 2 comparators.

The PIC18F25K20 could fit: http://www.microchip.com/wwwproducts/Devices.aspx?dDocName=en026333 It is cheap. Two and a half bucks at farnell.
Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 151
-Receive: 214


« Reply #11 on: November 26, 2012, 06:21:53 18:21 »

Nothing wrong with the PIC18 but I have been having a disappointing time with the XC8 compiler.  I'd go with the dspic33E or PIC24E, DSPIC33EP128MC202 or DSPIC33EP64GP502.  both are nice parts available in DIP packages for prototypes.

They run a little under $5 ea.
Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #12 on: November 26, 2012, 07:18:16 19:18 »

Gallymimu I think a dsPIC is to complex for a beginner(remap pins, interrupts priority, 16bits registers etc.) so, I propose pic16 or pic18 family.
Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 151
-Receive: 214


« Reply #13 on: November 26, 2012, 09:36:49 21:36 »

Gallymimu I think a dsPIC is to complex for a beginner(remap pins, interrupts priority, 16bits registers etc.) so, I propose pic16 or pic18 family.

good points.  All a matter of taste really.  Certainly the remappable pins, are great, but more of a pain to set up, though I think you can ignore the register size and interrupt priority stuff without issue, especially if you are using C, most of that stuff becomes transparent in the simple cases.

Setting up the rest of the hardware registers is definitely a pain on the bigger processors.  several dozen config bits for some peripherals.  So your point is well taken.
Logged
metal
Global Moderator
Hero Member
*****
Offline Offline

Posts: 2420

Thank You
-Given: 862
-Receive: 678


Top Topic Starter


« Reply #14 on: November 26, 2012, 10:02:39 22:02 »

Nothing wrong with the PIC18 but I have been having a disappointing time with the XC8 compiler.  I'd go with the dspic33E or PIC24E, DSPIC33EP128MC202 or DSPIC33EP64GP502.  both are nice parts available in DIP packages for prototypes.

They run a little under $5 ea.

You are fond of microchip's 16 bits ;- )
Lsn, PIC16 can do it, if not (out of resources, which I doubt), then go to PIC18. I think sarah90 is right, PIC18 is better, interrupts priority is better, PIC16 sucks in interrupt routines.
Logged
sarah90
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 7
-Receive: 11



« Reply #15 on: November 26, 2012, 10:28:23 22:28 »

A higher clock frequency may improve the phase measurement resolution. For accurate frequency measurement you should use a crystal or oscillator to clock the pic.
Logged
Gallymimu
Hero Member
*****
Offline Offline

Posts: 704

Thank You
-Given: 151
-Receive: 214


« Reply #16 on: November 27, 2012, 01:47:48 01:47 »

You are fond of microchip's 16 bits ;- )
Lsn, PIC16 can do it, if not (out of resources, which I doubt), then go to PIC18. I think sarah90 is right, PIC18 is better, interrupts priority is better, PIC16 sucks in interrupt routines.

guilty as charged Wink

I work primarily in low to medium volume so the extra horsepower and flexibility is always worth it for me.

I am working on a big 18F project right now and I am SOOOO unhappy with the XC8 compiler at it current state that I shudder at the thought of an 8 bit project.

It's too bad too because I always had good luck with the C18 compiler over the years but the merger of C18 with the HTC compiler is a mess in my opinion!

Admittedly I can also be a lazier programmer (and therefore have lower engineering cost to my customers) if I use a chip that is overkill!
Logged
Finzi
Newbie
*
Offline Offline

Posts: 18

Thank You
-Given: 22
-Receive: 23


« Reply #17 on: November 28, 2012, 12:43:41 00:43 »

Hi friends. Maybe i can help with the phase measurement problem. some time ago I published a paper about a low cost impedance measurement system used in Aircraft Structural Health Monitoring. To separate real and imaginary part of the impedance i had to measure the phase displacement between voltage excitation and current on the sensors. I have attached the paper.
I hope this help.
Logged
petroaguia
Newbie
*
Offline Offline

Posts: 23

Thank You
-Given: 26
-Receive: 5


« Reply #18 on: November 29, 2012, 12:23:01 00:23 »

Hi
If speed is ok for you: pic 16F886, AND mikroPascal or mikroC. I use to do alot of programs with mikroPascal and it´s very stable, no problems I could see
Logged
sarah90
Active Member
***
Offline Offline

Posts: 111

Thank You
-Given: 7
-Receive: 11



« Reply #19 on: November 29, 2012, 05:36:57 17:36 »

At farnell the PIC16F886 is more expensive than the PIC18F25K20. Has half the flash memory, is 70% slower and has a crappy architecture. Why would you advice the PIC16F886 over a PIC18 device?
Logged
Ichan
Hero Member
*****
Offline Offline

Posts: 833

Thank You
-Given: 312
-Receive: 392



WWW
« Reply #20 on: November 29, 2012, 06:19:03 18:19 »

Any PIC with 2 analog comparator + enough pins for lcd will do this, a well known but expensive 16F628A will work - many other newer and cheaper choice available.

Just replace the set-reset flip-flop circuit and the rest by the micro, feed the amplifier outputs to 2 analog comparator input but make sure the voltage level is keep below VCC of the micros. Setup the comparators and set both comparator to interrupt on comparator match, measure the time between the 2 interrupt, make some calculation and display it on lcd, done.

-ichan
Logged

There is Gray, not only Black or White.
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC