Microdebug.h

I tried to install my Heatpump ESP new but the schets keeps asking for the file #include “MicroDebug.h”

Where can i find this file

Probably going to be GitHub - jeremypoulter/MicroDebug: Quick and simple debug module for micro controlers but I haven’t done anything heat pump related, I assume it is based on EnonESP?

Thanks for the reply,

Yes i have a HeatpumpmonitorTH tad has stopt. I now trying to fix that.
It user ESP whit a ESP12s

I still have problems to flash an ESP12.
Now a wonder if is it possible to connect the HeatpumpmonitorTH direct to the Emonbase. I would like to connect the RX and TX direct to the Raspberry. Can anyone tell me if that’s going to work and what connections on the Pi I should use.

On the Pi is already an RFM12 connected.

Hello Friends,
I now connected the Heatpumpmonitor TH directly serial to the Raspberry. Works perfect.
Now I like to calibrate the CT1, 2 and 3. Also I like to calibrate the Voltage.
I am looking for a way to make a serial print for the measured a calculated current and voltage. This to justify the calibrate values to make the inputs correct.
I tried to make several instance and fill them like
{ OEMct1_volt = ct1.realPower;
OEMct1_amp = ct1Irms;
long supplyVoltage = ct1.Vrms;
long ct1Irms = ct1.Irms; }

But no success.
Can anyone tell me how can I fix this or where I can find a solution?

Firstly, please do not duplicate your posts. It serves no purpose whatsoever.

I know nothing about the Heatpump software, I would try to help but although I can see a handful of sketches, I cannot see anything in any of them that looks like the code you quoted.
You will need to point me towards the exact sketch you are trying to modify if I am to help you.

HP_schets_edited_trystan.zip (6.0 KB)
Hello Robert,

Thanks for the replay.
Hereby the original sketch I have received from Trystan Oct 20.
See “Missing data” Oct 20

Problem from this is that when I used it now it gives a error massage for line 489.

“Compilation error: request for member ‘calcVI’ in ‘OEMct1’, which is of non-class type ‘int’”

Somehow I have used it sins then but now I did have problems whit the ESP12. I cot not fix it and therefor I have made a serial connection to the Raspberry. This part works good now.

But the monitor from the electric consumption is not correct.

The part for the electric monitor is far as I now like the sketch for the EmonTX.

I have now connect a AC-AC transformer and 3 CT but the values for the electric are not good.

There for I looking for serial.printing from the Voltage and current values so I can make the good callibrations.

I hope I set my problem clear now.

My first problem is line 489 in my editor will not give this error. The sketch you sent compiled for me – have you sent me the correct sketch?


I think you need to add after these lines…

        //Print the pulsevalues.
        Serial.print(F(",powerpuls:")); Serial.print(power);
        // Serial.println(" ");
        Serial.print(F(",powerpuls_kWh:")); Serial.print(elapsedkWh,3);  
        // Serial.println(" ");

… these 6 lines to print the current and voltage for the 3 c.t’s.

#ifdef PRINTVI
  Serial.print(F(",Vrms1:")); Serial.print(ct1.Vrms);
  Serial.print(F(",Irms1:")); Serial.print(ct1.Irms);
  Serial.print(F(",Vrms2:")); Serial.print(ct2.Vrms);
  Serial.print(F(",Irms2:")); Serial.print(ct2.Irms);
  Serial.print(F(",Vrms3:")); Serial.print(ct3.Vrms);
  Serial.print(F(",Irms3:")); Serial.print(ct3.Irms);
#endif

and then at the top of the sketch, add:

#define PRINTVI

and I think this will send the three voltages & 3 currents to your Raspberry Pi, and these will appear after the pulse count in kWh. I do not know what you need to do to see the voltages and currents in the Raspberry Pi.
For calibration, if you have a programmer, you can connect this and a desk or laptop computer in place of the Raspberry Pi and use the Arduino monitor to see the values.
You should not need the voltage 3 times, but as the measurements are made at different times - 200 ms later, you probably should use the correct voltage - the one from the time the current was measured.

When you have finished the calibration, change the ‘#define’ line to a comment, recompile and the voltages and currents will disappear, but they will still be there if you need them in the future.

Thanks for the help.
I can see the volt and current values now and can calibrate.
Now I have another problem. I connect the Heat pump TH direct serial on the Raspy. I can see the the values coming in in the Emonhub log and on the serial monitor.
But what I try in the config, I not getting inputs.
I search in the community but till now without success.
I download the latest SD image ( nov22) and this has an - Automatic configuration of nodes enabled-
I tried several nodes settings in the config file but I get no inputs.
Shoult I use an older SD image?

There are problems with “automatic” configuration creating “phantom” inputs when valid but incorrect data is received (maybe due to communications errors), so I advise creating / editing the emonHub configuration file manually.

I don’t recognise what you mean by “Heat pump TH” as I’m not familiar with the heat pump monitor so you will need to tell me exactly what you have. The data sent by the “Heat Pump TH” must be in a format expected by one of the Interfacers used by emonHub.

Here’s the full list:
https://docs.openenergymonitor.org/emonhub/emonhub-interfacers.html#emonhub-interfacers
and I think you’ll be using the first one:

Thanks for the quik replay.

My Heatpump monitor in the original Original through-hole heat pump monitor

Far as I now is this based on the EmonTX and thevalues coming in.
The Mbus from the heatmeter is not connected now so these values are not there yet.

Emonhub Logfile

2023-10-19 12:26:31,811 DEBUG    EmonPi2    Msg:9126,OEMct1:2534,OEMct2:355,OEMct3:0,OEMtotaal:2889,Vrms:0.00, Vrms1:0.00, Irms1:10.65, Irms2:1.49, Irms3:0.00
2023-10-19 12:26:41,777 DEBUG    EmonPi2    Msg:9127,OEMct1:2519,OEMct2:375,OEMct3:0,OEMtotaal:2894,Vrms:0.00, Vrms1:0.00, Irms1:10.59, Irms2:1.58, Irms3:0.00
2023-10-19 12:26:51,730 DEBUG    EmonPi2    Msg:9128,OEMct1:2527,OEMct2:357,OEMct3:0,OEMtotaal:2884,Vrms:0.00, Vrms1:0.00, Irms1:10.62, Irms2:1.50, Irms3:0.00
2023-10-19 12:27:01,781 DEBUG    EmonPi2    Msg:9129,OEMct1:2522,OEMct2:355,OEMct3:0,OEMtotaal:2877,Vrms:0.00, Vrms1:0.00, Irms1:10.60, Irms2:1.49, Irms3:0.00
2023-10-19 12:27:11,731 DEBUG    EmonPi2    Msg:9130,OEMct1:2529
#######################################################################
#######################      emonhub.conf     #########################
#######################################################################
### emonHub configuration file, for info see documentation:
### https://github.com/openenergymonitor/emonhub/blob/emon-pi/configuration.md
#######################################################################
#######################    emonHub  settings    #######################
#######################################################################

[hub]
    ### loglevel must be one of DEBUG, INFO, WARNING, ERROR, and CRITICAL
    loglevel = DEBUG
    autoconf = 1
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
#######################       Interfacers       #######################
#######################################################################

[interfacers]
    ### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module

    [[EmonPi2]]
        Type = EmonHubOEMInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyAMA0
            com_baud = 115200
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
            subchannels = ToRFM12,
    
[[SerialDirect]]
     Type = EmonHubSerialInterfacer
      [[[init_settings]]]
           com_port = /dev/ttyUSB0      # or /dev/ttyAMA0 or/dev/ttyACM0 etc
           com_baud = 115200              # to match the baud of the connected device
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,


    [[USB0]]
        Type = EmonHubOEMInterfacer
        [[[init_settings]]]
            com_port = /dev/ttyUSB0
            com_baud = 115200
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
            subchannels = ToRFM12,
            nodename = emonTx4
    
    [[SPI]]
        Type = EmonHubRFM69LPLInterfacer
        [[[init_settings]]]
            nodeid = 5
            networkID = 210
        [[[runtimesettings]]]
            pubchannels = ToEmonCMS,
    
    
    [[MQTT]]
        Type = EmonHubMqttInterfacer
        [[[init_settings]]]
            mqtt_host = 127.0.0.1
            mqtt_port = 1883
            mqtt_user = emonpi
            mqtt_passwd = emonpimqtt2016
        
        [[[runtimesettings]]]
            pubchannels = ToRFM12,
            subchannels = ToEmonCMS,
            
            # emonhub/rx/10/values format
            # Use with emoncms Nodes module
            node_format_enable = 1
            node_format_basetopic = emonhub/
            
            # emon/emontx/power1 format - use with Emoncms MQTT input
            # http://github.com/emoncms/emoncms/blob/master/docs/RaspberryPi/MQTT.md
            nodevar_format_enable = 1
            nodevar_format_basetopic = emon/
            
            # Single JSON payload published  - use with Emoncms MQTT
            node_JSON_enable = 0
            node_JSON_basetopic = emon/
    
    [[emoncmsorg]]
        Type = EmonHubEmoncmsHTTPInterfacer
        [[[init_settings]]]
        [[[runtimesettings]]]
            pubchannels = ToRFM12,
            subchannels = ToEmonCMS,
            url = https://emoncms.org
            apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
            senddata = 0    # Enable sending data to Emoncms.org
            sendnames = 1    # Send full input names (compression will be automatically enabled)
            interval = 30    # Bulk send interval to Emoncms.org in seconds

#######################################################################
#######################          Nodes          #######################
#######################################################################

## See config user guide: https://github.com/openenergymonitor/emonhub
## If autoconf is enabled above, node configuration will automatically
## populate based on templates listed in available.conf


[nodes]


[[4]]
    nodename = my-serial-device
    [[[rx]]]
       names = power1, power2, power3, power4, vrms
       datacode = 0      # not essential as "0" is default datacode for serial interfacer
       scale = 1         # not essential as "1" is default scale for serial interfacer
       units =W,W,W,W,V


[[5]]
    nodename = emonPi
    firmware = emonPi_RFM69CW_RF12Demo_DiscreteSampling.ino
    hardware = emonpi
    [[[rx]]]
        names = power1,power2,power1_plus_power2,Vrms,T1,T2,T3,T4,T5,T6,pulseCount
        datacodes = h, h, h, h, h, h, h, h, h, h, L
        scales = 1,1,1,0.01,0.1,0.1,0.1,0.1,0.1,0.1,1
        units = W,W,W,V,C,C,C,C,C,C,p


[[10]]
    nodename = emontx1
    [[[rx]]]
       names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
       datacode = h
       scales = 1,1,1,1,0.01,0.01,0.01,0.01,0.01,0.01,0.01,1
       units = W,W,W,W,V,C,C,C,C,C,C,p




[[11]]
    nodename = emonTx_2
    firmware =V1_6_emonTxV3_4_DiscreteSampling
    hardware = emonTx_(NodeID_DIP_Switch1:ON)
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse #Firmware V1.6
       #names = power1, power2, power3, power4, Vrms, temp                                           #Firmware =<V1.4 (un-comment)
       datacode = h
       scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1 #Firmware V1.6
       units =W,W,W,W,V,C,C,C,C,C,C,p                   #FirmwareV1.6
       #scales = 1,1,1,1,0.01,0.1                       #Firmware =<V1.4 (un-comment) 
       #units =W,W,W,W,V,C                              #Firmware =<V1.4 (un-comment)



    [[15]]
        nodename = emontxshield_15
        [[[rx]]]
            names = power1, power2, power3, power4, vrms
            datacodes = h, h, h, h, h
            scales = 1.0, 1.0, 1.0, 1.0, 0.01
            units = W, W, W, W, V

    [[13]]
        nodename = emontxshield_13
        [[[rx]]]
            names = power1, power2, power3, power4, vrms
            datacodes = h, h, h, h, h
            scales = 1.0, 1.0, 1.0, 1.0, 0.01
            units = W, W, W, W, V

[[99]]
    nodename = my-serial-device
    [[[rx]]]
       names = power1, power2, power3, power4, vrms
       datacode = 0      # not essential as "0" is default datacode for serial interfacer
       scale = 1         # not essential as "1" is default scale for serial interfacer
       units =W,W,W,W,V

Has this something to do whith my problem?

What you need to do is make the serial output send exactly the same format as the radio, and that’s spelled out in the data structure “payload”. If that isn’t exactly right for what emonHub expects, the entire packet will be rejected because it is “corrupted”.

Broadly speaking, yes.

Is this the software you are using?

or is it the custom file you edited for calibration?

If it is either of these, then the KEY:VALUE format of the OEM Interfacer should work for you. You must make sure nothing else in your RPI is using or trying to use the same USB port.

Hello Robert,

Yes these are the scrips i use. espescyaly the edit from Trystan.

It has workt fine sins then but recent it stops. I find out that the ESP dint work anymore. I tried to replace it, I got 5 of them in stock. But that dint work. I have problems to flash one of even erase the old flasch.

Therefore I connect the HP monitor direct RX-TX to the Py. Now I can see the values coming in in the Emonhub log but no Inputs.

Now I also tried also to connect the HP in to the USB from the Py.
Now the EmonHub log gives next log.

2023-10-19 19:17:52,482 DEBUG    USB0       Msg:43,OEMct1:784,OEMct2:473,OEMct3:0,OEMtotaal:1257,Vrms:0.00, Vrms1:0.00, Irms1:3.30, Irms2:1.99, Irms3:0.00
2023-10-19 19:18:02,526 DEBUG    USB0       Msg:44,OEMct1:785,OEMct2:475,OEMct3:0,OEMtotaal:1260,Vrms:0.00, Vrms1:0.00, Irms1:3.30, Irms2:2.00, Irms3:0.00

Values coming in but no inputs.

Hier the admin log. is this OK?

<details><summary>LAST ENTRIES ON THE LOG FILE</summary><br />
2022-11-26 20:23:38.332|WARN|emoncms_mqtt.php|Not connected, retrying connection<br />
2022-11-26 20:23:38.484|WARN|emoncms_mqtt.php|Connecting to MQTT server: Connection Accepted.: code: 0<br />
2023-10-17 20:31:42.-267|WARN|index.php|406 Not Acceptable|niceports/Trinity<br />
2023-10-17 20:50:16.053|WARN|index.php|406 Not Acceptable|main-2<br />
2023-10-17 21:02:57.289|WARN|emoncms_mqtt.php|Not connected, retrying connection<br />
2023-10-17 21:02:57.323|WARN|emoncms_mqtt.php|Connecting to MQTT server: Connection Accepted.: code: 0<br />
2023-10-17 21:07:23.395|WARN|emoncms_mqtt.php|Not connected, retrying connection<br />
2023-10-17 21:07:23.431|WARN|emoncms_mqtt.php|Connecting to MQTT server: Connection Accepted.: code: 0<br />
2023-10-17 21:26:29.-135|WARN|index.php|406 Not Acceptable|main-2<br />
2023-10-18 07:11:30.237|WARN|index.php|406 Not Acceptable|main-1<br />
2023-10-18 07:47:04.492|ERROR|index.php|Not Authenticated|feed/list<br />
2023-10-19 18:22:07.273|WARN|device_model.php|Device model: Requested device does not exist for id=6<br />
2023-10-19 18:22:17.-402|WARN|device_model.php|Device model: Requested device does not exist for id=9<br />
2023-10-19 18:35:47.-416|WARN|emoncms_mqtt.php|Not connected, retrying connection<br />
2023-10-19 18:35:47.-256|WARN|emoncms_mqtt.php|Connecting to MQTT server: Connection Accepted.: code: 0<br />
2023-10-19 19:06:04.096|WARN|emoncms_mqtt.php|Not connected, retrying connection<br />
2023-10-19 19:06:04.159|WARN|emoncms_mqtt.php|Connecting to MQTT server: Connection Accepted.: code: 0</details><br />

When posting code or output, please put 3 ‘backticks’ (normally found at the top left of the keyboard) on a line of their own before the code, and 3 more backticks also on a line of their own after the code:

```
code
```

If it is something like php you can add a language identifier after the first 3 backticks: ```php or even ```text if you don’t want any language markup applied.

Unfortunately, I do not know enough about how emonHub and emonCMS work internally. You need someone who knows more about this than I do.
@TrystanLea Can you take over here please?

Hello @Frans I imagine you have solved this by now?

You want to replace:

[[SerialDirect]]
     Type = EmonHubSerialInterfacer
      [[[init_settings]]]
           com_port = /dev/ttyUSB0      # or /dev/ttyAMA0 or/dev/ttyACM0 etc
           com_baud = 115200              # to match the baud of the connected device
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,

with:

[[EMONHP]]
     Type = EmonHubOEMInterfacer
      [[[init_settings]]]
           com_port = /dev/ttyUSB0      # or /dev/ttyAMA0 or/dev/ttyACM0 etc
           com_baud = 115200              # to match the baud of the connected device
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,

That should read in the data format you are getting from the HeatpumpMonitorTH

Assuming that you have an updated raspberrypi emonsd image?

Thanks for the replay.

Yes i have a new Raspberry image.

I did already try the settings like you given but without success.
Then I did go to start new with the original sketch --HeatpumpMonitor_AutoTemp_MultiPage – and load that. Then I became the inputs in the Pi.
Then I modified this to the sketch I got from you okt 20 and it is still working.

Except the line ‘’ OEMct1.calcVI(20,2000); ‘’ by compilation I get the error ‘’ it is a non-class type ‘int’
Peek says no definition find for ‘calcVI’

I had an EME Conto D4-Pd kWh meter type CE4DT06A2 in stock. It has a pulse output.
I am now struggling to get the pulls count working. Etch pulse is 10 Wh


Hello,
I have now connected the powerpuls from the EME kWh meter.
Now I get a graphic from the inputs who are fluctuating very heavy.
Can you tell me what I an doing wrong.