EmonLib.h + ads1115 or ads1015, is it possible?

Dear All,

I have searched now much time but I did not find a clear answer: is it somehow possible to use the emonlib.h library in association with the ADS1015 or the ADS1115?

If not, ist there a way to compute the power consumption without the library?
I have a Wemos d1 mini + ads1115 (or ads1015) (1 channel reduced mains voltage, 3 channels SCT013-010).

Thanks in advance for your support!

Hans

Welcome, Hans, to the OEM forum.

Firstly, the emonLib and emonLibCM libraries were designed specifically for the Atmel ATMega 328P processor. If you have a different processor or a different ADC, you will need to make changes, particularly in the area of reading the sample values, and in calculating and adjusting for the time between reading a pair of voltage and current samples. The reason for the first change is clear - you will not be using the internal ADC, but an external one. The second might not be clear: to read active power accurately, the voltage and current must appear to have been sampled at exactly the same instant. Unfortunately, the voltage and current transformers, which you must use for safety, each introduce a phase lead and this looks like a time shift, there’s also a real time difference if you have only one ADC and a multiplex switch to select the input to measure. All three errors combine and mean you must do mathematical tricks to read the power correctly.

When selecting your ADC, your main concern is sampling speed. You need an absolute minimum of about 700 sample pairs per second to measure a complex mains waveform (i.e. up to the 7th harmonic of 50 Hz). In that respect, your best choice would be the ADS1015.

If you didn’t find it, this might be useful: DIY Current Monitor on Raspberry Pi. My power calculation isn't accurate. Help please? - #11 by Robert.Wall

Of course there is - but the basic principle will be the same, no matter how you implement it. I wrote and explained it in that topic, here’s the particular post: DIY Current Monitor on Raspberry Pi. My power calculation isn't accurate. Help please? - #18 by Robert.Wall

1 Like

Dear Robert,

thanks a lot for your great answer that helps me a lot!
I will replace the Wemos d1 mini with a standard Arduino UNO, remove the ADS1X15 and use the inbuilt ADC for the four signals.
Is it better to amplify the signal of the SCT013-010 (0-1V) for example with a lm358 before I send it to the UNO?

Thanks again!

Hans

There is no real need to amplify the output of your c.t. The output is 1 V rms - depending on the shape of the current wave, this should represent a peak to peak voltage of a little less than 3 V, the standard Arduino input range is 5 V, so you are only losing 40 % of the range - less than 1 bit of input resolution.

You will be able to use emonLibCM with your Arduino, which will Continuously Monitor the inputs.

1 Like