An interfacer is how emonhub interfaces with various hardware and sources etc, there are different “types” of interfacer for different jobs, eg the EmonHubJeeInterfacer is for communicating with JeeLib based transceivers (base stations) like RFM2Pi, emonPi and JeeLink etc. Basically it is a EmonHubSerialInterfacer with an additional feature set to send specific “JeeLib” configuration settings via serial as well as just reading the serial port. It is very common to OEM setups but if you are not using one of those devices you can disable/delete it from your emonhub.conf.
Since you are connecting via serial, you could actually still use that EmonHubJeeInterfacer but there is a lot of complexity that you simple do not need for simple serial comms. All you really need is a EmonHubSerialInterfacer instance for each of your usb connected arduino’s in the interfacers section of emonhub.conf eg
[interfacers]
[[ArduinoOnUSB0]]
Type = EmonHubSerialInterfacer
[[[init_settings]]]
com_baud = 9600
com_port = /dev/ttyUSB0
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
subchannels = ToRFM12,
[[ArduinoOnUSB1]]
Type = EmonHubSerialInterfacer
[[[init_settings]]]
com_baud = 9600
com_port = /dev/ttyUSB1
[[[runtimesettings]]]
pubchannels = ToEmonCMS,
subchannels = ToRFM12,
Offhand I do not know what addresses your devices will be, they could be /dev/ttyUSBx if you’re using generic usb-serial adaptors or they could be /dev/ttyACMx if they are Arduino’s with on-board USB or even something else, that’s why i posted the command to run before and after connecting the device(s), it tests for all the “usual” serial addresses.
sudo ls -la /dev/{tty{ACM,AMA,S,USB},serial}*
As for the sketches and the output format, if you add a leading node id, comment out the text labels and add a trailing empty “print with newline” like so
void loop()
{
// Add a leading node id eg 28 ?
Serial.print("28"); Serial.print(" ");
// calculer et afficher le courant 1
double Irms1 = emon1.calcIrms(1480); // Calculate Irms only
Serial.print(Irms1*24.0); // Apparent power
Serial.print(" ");
//Serial.println(Irms1); // Irms
//FIN
// calculer et afficher le courant 2
double Irms2 = emon2.calcIrms(1480); // Calculate Irms only
Serial.print(Irms2*24.0); // Apparent power
Serial.print(" ");
//Serial.println(Irms2); // Irms
//FIN
// calculer et afficher le courant 3
double Irms3 = emon3.calcIrms(1480); // Calculate Irms only
Serial.print(Irms3*24.0); // Apparent power
Serial.print(" ");
//Serial.println(Irms3); // Irms
//FIN
// calculer et afficher le courant 4
double Irms4 = emon4.calcIrms(1480); // Calculate Irms only
Serial.print(Irms4*24.0); // Apparent power
Serial.print(" ");
//Serial.println(Irms4); // Irms
//FIN
Serial.println()
}
you should get serial output like so 28 1 2 3 4
on each line (where 1,2,3&4 are your current values).
Each device needs a unique node id and a corresponding entry in the [nodes] section of emonhub.conf will allow you to define names etc eg
[nodes]
[[28]]
nodename = Arduino_A
[[[rx]]]
names = value1, value2, value3, value4
[[29]]
nodename = Arduino_B
[[[rx]]]
names = value1, value2, value3, value4
there are other things you can define here like scales and datacodes, but if you are sending “real human values” ie not scaled integers or byte encoded values etc you shouldn’t need to set anything else. The number of names should obviously match the number and the order of the values you are passing over serial.
I hope this helps a bit, apologies in advance if I’ve missed something.