Can anybody tell me why 100 cycle took in emon library for take samples in 2 Sec means why 100 cycle ,no more than 100 or less than 100?
Because, when you use calcVI( ), it counts cycles (more accurately half-cycles as specified by the parameter
crossings) to determine the averaging period, which will then be 2 s.
Thank you sir for reply.
Sir, can you tell me am i right about sampling period and sampling rate?
According to library i found sampling rate is 5000 sample per second (5Khz).
and sampling period is 200 micro second.
and yes sir for accuracy purpose but why 100 sample per 1 cycle and 100 cycle ? if you know exact reason about this please inform me
Thank you for support sir
Does this answer your first question?
As for the second, I don’t know what you are referring to. I cannot remember seeing anywhere a statement about “100 sample per 1 cycle and 100 cycle”.
Sir,that has been mentioned 50 samples per half cycle inside learn,electricity monitoring ,ac power theory,arduino maths.
The image was made by sampling the mains voltage and current at high frequency, which is exactly what we do on the emontx or Arduino. We make between 50 and 100 measurements every 20 milliseconds. 100 if sampling only current. 50, if sampling voltage and current. We’re limited by the Arduino analog read command and calculation speed.
No, that is the approximate number of samples per whole cycle (at 50 Hz), not per half-cycle.
That is correct, but I repeat, those are approximate numbers only.
Also, emonLib does not sample continuously. It was designed for use with an Arduino (or emonTx) running on battery power and so it runs for two or three hundred milliseconds (or 30 crossings - 15 cycles) and then reports the values measured during that period. The sketch may then sleep the processor for 10 s to conserve battery life.
Sounds like he’s referring to this one, as it’s the only one on the page he quoted from…
Thank you all of you for reply but i am not getting proper information so please can you provide me calculation ?
As I replied to your other post calcIrms sampling rate slower than expected, you can find the theory about the calculations in the ‘Learn’ section of this website. All the calculations are done for you in the emonLib library.
If you are not getting the proper information out, then you are not putting the proper information in. I can assure you that the calculations in the library are correct for an Atmel ATMega 328P. If you are using a different processor, you might need to change one or more things.
Ok Sir , thank you and I am using ATMEGA8 so all values are fluctuating .
You must compare the data sheets for the Mega8 and Mega328P, and note specific differences, you might also find Arduino documentation on the Mega8 helpful.
Then, work through the emonLib code and your sketch, checking that every instruction that relates to the hardware itself is correct.
However, the two are broadly from the same family, so I do not expect major differences. But I would expect I/O references to be different.
If “all values are fluctuating”, then unless the fluctuations are small, it means either that the quantities you are trying to measure really are fluctuating (e.g., the voltage I measure here varies by a few tenths of a volt, often more, each time it is read), or your averaging time - which you specify as the number of samples of half-cycles - is not long enough.
Ok sir, one question regarding low pass filter equation and that is what is alpha value in Emon ?will you please provide calculative information.
Do you mean in emonLib?
The value is approximately 0.001 It was chosen to give a suitable time constant that’s a compromise between adequately removing the 50 Hz ripple and responding reasonably quickly to a change, e.g. when the c.t. is plugged in or unplugged.
The full theory is here.
Yes Sir for emonlib and if alpha is 0.001 aprrox and cutoff frequency is 50 Hz then i could not find time constant from Wikipedia equations.
sir ,why 20 crosses and 2000 timeout took ,i know that is for accuracy but it comes from any equation or assumption?because i want to know exact reason about calVI(20,2000).
1. Look at the source code for emonLib and work out exactly what these few lines each side of the filter itself are doing. The comments might help you:
sampleI = analogRead(inPinI); // Digital low pass filter extracts the 2.5 V or 1.65 V dc offset, // then subtract this - signal is now centered on 0 counts. offsetI += (sampleI-offsetI)/1024; filteredI = sampleI - offsetI; // Root-mean-square method current // 1) sum squared current values sumI += filteredI * filteredI;
What is the purpose of those few lines, and what do you want the result of those lines to be? i.e. What does
filteredI represent in the real world?
2. Go back to the Wikipedia article and understand what the cut-off frequency is. In emonLib, what is the wanted signal? You should know this from (1) above.
3. What happens to the wanted signal if its frequency is the cut-off frequency?
4. Therefore, what should the cut-off frequency be in relation to the quantity you are trying to measure?
Why not? What does 20 crossings represent in the real world?
What does a timeout of 2000 mean in the real world? Work through this piece of code with paper and pencil and find out what might happen if
inPinV has a value within a particular range for a long time? What is the physical meaning of the “particular range” of values? What do I mean by “a long time”? Together, what do those two things mean?
I have found out all except 20 cross count please tell me logic behind it or relation with real word.i can not find out.
20 zero crossings = 20 × 10 ms = 200 ms. That is the period of the measurement.
What is SO difficult about that?
If you want a different period, you can choose a value that suits you.