View previous topic :: View next topic |
Author |
Message |
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sun May 04, 2014 10:49 am |
|
|
ruth wrote: | may i know it is any method that i can use both of my current sensor (10 bit analog input) and voltage sensor (10 bit analog input) into my PIC which is 10 bit? |
You are already converting current to a voltage.
Simply use another analogue input to the PIC for the conditioned voltage signal.
Mike |
|
|
low
Joined: 04 Feb 2014 Posts: 28 Location: Malaysia
|
|
Posted: Sat May 10, 2014 2:12 am |
|
|
mike, i wan to use the value of voltage sensor and current to calculate the power (P=IrmsVrms)
i had tried to use another analog input for my voltage sensor. i had get the result for both current and votlage sensor if but my adc only can read 1 adc value at 1 time. I cant read 2 adc values at the same time.
So, my problem is in the program the my adc value for voltage sensor and current sensor cant be read together, so i cant multiply that the output of that 2 sensor.
Do u all have any idea about that? |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19590
|
|
Posted: Sat May 10, 2014 2:22 am |
|
|
You can read one input, then the other. On a typical PIC, just 10uSec between the readings (on some as little as 2.5uSec). On a 50/60Hz waveform, the error in this time is insignificant, and will cancel over time (second reading higher on the first half cycle, and lower on the second).
Take the readings then do the maths (to minimise the delays). |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sat May 10, 2014 6:22 am |
|
|
low wrote: | mike, i wan to use the value of voltage sensor and current to calculate the power (P=IrmsVrms)
i had tried to use another analog input for my voltage sensor. i had get the result for both current and votlage sensor if but my adc only can read 1 adc value at 1 time. I cant read 2 adc values at the same time.
So, my problem is in the program the my adc value for voltage sensor and current sensor cant be read together, so i cant multiply that the output of that 2 sensor.
Do u all have any idea about that? |
Are you trying to measure REAL or APPARENT power?
The formula you quote is for apparent power.
For real power you want the average of I*V over an integral number of mains cycles.
Like Mr T says measuring I and V one after the other is not a problem with mains frequency input.
OR
Read I and V at equally spaced intervals. Calculate power from one reading of current and average of two voltage readings.
Mike |
|
|
low
Joined: 04 Feb 2014 Posts: 28 Location: Malaysia
|
|
Posted: Sat May 10, 2014 10:06 am |
|
|
thx for guide for ttelmah and mike..
actually i want to find real, apparent, reactive and power factor as well...
so in order to obtain all those parameter i just need to play around the formula is it? is it necessary to find the zero crossing for voltage sensor? |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sat May 10, 2014 2:30 pm |
|
|
low wrote: | thx for guide for ttelmah and mike..
actually i want to find real, apparent, reactive and power factor as well...
so in order to obtain all those parameter i just need to play around the formula is it? is it necessary to find the zero crossing for voltage sensor? |
I've already shown how to handle V & I without the need to determine crossing points.
I will have a look at real power issue and come back.
Once you have real & apparent power, the other two, reactive power & power factor, fall out.
Mike |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sat May 10, 2014 3:38 pm |
|
|
Quote: | i want to find real, apparent, reactive and power factor |
That being true, your sensor is only one part of the circuitry you need.
Understand that it is based on a passive current transformer, and thus
IS NOT PHASE SENSITIVE.
the data you get from it is unavoidably "simple instantaneous" current.
it is NOT the "real" ( x or REAL component of a synchronous demodulator)
NOR is it the "reactive" current either ( the Y /IMAGINARY/QUADRATURE component of a sync demod)
what your data really is,
IS actually the square root of (X^2) *(Y^2); from above
and nothing more.....
adding circuitry to get X is simpler than what you need to read Y,
and with the identity provided by the above equation AND X alone
you can calculate the other stuff you care about.
here is a link to page with info about how to use a multiplier IC AD633 -
for an in-phase watt meter . and background that may also help you.
http://mysite.du.edu/~etuttle/electron/elect64.htm
the" test circuit" in the article highlights how a multiplier ( as a simple form of sync-demod) can create a phase sensitive True RMS power result,
from a power factor impaired load.
BTW: is this for a no-kidding PRODUCT or school PROJECT? |
|
|
ruth
Joined: 14 Apr 2014 Posts: 11
|
|
Posted: Sun May 11, 2014 7:45 am |
|
|
instantaneous current-by using the LTS current sensor (i get 10 sample,find its mean and rms)
voltage value- my voltage sensor ( use simply a transformer to step down the input voltage before enter PIC, use 10 sample, find its mean and rms)
the multiplication of instantaneous current and voltage value is just a normal power (which is not real nor reactive power)
in order to find real n reactive power i should get either x or y component (phasor different)?
asmboy, my understand is it correct?
that is school project.. |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sun May 11, 2014 8:48 am |
|
|
Quote: | \in order to find real n reactive power i should get either x or y component (phasor different)?
asmboy, my understand is it correct?
|
Yes - as well as you express it -
but as i said -
is easier to get a X value ( from sensed input voltage-)
since you have no (simple) source of quadrature demodulation carrier
to measure Y . |
|
|
Mike Walne
Joined: 19 Feb 2004 Posts: 1785 Location: Boston Spa UK
|
|
Posted: Sun May 11, 2014 10:52 am |
|
|
ruth wrote: | instantaneous current-by using the LTS current sensor (i get 10 sample,find its mean and rms)
voltage value- my voltage sensor ( use simply a transformer to step down the input voltage before enter PIC, use 10 sample, find its mean and rms)
the multiplication of instantaneous current and voltage value is just a normal power (which is not real nor reactive power)
in order to find real n reactive power i should get either x or y component (phasor different)?
asmboy, my understand is it correct?
that is school project.. |
1) For your voltage sensor:- Can we assume that you offset the voltage? (So that you are not forcing the PIC ADC input to go negative)
2) How are you selecting your 10 samples for the V and I computations?
Mike |
|
|
ruth
Joined: 14 Apr 2014 Posts: 11
|
|
Posted: Sun May 11, 2014 11:19 am |
|
|
mike,
yes, i had offset the voltage before it enter the PIC.
for the samples selection, i just use 10 sample in my loop and do my calculation. i dont really select it.
for programming, i use 2 buttons (button 1 and button 2)to control the display analog input on LCD.
the problem i encountered is i cant direct change the display from button 1 to button 2 (i only can press button 1, then reset it before i press button 2).
the programming is used is
Code: |
if(!input(SW1))
{
while (true)
{
function
}
}
if(!input(SW2))
{
while (true)
{
function
}
}
|
can anyone give me the idea to solve it?
thanks |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sun May 11, 2014 11:24 am |
|
|
Code: |
ELSE if(!input(SW2))
|
then if SW1 asserted you have the OPTION of SW2
this has become K&R 1.0 we are discussing. |
|
|
ruth
Joined: 14 Apr 2014 Posts: 11
|
|
Posted: Sun May 11, 2014 11:36 am |
|
|
asmboy, i had tried this before but it doesnt work as well.
Do u have any idea?
thanks |
|
|
asmboy
Joined: 20 Nov 2007 Posts: 2128 Location: albany ny
|
|
Posted: Sun May 11, 2014 12:55 pm |
|
|
perhaps you might post THE WHOLE program as you have it now ??
i can't keep guessing based on these tiny fragments ......... |
|
|
ruth
Joined: 14 Apr 2014 Posts: 11
|
|
Posted: Mon May 12, 2014 2:27 am |
|
|
asmboy, here is my code. Can u help me take a look? thanks
Code: |
void read_analog();
void v_read_analog();
void main()
{
lcd_init();
setup_adc_ports
while(TRUE)
{
if(!input(SW1))
{
while (true)
{
current=read_analog();
v_current=v_read_analog();
output_high(LED1);
read_analog();
v_read_analog();
printf(lcd_putc, "\fI=%fA",current);
printf(lcd_putc, "\nV=%f",v_current);
}
}
if(!input(SW2))
{
while (true)
{
current=read_analog();
v_current=v_read_analog();
s=current*v_current;
printf(lcd_putc, "\fP=%fW",s);
}
}
}
}
| [/code] |
|
|
|