I am having problem in measuring inductive load current with acs712(20amps) hall effect sensor, for resistive load it works 99% accurately. I am using pic micr 18f4620 this is my sample code
While(1){
n1 =0; j =0;for(int16 i =0;i<20;i++){
n1++;
Table_sinusoide[j]=get_adc_value(3);
delay_us(997);
j++;}
mini =1023;
maxi =1;for(j=0;j<n1;j++){
M=Table_sinusoide[j];if(mini>M){
mini=M;}if(maxi<M){
maxi=M;}}
lcd_gotoxy(1,1);printf(lcd_putc,"min : %04ld ",mini);
lcd_gotoxy(1,2);printf(lcd_putc,"max : %04ld",maxi);
p2p = maxi - mini ;
Voltage =(float)p2p *(448/260.1);//at 448mv from hall effet sensor I am getting 260.1 p2p value
So I fixed this as constants
lcd_gotoxy(1,3);printf(lcd_putc,"p2p: %04ld",p2p);
lcd_gotoxy(1,4);printf(lcd_putc,"voltage:%06.2f ",Voltage);
my idea is simple for 20 ms time(50hz line freq) I am taking 20 samples the finding min and max values
p2p = maxi-mini.
I am getting exact result for resistive loads, my hall effect sensor produces 100mv / amp
For inductive loads such as motors the value shown is In accurate, I also increased the sampling rate for 20ms I took 600 samples but the result is same. for 4 amps motor load my hall effect sensor outputs 400mv measured in multimeter but in pic I am getting in accurate results why so kindly help I want to measure accurate ac current for both inductive and resistive loads.
Regards
Kalyan.