CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Convert Current waveform
Goto page 1, 2  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
caishenbao



Joined: 04 Apr 2012
Posts: 10

View user's profile Send private message

Convert Current waveform
PostPosted: Wed Apr 04, 2012 10:43 am     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 9172
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 12:59 pm     Reply with quote

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.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Wed Apr 04, 2012 1:31 pm     Reply with quote

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
caishenbao



Joined: 04 Apr 2012
Posts: 10

View user's profile Send private message

PostPosted: Wed Apr 04, 2012 8:42 pm     Reply with quote

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
temtronic



Joined: 01 Jul 2010
Posts: 9172
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 5:27 am     Reply with quote

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.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Apr 05, 2012 7:48 am     Reply with quote

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.
caishenbao



Joined: 04 Apr 2012
Posts: 10

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 8:07 am     Reply with quote

>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..
temtronic



Joined: 01 Jul 2010
Posts: 9172
Location: Greensville,Ontario

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 8:22 am     Reply with quote

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.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Apr 05, 2012 8:25 am     Reply with quote

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.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 9:15 am     Reply with quote

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
caishenbao



Joined: 04 Apr 2012
Posts: 10

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 10:19 am     Reply with quote

>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~
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 10:43 am     Reply with quote

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
caishenbao



Joined: 04 Apr 2012
Posts: 10

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 11:41 am     Reply with quote

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.
asmboy



Joined: 20 Nov 2007
Posts: 2128
Location: albany ny

View user's profile Send private message AIM Address

PostPosted: Thu Apr 05, 2012 12:15 pm     Reply with quote

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.
Mike Walne



Joined: 19 Feb 2004
Posts: 1785
Location: Boston Spa UK

View user's profile Send private message

PostPosted: Thu Apr 05, 2012 3:04 pm     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group