Cypress技术论坛
直播中

h1654155275.5771

7年用户 225经验值
私信 关注
[问答]

怎么使用PRoC和ACS712进行交流电流测量

你好,同事们,
我试着用YouPro(EVALKIT)和ActhoSACS712来测量交流电流,但我只能测量噪声。我使用的ADC SAR块与4.8VDC作为参考和非常快的采样(125kSAMPPLESPER秒)。ADC SAR块截图附上并附有代码:
CysISR(ADCX-SARYA SEQUISISR){if(计数=0){min=4096;max=0;}
Read Value= ADClSARYA SEQUGETRESULT16(0);//通道0将我的引脚连接到ACS712输出IF(Read Value≫max)max=Read Valuy;IF(Read ValtualLt.Min)MIN=Read Value;Cl+++;If(Calt & Gt;= 25000)// 0.2秒{
MAP=2.5×(max min);//(1000×0.353×4800)/(4095×166)=2.5//1000是ATO MA,0.353来自VPP ToVRMS,48×MVISVREF,4095是分辨率的比特,166是MyACS712计数=0;
根本问题是马克斯和Min值总是几乎相同(0x5DANDX5B),不管哪种负载(无负载,30Ma,200 MAOR350MA)都是连接的。我认为ADC SAR不是真的采样这么快,这就是为什么我总是测量相同的,你们中有人知道会发生什么吗?
提前感谢,
彼得
AdCl 2Y1.PNG
43.5 K
AdCl 1I1.PNG
81.3 K

以上来自于百度翻译


     以下为原文
  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


回帖(19)

h1654155275.5771

2019-1-22 11:38:16
Odissey
我改变了PIN,结果是一样的,min和max总是2047。我加快了PIN的振荡器。我从未见过那些最小值和最大值改变值。我可以用范围和一个DMM进行一些并行测量。附加的,你可以观察到一个范围的屏幕截图,抱歉它很老,而且总是有很多噪音。我还用一个好的DMM进行测量:
-当VDD IPROC=4.5,并且没有AC连接时,测量6MVRMS(AC)。这是在VDD=4.5的ACS芯片的预期噪声。
-当VDD IPROC=3.3且没有AC连接时,测量6MVRMS(AC)。这是在VDD=3.3的ACS芯片的预期噪声。
当VDD IPROC=4.5和AC负载约130MAIS连接时,测量一个非常固定的值18MVRMS(AC)。它应该是最小值和最大值之间的差值大约51。根据我的计算,这将是125Ma,或多或少OK…
在ADC的配置中,甚至在PRC中,它必须是非常基础的,你知道所有这些新信息会发生什么吗?
彼得
文氏镜
118.1 K

以上来自于百度翻译


     以下为原文
  Odissey,
    I changed the pin and the result is the same, min and max are always 2047. I speeded up the oscillator of the pin and the same. I have never seen those min and max changing the value. I could make some parallel measurement with the scope and a DMM. Attached you can observe a screenshot with the scope, sorry it is very old and it has a lot of noise always. I am also performing measurements with a good DMM:
    - When Vdd in PRoC= 4.5 and no AC is connected I measure 6mVrms (AC). This is the expected noise of the ACS chip at Vdd=4.5
    - When Vdd in PRoC= 3.3 and no AC is connected I measure 6mVrms (AC). This is the expected noise of the ACS chip at Vdd=3.3
    - When Vdd in PRoC= 4.5 and AC load of about 130mA is connected I measure a very fix value of 18mVrms (AC). It should be a difference between min and max of about 51. Following my calculations, this would be 125mA, what is more or less ok...
    It must be something very basic in the configuration of the ADC or even in the PRoC, do you have an idea of what can be happening with all this new information?
    Peter


举报

张琳

2019-1-22 11:51:45
彼得,在我的项目VIP必须在0至2.048 V范围内,以1.024V为中心。我将参考该项目,稍后您可以更改设置。霍尔传感器的输出以2.5V为中心,在输入范围之外。你需要用两个电阻或锅来缩小输出大约2.5倍。但是,第一次测试,以确保PRC是活着的是缩短输入引脚到地面,观察UART输出将达到最大~(2048)。另一个想法是,你可以通过运行其他程序来测试PRC的ADC是否仍然活着?

以上来自于百度翻译


     以下为原文
          Peter, In my project Vinp must be in range 0-2.048V, centered at 1.024V. I will refer to that project, while later you can change settings. The output of the Hall sensor is centered at 2.5V, which is outside input range. You need to scale down output about 2.5 times with a couple of resistors or pot. But first test to make sure that PRoC is alive is to short the input pin to the ground, an observe UART output going to max ~ min ~ (-2048). Other thought, can you test if PRoC's ADC is still alive by running some other program?   
举报

h1654155275.5771

2019-1-22 12:06:10
引用: nvwuwy 发表于 2019-1-22 19:06
彼得,在我的项目VIP必须在0至2.048 V范围内,以1.024V为中心。我将参考该项目,稍后您可以更改设置。霍尔传感器的输出以2.5V为中心,在输入范围之外。你需要用两个电阻或锅来缩小输出大约2.5倍。但是,第一次测试,以确保PRC是活着的是缩短输入引脚到地面,观察UART输出将达到最大~(2048)。另一个想法是,你可以通过运行 ...

奥迪西
ADC是活着的,因为我测试了DieTempBlock和我得到正确的温度值,即使加热和冷却。
回到这个项目,如果我遵循你的建议和缩小传感器的输出,我将失去2.5的灵敏度,什么不是项目的目标。为什么我不能使用VDD/2选项?我试过了,但也没用。你能用ACS712(例如从2到3V)的波形模拟你的身边,然后发给我操作码吗?这将是完美的,
提前感谢,
彼得

以上来自于百度翻译


     以下为原文
  odissey,
    ADC is alive since I tested with the DieTemp Block and I got the temperature value correctly even when heating up and cooling down. 
    Coming back to this project, if I follow your recommendations and scale down the output of the sensor I will lost 2.5 sensitivity, what is not the goal of the project. Why I can not use the option VDD/2? I tried with that but it is not working either. Can you maybe simulate on your side with a waveform like the ACS712 (from 2 to 3V, for example) and send me the operating code? It would be perfect,
    Thanks in advance,
    Peter
举报

张琳

2019-1-22 12:23:01
彼得,我也认为ADC是好的,你只是在2.048 V以上的限制。为了确认,断开霍尔传感器的输入并将其短路到地面,您必须看到Min=2047,max=2047。如果是这样的话,ADC工作正常,只是输入信号在范围之外。我将查看ADC设置,但为了快速测试,请将VREF从1.024V更改为VDDA/2。

以上来自于百度翻译


     以下为原文
          Peter, I also think that the ADC is fine, you are just above 2.048V limit. To confirm, disconnect input from Hall sensor and short it to the ground, you must see min= -2047, max =-2047. If that's the case, ADC working fine, it is just that the input signal is outside the range. I will look into ADC setting, but for quick test, please change Vref from 1.024V to Vdda/2.   
举报

更多回帖

发帖
×
20
完善资料,
赚取积分