Sarah Emran
Newbie level 4
- Joined
- May 17, 2013
- Messages
- 6
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 1,281
- Activity points
- 1,337
Be aware that the ADC in these PICs is not very fast and to take an accurate reading you need lots of samples within one cycle of your signal. If you need a true RMS reading at more than low frequency, I suggest you look at using an external RMS to DC converter and read it's output voltage into the ADC. The PIC ADC conversion speed depends on it's clock speed, the number of bits you want in the result and the source impedance.
If you use the PIC alone, you will have to scale the input signal voltage and offset it's voltage so it's most negative points do not go below the negative ADC reference and it's most positive points do not go above the positive ADC reference. You cannot add a diode in series with the input as this would remove parts of the signal you are trying to measure.
Brian.
Hi sarah
I will say you something that can help you about simulation of proteus! :
1-you don't need to put voltage on lcd in proteus and GND too.
2-the pin of reset is enough if you put power flag on it.
and about your circuit :
1-adc_read is 10bit value...for example if your voltage be 5v and your vref be 5v , it is 1023...so you must make a formula like this that can earn 5v from 1023 for show on lcd:
sample=adc_read(0).....0 mean channel 0 of adc ...(RA.0)
v=(sample*5)/1023....so when your input voltage is 5 v so sample is 1023 thereupon V=5.
but this is about dc voltage!
for ac i think you must put a diode to forbid to come negative voltage to your MCU.
best regards
Green Tree
Take no. of samples 2*f . if u dont know frequency find it first or take samples 2*highest frequency for good results.
don't use delay (Delay_ms(1000) ) any more .
Here is code possibly it help u
const long NUM_DATA_POINTS = 3000;
for(i=0; i<NUM_DATA_POINTS; ++i)
{
value = ADC_Read(2);
voltage += (float)value*(float)value;
}
Voltage=ADC VALUE * (5 Volts)/(1023) * (5 Volts)/(1023);
voltage = sqrt(voltage/(NUM_DATA_POINTS));
If your input wave is symmetric about time axis don't use clamp ckt to shift signal simple multiply Voltage by 2
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?