Hello, my project is using the eMonLib in an Arduino Zero board (ARM Cortex M0+ ), the library works because some modifications were made by Glidhuson., to include a 12bits ADC mainly. So, the standard Arduino eMonLib has worked very well, but I wanted to push the limits and trying to get a grpahical representation of the instantaneous values (millis, sampleV & sampleI), and I modified the existing library to passed three int arrays by reference to the emon.calcVI,to gather this information. I know there should be errors, like the analogread function delay. I did the following changes to the standard code: in the EMonLib.h, I changed the CalcVI definition:
»
Re: Modfying the eMonLib to sample Sample time/V/I
Hello, my project is using the eMonLib in an Arduino Zero board (ARM Cortex M0+ ), the library works because some modifications were made by Glidhuson, to include a 12bits ADC mainly.
So, the standard Arduino eMonLib has been measuring very well, also Arduino Zero is much faster than the standard Arduino AVR based boards, and not so expensive. A Zero board is a perfect candidate to run the eMonLib.
I wanted to push the limits and trying to get a graphical representation of the instantaneous values (millis, sampleV & sampleI). I have seen this kind of graphical representation in the openenergymonitor website, to check the PHASECAL and calibrations. I know there should be errors, like the analogread function delay.
I modified the existing library to pass three int arrays by reference to the emon.calcVI, gather the sampled information in the main loop, and return this information to the Arduino sketch (by reference)
I did the following changes to the standard code: in the EMonLib.h,
1. Changed the CalcVI definition:
2. Changed the calcVIFuntion:
3. I call the library inside my sketch the following way:
However the sketch / board freezes after claling the function. Can you guide me or help me?, I am convinced that many people have done this before.
Re: Modfying the eMonLib to sample Sample time/V/I
Have you ruled out the possibility that you're steaming right off the end of those [1000] element sample arrays? From memory, I think I've heard ~50 sample-pairs per cycle quoted for the standard AVR OEM monitors. You've asked it to sample for 20 half-cycles, or 10 full cycles so that would represent 500 sample pairs on an AVR monitor. If the SAM based Arduino was just 2x faster than the AVR based one, you'd be hitting your 1000 limit.