View previous topic :: View next topic |
Author |
Message |
caishenbao
Joined: 04 Apr 2012 Posts: 10
|
Convert Current waveform |
Posted: Wed Apr 04, 2012 10:43 am |
|
|
Hi all,
I am doing a project which I intend to convert a current waveform to frequency domain, so that I can analysis from it and take the appropriate action.
I plan to use pic 16f877a and compile with MPlab.
I am beginner in this field and am not able to program it.
Hope to get a good news.
TQ |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9172 Location: Greensville,Ontario
|
|
Posted: Wed Apr 04, 2012 12:59 pm |
|
|
first off...that PIC isn't noted for being a speed freak...though you don't give us any details as to the 'current waveform' or 'frequency domain' that you want.
An example of the math involve would be usful.
also is this an AC current or DC current ? PICs only have DC input ADC.
we need a LOT more information to help you. |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Wed Apr 04, 2012 1:31 pm |
|
|
Post a SCHEMATIC of the circuit you plan to use.
That would be very helpful -
as would specs for the expected amplitude range of the current -
AC/or DC - IF isolation for SAFETY is required.
just for a start |
|
![](templates/subSilver/images/spacer.gif) |
caishenbao
Joined: 04 Apr 2012 Posts: 10
|
|
Posted: Wed Apr 04, 2012 8:42 pm |
|
|
Hi, first of all, thanks for the reply.
I do understand is not easy to start with the controller, but I got to do something else I won't be able to pass my degree.
The current that i tend to recognize is an AC current [to be specific is arc current with flat shoulder at every half cycle (for a resistive load)]
the range i predefine will be 0-1A.
>asmboy: I don't really have a schematic for this yet to be frank, but i am using a Current transformer to obtain the current from the AC line, so the isolation problem should be solved.
TQ everyone |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9172 Location: Greensville,Ontario
|
|
Posted: Thu Apr 05, 2012 5:27 am |
|
|
Well you've picked a project with some very serious challenges!! Cutting the code will only be 1/2 the battle. Being able to read what I assume to be some type of ARC welder current will be a huge undertaking.All sorts of EMI, noisey waveforms,ghost ground currents,interference from ??...the list is very long.
1st Q. Is the welder a 50/60Hz transformer type of a newer 'inverter' technology?
2nd Q. Do you already have the 1A current sense output? If so what is the voltage output is? Is it isolated?
3rd Q. How much time do you really have for the project? When's the due date.
A project of this type could easily take 4-6 man-months. |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Apr 05, 2012 7:48 am |
|
|
Quote: |
using a Current transformer to obtain the current from the AC line,
|
since you seem to be saying a goal is to interpret harmonics and load related sine distortions , captured from line current - you should understand that
the PIC's limitations in the time domain are only part of your problem.
Unless it is an AIR core , wide band type, the frequency response curve of most ferrite or iron core current sense transformers is not awfully smooth or
of much use beyond the first few orders of harmonics. |
|
![](templates/subSilver/images/spacer.gif) |
caishenbao
Joined: 04 Apr 2012 Posts: 10
|
|
Posted: Thu Apr 05, 2012 8:07 am |
|
|
>Temtronic: Not really, is not a arc welder current, is like a current flow when there is arcing fault in the circuit. something in this link
http://www.zlan.com/testing/arc2.gif
There is a flat shoulder when it cross 0, and what i plan to do is to recognize the flat shoulder
1) No
2) Not really, i try to create one now
3) I leave about a month actually, due on end of this month
>asmboy: Yea, you are right... to interrupt the circuit when there is fault.
I wish the problem you stated about the current transformer won't appear later.. I not really try on my current transformer yet.. |
|
![](templates/subSilver/images/spacer.gif) |
temtronic
Joined: 01 Jul 2010 Posts: 9172 Location: Greensville,Ontario
|
|
Posted: Thu Apr 05, 2012 8:22 am |
|
|
Pictures really are worth 1,000 words!
If all you need to do is recognize the zero cross, that's far simpler than my interuptation of your orginal post.
Simply cut code to capture when the zero cross occours, and keep reading the input for say 10ms. If always 'low' then a fault has occoured.
The 10ms should be replaced with what you know to be the pulse width that is deemed to be a fault.
You haven't said what voltages are used, but you should use a zero cross optocoupler for your sensor, making the circuit safe and simple.
If this is the scope of the project, it could be done in 1-2 days. |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Apr 05, 2012 8:25 am |
|
|
This may well be doable but it is not going to be a trivial undertaking, since you will need to bias the ADC to say half scale and THEN look for specific ranges of NON sine value samples - I think it actually can be done at either 50 or 60 hz - but it will be challenging programming. If I was to write the program, at my level of skill today, I would surely allow a month to get it working. Access to a TEST signal source would be essential however.
This is not an easy task you have chosen. |
|
![](templates/subSilver/images/spacer.gif) |
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Apr 05, 2012 9:15 am |
|
|
We need LOTS more information.
Have you got waveform samples for both faulty and non-faulty conditions?
How many harmonics do you REALLY need?
How fast does the response have to be?
Mike |
|
![](templates/subSilver/images/spacer.gif) |
caishenbao
Joined: 04 Apr 2012 Posts: 10
|
|
Posted: Thu Apr 05, 2012 10:19 am |
|
|
>Temtronic:
Yea, I try to work on that way as well, hopefully it can be done as expected.
The voltage level of the primary circuit would be 240V AC, but I use a current transformer to obtain the current waveform from the network, so I think voltage range won't be a problem for my MCU part later.
What I am concerning now will be how can I actually transform the output of the current transformer to be read by the ADC input of MCU.
>asmboy:
Yea, is not as easy as what I thought of when I pickup the topic. It might take me year to do it. I am getting a friend of mine to help out for the coding, as I not really sure about programming for MCU. Hopefully everything goes fine.
>Mike Walne:
My idea will be if faulty condition, it will look alike from what i posted just now. And non-faulty condition will just a simple sine wave or normal current waveform.
I am ignoring about the harmonics and response time. I am focusing on developing an idea as simple as I can.. To just get it done~ |
|
![](templates/subSilver/images/spacer.gif) |
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Apr 05, 2012 10:43 am |
|
|
Quote: |
What I am concerning now will be how can I actually transform the output of the current transformer to be read by the ADC input of MCU.
|
You may be able to get away with something as simple as this:-
Code: |
Rin
AC ------/\/\/\------------------ PIC Input
from TX |
|
|
+5v -----/\/\/\-------/\/\/\-----
Rbu Rbl |
--- 0V Ground
|
Select Rin, Rbu, Rbl to give Vref/2 when input is zero, and 0 to Vref for full range of voltages from TX.
At worst you may have to use an OPA to get a large enough signal.
Is the waveform you showed the input or output from your current transformer?
Quote: |
I am ignoring about the harmonics and response time. I am focusing on developing an idea as simple as I can.. To just get it done~
|
What I was leading to is this. Can you identify a simple waveform feature which distinguishes faulty condition from non-faulty? In that case you then home in on that feature.
Mike |
|
![](templates/subSilver/images/spacer.gif) |
caishenbao
Joined: 04 Apr 2012 Posts: 10
|
|
Posted: Thu Apr 05, 2012 11:41 am |
|
|
I am considering using a shunt resistor to convert it to voltage, and then use a rectifier circuit to convert it to DC voltage.
Is that possible? (as mentioned by temtronic, ADC port of MCU only recognize DC value).
Yea, the waveform I shown is expected waveform from the CT, which I define it as fault condition of an arcing fault.
I predefine quite a number of things to make it seen to be work, ie the current waveform of an arc fault. |
|
![](templates/subSilver/images/spacer.gif) |
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Thu Apr 05, 2012 12:15 pm |
|
|
MIKES bias circuit is the way to go - and is CLOSE to what i would do too.
( adding an active sampling precision DC restorer comes to mind ).
I WOULD add a blocking capacitor to the AC input to prevent possible DC saturation of the transformer.
That way your Waveform samples are centered around an solid reference point.
Lastly - if done right 8 bit ADC resolution might be ok
and very very FAST && EZ to process compared to 10 or 12 bits
on other pics. |
|
![](templates/subSilver/images/spacer.gif) |
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Thu Apr 05, 2012 3:04 pm |
|
|
You did not answer my question about the waveform shown. Was it on the primary or secondary of a REAL current transformer?
You appear to be hazy about how current transformers work.
(1) Assume a primary current I.
(2) A small number of turns on the primary, say 1.
(3) A large number of turns on the secondary, say N.
(4) Assuming a perfect transformer, secondary current = I / N.
(5) Pass the secondary current through a burden resistor, say R.
(6) The current through the resistor creates a voltage = I * R / N.
The voltage across the burden resistor is what you work with.
With the scheme I suggested, I accept there is a risk of DC saturation, carefully managed it can be avoided. I'd be wary of the settling problem associated with a large coupling capacitor, if I could.
Converting AC to DC with a simple rectifier creates too many errors.
A half wave precision rectifier throws away half your data.
You CAN create a DC restored signal directly from a current transformer, but at 50Hz that's another can of worms.
Yes, you could use a precision full wave rectifier.
Mike |
|
![](templates/subSilver/images/spacer.gif) |
|