1 2 Previous Next 19 Replies Latest reply on May 21, 2017 3:10 AM by javiersenas_1605611

    AC Current Measurement with PRoC and ACS712

    javiersenas_1605611

      Hello colleagues,

         

      I am trying to measure AC current with your PRoC (Eval Kit) and the Allegro's ACS712 but I can just measure noise. I am using the ADC SAR Block with 4.8Vdc as reference and very fast sampling (125ksamples per second). The ADC SAR block screenshots are attached and below is the code:

         

      CY_ISR(ADC_SAR_SEQ_ISR)
      {
          
          if (count == 0)
          {
              min=4096;
              max=0;
          }

         

          readValue = ADC_SAR_SEQ_GetResult16(0);    // Channel 0 is connected my pin to the ACS712 output
          
          if (readValue > max)
              max = readValue;
          if (readValue < min)
              min = readValue;
          count++;
          
          if (count >= 25000) // 0.2 seconds
          {

         

              mamp = 2.5*(max-min); // (1000*0.353*4800)/(4095*166)=2.5   // 1000 is A to mA, 0.353 is from Vpp to Vrms, 4800mV is Vref, 4095 are the bits of resolution and 166 is the mV/A given by my ACS712 
              count=0;
          }
              
      }

         

      The root problem is that Max and min values are always almost the same (0x5D and 0x5B), no matter which load (no load, 30mA, 200mA or 350mA) is connected. I think the ADC SAR is not really sampling so fast and that's why I measuring always the same, does any of you have an idea of what can be happening?

         

      Thanks in advance,

         

      Peter

        1 2 Previous Next