Has anyone successfully combined emonlib with ads1115? I want to measure current with emonlib and ads1115.
Easy way to find out: Google Search
I tried all examples but nothing works..
So show what you've tried - code & schematic.
Have you got the ads1115 working on its own?
I tried this modified emonlib for ads1115 but I get this error:
16:09:57.754 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
16:09:57.797 -> ��f0���@4�aĩ���H���
16:09:57.912 -> --------------- CUT HERE FOR EXCEPTION DECODER ---------------
16:09:57.979 ->
16:09:57.979 -> Exception (28):
16:09:57.979 -> epc1=0x402014aa epc2=0x00000000 epc3=0x00000000 excvaddr=0x0000000c depc=0x00000000
16:09:58.078 ->
16:09:58.078 -> >>>stack>>>
16:09:58.078 ->
16:09:58.078 -> ctx: cont
16:09:58.112 -> sp: 3ffffdd0 end: 3fffffd0 offset: 0150
16:09:58.145 -> 3fffff20: 402035cd 00000001 00000020 401009e0
16:09:58.178 -> 3fffff30: 40203918 00000001 0000001c 3ffee778
16:09:58.245 -> 3fffff40: 00000003 00000100 3ffee4e8 00000000
16:09:58.312 -> 3fffff50: 3ffef4f4 00000001 3ffee4e8 40201476
16:09:58.345 -> 3fffff60: feefeffe 00000001 3ffee500 4020102f
16:09:58.412 -> 3fffff70: 00000000 00000001 3ffee710 4020163d
16:09:58.445 -> 3fffff80: 00000000 feefeffe feefeffe feefeffe
16:09:58.512 -> 3fffff90: 3fffdad0 00000000 3ffee764 402010aa
16:09:58.545 -> 3fffffa0: 3fffdad0 00000000 3ffee764 4020106c
16:09:58.612 -> 3fffffb0: feefeffe feefeffe 3ffee764 40201fac
16:09:58.678 -> 3fffffc0: feefeffe feefeffe 3fffdab0 40100d59
16:09:58.712 -> <<<stack<<<
16:09:58.745 ->
When I try ads1115 example code it works normally.
This is the circuit
The code:
// In this example we will use an ADS1115 breakout board instead of the Arduino's local analog inputs
// This is especially useful for nodemcu/esp8266 users who only have a single analog input
#include <Wire.h>
#include <Adafruit_ADS1X15.h>
// EmonLibrary examples openenergymonitor.org, Licence GNU GPL V3
#include "EmonLib.h" // Include Emon Library
EnergyMonitor emon1; // Create an instance
Adafruit_ADS1115 ads; // Create an instance of the ADS1115 object
// Make a callback method for reading the pin value from the ADS instance
int ads1115PinReader(int _pin){
return ads.readADC_SingleEnded(_pin);
}
void setup()
{
Serial.begin(9600);
Wire.begin(4,5);
ads.begin();
emon1.inputPinReader = ads1115PinReader; // Replace the default pin reader with the customized ads pin reader
emon1.current(1, 111.1); // Current: input pin, calibration.
}
void loop()
{
double Irms = emon1.calcIrms(1480); // Calculate Irms only
Serial.print(Irms*230.0); // Apparent power
Serial.print(" ");
Serial.println(Irms); // Irms
}
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.
