Community
OpenEnergyMonitor

Community

Obsolete Values

Hi,

I’ve successfully installed Emonscms using a RPI3 and an Arduino ( for a Datalog system) .I am encountering a problem : i’m wanting to display power values ( which are collected from my system using DC generator to simulate power values) but it seems that the values that are actually displayed are obsolete . Here is a screenshoot :

Thanks for responding ,

That tells me that emonCMS is receiving data - the last data was received 1 s before you took the screenshot.

Are you saying that is not correct? If you look in “Input API Help”, you can send a command from your web browser to simulate the Arduino’s data, if that appears within a second or so, it shows that emonCMS is working.

So is your Arduino sending the correct data? Is that measuring and sending new data (say) every 10 s?

I’m actually receiving datas from my Arduino using the web Browser like you said but it’s not the values that i’m wanting for : they get updated but they don’t vary , it’s always 11,6,6,6.

Thanks for your answers,

How are you sending the data? HTTP API, MQTT, Serial?

How do you know what data you are sending?

No, I said that you must use your web browser to SEND data - when you do that, you prove that emonCMS is working correctly. Then you look somewhere else for the fault.

If i’m understanding , i’m using Serial to send data from my Arduino to my RPI3

Sorry but i think i don’t understand what you mean.

Thanks for responding

And how do you translate that serial data to emoncms? Via emonhub?

How do you know what data is actually being sent?

[edit]
Ok I realised this relates to your thread Collect data from RPI3 to Emoncms so maybe @pb66 can help.

@Atelier21 what can you see in the emonhub.logs?

I’ve got this :

2019-06-26 08:37:35,678 DEBUG    ArduinoOnUSB0 660 From Node : 6
2019-06-26 08:37:35,678 DEBUG    ArduinoOnUSB0 660    Values : [11, 282, 6, 6]
2019-06-26 08:37:35,679 DEBUG    ArduinoOnUSB0 660 Sent to channel(start)' : ToEmonCMS
2019-06-26 08:37:35,680 DEBUG    ArduinoOnUSB0 660 Sent to channel(end)' : ToEmonCMS
2019-06-26 08:37:35,879 DEBUG    MQTT       Publishing: emon/Arduino1/power1 11
2019-06-26 08:37:35,881 DEBUG    MQTT       Publishing: emon/Arduino1/power2 282
2019-06-26 08:37:35,883 DEBUG    MQTT       Publishing: emon/Arduino1/power3 6
2019-06-26 08:37:35,885 DEBUG    MQTT       Publishing: emon/Arduino1/power4 6
2019-06-26 08:37:35,887 INFO     MQTT       Publishing: emonhub/rx/6/values 11,282,6,6
2019-06-26 08:37:36,716 DEBUG    ArduinoOnUSB0 661 NEW FRAME : 6 10 277 6 6 
2019-06-26 08:37:36,719 DEBUG    ArduinoOnUSB0 661 Timestamp : 1561538256.72
2019-06-26 08:37:36,720 DEBUG    ArduinoOnUSB0 661 From Node : 6
2019-06-26 08:37:36,720 DEBUG    ArduinoOnUSB0 661    Values : [10, 277, 6, 6]
2019-06-26 08:37:36,721 DEBUG    ArduinoOnUSB0 661 Sent to channel(start)' : ToEmonCMS
2019-06-26 08:37:36,722 DEBUG    ArduinoOnUSB0 661 Sent to channel(end)' : ToEmonCMS
2019-06-26 08:37:36,919 DEBUG    MQTT       Publishing: emon/Arduino1/power1 10
2019-06-26 08:37:36,921 DEBUG    MQTT       Publishing: emon/Arduino1/power2 277
2019-06-26 08:37:36,923 DEBUG    MQTT       Publishing: emon/Arduino1/power3 6
2019-06-26 08:37:36,926 DEBUG    MQTT       Publishing: emon/Arduino1/power4 6
2019-06-26 08:37:36,928 INFO     MQTT       Publishing: emonhub/rx/6/values 10,277,6,6
2019-06-26 08:37:37,118 DEBUG    ArduinoOnUSB1 662 NEW FRAME : 7 16.0 
2019-06-26 08:37:37,120 WARNING  ArduinoOnUSB1 662 RX data length: 1 is not valid for datacodes ['h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'h', 'L']
2019-06-26 08:37:37,760 DEBUG    ArduinoOnUSB0 663 NEW FRAME : 6 11 280 6 6 
2019-06-26 08:37:37,763 DEBUG    ArduinoOnUSB0 663 Timestamp : 1561538257.76
2019-06-26 08:37:37,764 DEBUG    ArduinoOnUSB0 663 From Node : 6
2019-06-26 08:37:37,764 DEBUG    ArduinoOnUSB0 663    Values : [11, 280, 6, 6]
2019-06-26 08:37:37,765 DEBUG    ArduinoOnUSB0 663 Sent to channel(start)' : ToEmonCMS
2019-06-26 08:37:37,766 DEBUG    ArduinoOnUSB0 663 Sent to channel(end)' : ToEmonCMS
2019-06-26 08:37:37,965 DEBUG    MQTT       Publishing: emon/Arduino1/power1 11
2019-06-26 08:37:37,968 DEBUG    MQTT       Publishing: emon/Arduino1/power2 280

LOG LEVEL: DEBUG

but the values that you can see are not what i’m searching for ( all the powers have value without having connected my DC generator to vary power in my differents entries).

I’m not sure what you mean there sorry.

The input on the emoncms page are actively being updated because we can see the green update times in seconds.

We can see that dat is being published to the same node and input names succesfully in emonhub

2019-06-26 08:37:36,919 DEBUG    MQTT       Publishing: emon/Arduino1/power1 10
2019-06-26 08:37:36,921 DEBUG    MQTT       Publishing: emon/Arduino1/power2 277
2019-06-26 08:37:36,923 DEBUG    MQTT       Publishing: emon/Arduino1/power3 6
2019-06-26 08:37:36,926 DEBUG    MQTT       Publishing: emon/Arduino1/power4 6

AND coincidentally, power3 and power 4 are both “6” in both emonhub and on the input page, so I suspect the values you are seeing in emoncms are the true values sent by your device, noise perhaps?

I notice node 7 is trying to use datacodes, that is not right. you do not need datacodes in your nodes definition as the values you are passing are not encoded, therefore do not need decoding.

I thought about the noise , but the 277 value is weird ( i have not put an entry ). My issue is the fact that even when i put a DC in any of my entry , the value of powers does not change.

If you recall in the other thread we explained the format your arduino’s needed to output was a space separated string of values with a leading node id, this line from you log above shows the raw serial line as it was received from your arduino

2019-06-26 08:37:36,716 DEBUG ArduinoOnUSB0 661 NEW FRAME : 6 10 277 6 6

so the 277 is coming from your device, you need to look closer at your arduino HW and FW.

if emoncms and/or emonhub is complicating things, then just read the serial output directly from the arduino in your arduino ide or consile of choice. When you get a “space separated string of values with a leading node id” with values that you do agree with, you can then test emonhub/emoncms again, but the source must be right for them do deliver good data.

I think that emoncms/emonhub are working perfectly right now , so it must be the communication between my Arduino and my RPI3 or my circuit.

Thanks for your advices , i’ll take a look into my arduino ide just to be sure

EDIT1 : i’ve tested with my DC power supply and finally i found that i have not any current(but a voltage, not both) in my system and i have any idea of how to fix that

If you post your Arduino sketch here, someone can look at it and tell you if it is correct.

I’m not sure if it’s just a translation issue or the wrong terms being used etc, but the small bit of sketch that was posted in the other thread looked a lot like an OEM style emonLib? based sketch but the term “DC” keeps being used. Just to state the obvious, is the right hardware and sketch in use? Is it AC or DC we’re measuring? The OEM stuff only does AC ordinarily.

It would be much easier to solve this problem if we had ALL the information about the project.

Hello,

here is the complete sketch i’m using for measuring power in the differents inputs :

#include <EmonLib.h>
#include <stdio.h>
#include "EmonLib.h"
// Include Emon Library
EnergyMonitor emon1;
// Create an instance

EnergyMonitor emon2;
// Create an instance

EnergyMonitor emon3;
// Create an instance

EnergyMonitor emon4;
// Create an instance

//https://github.com/openenergymonitor/learn/blob/master/view/electricity-monitoring/ct-sensors/how-to-build-an-arduino-energy-monitor-measuring-current-only.md
void setup()
{
  Serial.begin(9600);

  emon1.current(A0, 111.1);             // Current: input pin, calibration.
  emon2.current(A1, 111.1);             // Current: input pin, calibration.
  emon3.current(A2, 111.1);             // Current: input pin, calibration.
  emon4.current(A3, 111.1);             // Current: input pin, calibration.
}

void loop()
{
  double power1;
  double power2;
  double power3;
  double power4;
  //Add a leading node id eg 
  Serial.print("6");
  Serial.print(" ");
  
  // calculer et afficher le courant 1
double Irms1 = emon1.calcIrms(1480);// Calculate Irms only
power1 = Irms1*24.0 ;
Serial.print(power1);         // Apparent power 
  Serial.print(" ");
  //Serial.println(Irms1);          // Irms
  //FIN

   // calculer et afficher le courant 2
double Irms2 = emon2.calcIrms(1480);  // Calculate Irms only
power2 = Irms2*24.0 ;
Serial.print(power2);         // Apparent power
  Serial.print(" ");
  //Serial.println(Irms2);          // Irms
  //FIN

   // calculer et afficher le courant 3
double Irms3 = emon3.calcIrms(1480);  // Calculate Irms only
power3 = Irms3*24.0 ;
Serial.print(power3);         // Apparent power
  Serial.print(" ");
  //Serial.println(Irms3);          // Irms
  //FIN

   // calculer et afficher le courant 4
double Irms4 = emon4.calcIrms(1480);  // Calculate Irms only
power4 = Irms4*24.0 ;
//printf("%lf",power4);
Serial.print(power4);         // Apparent power
  Serial.print(" ");
  //Serial.println(Irms4);          // Irms
  //FIN

Serial.println();    
} 

EDIT1: I have now powers value which vary according to the input( and using a DC power supply(30V -10A) , but my values of power are too high for me ( i’ve reached 900W if i’m not wrong).I’ve a schema of my system but i’m not very good in english to translate it very well .

The DC power supply is here for simulate the 4 inputs ( cause i want to connect bikes and measure in real time the power ) I’ll do some research to make it more clear , it’s now just an overview. Sorry for the lack of informations.

Thanks for your help

Do not worry about that. You are doing very well. Your English is much better than my French.

OK, the problem is now clear. You must not use emonLib to calculate d.c. power. EmonLib is only to be used with a.c mains electricity.

To measure the d.c. current with your Arduino, you need a way to convert the 10 A d.c. into a voltage - ideally 0 - 5 V or a little less. A Hall effect transducer would be suitable. The output from that is a d.c. voltage, which you connect to the analogue input of your Arduino.

[I think you might have this already - I cannot read the words on your diagram, they are blurred.]

Then, for your sketch, you use analogRead(pin) to give you a number that relates to the voltage, that in turn relates to the current.

You should have something like this:

#include <stdio.h>

void setup()
{
  Serial.begin(9600);

  const double étalonnage1 = 1.234;
  const double étalonnage2 = 1.234;
  const double étalonnage3 = 1.234;
  const double étalonnage4 = 1.234;

  const double tension = 24.0;

}

void loop()
{
  double power1;
  double power2;
  double power3;
  double power4;
  //Add a leading node id eg 
  Serial.print("6");
  Serial.print(" ");
  
  // calculer et afficher le courant 1
  double I1 = analogRead(A0) * étalonnage1;
  power1 = Irms1 * tension ;
  Serial.print(power1); 
  Serial.print(" ");

  // calculer et afficher le courant 2
  double I2 = analogRead(A1) * étalonnage2;
  power2 = Irms2* tension ;
  Serial.print(power2); 
  Serial.print(" ");

  // calculer et afficher le courant 3
  double I3 = analogRead(A2) * étalonnage3;
  power3 = Irms3 * tension ;
  Serial.print(power3); 
  Serial.print(" ");

  // calculer et afficher le courant 4
  double I4 = analogRead(A3) * étalonnage4;
  power4 = Irms4 * tension ;
  Serial.print(power4); 
  Serial.print(" ");

  Serial.println();    
} 

You must calculate the number for current calibration (étalonnage) because you should know the voltage that corresponds to 10 A, and you know that 5 V at your Arduino input equals the number 1023.
Therefore if your interface circuit gives you 4.5 V at 10 A, then
analogRead( ) will give you 4.5 ÷ 5 × 1023 = 921
and the calibration is 921 ≡ 10 A
therefore étalonnage = 0.01085

If you find the numbers are not steady, then look for “low pas filter” (filtre passe-bas) for the Arduino.

If i’m understanding , i need to replace all my ammeters by a Hall effect transducer( which is directly connected in an Arduino input ) ?

That might not be necessary. What are these - I cannot read from the photo what they are:
image
I think that is a device that is giving you a direct voltage that is proportional to current, but I cannot be certain, because I do not know what it is.