emonTx Arduino Shield v2.4 usable to send data to a pi or homeassisant?

Thanks borpin.

Yeah I have the Tx to Tx.

I will do the back tick thing.

I cant run those commands as I can’t log into the pi via ssh. I took the card out and created /boot/ssh but still connection refused.

Any other way I can get you the log?

@borpin
Brian - you don’t need to swap wires if the output is getting into emonHub.

@dazzle_rsa
The output format you now have - you can see on the serial monitor - is in “key:value,” pairs. That’s the correct format for the EmonHubTx3eInterfacer, which is the one you have commented out.

Put that back in, and I think you should start seeing something.

Did you wait for it to fully boot?

Do it again and make sure (if creating the file in windows) it did not add an extension to the filename.

Add a monitor and keyboard.

That is still to be confirmed. The serial above is, I think, connected via the IDE. - COM18 is the clue I think.

Looking at the photos, the wires looked reversed.

I looked, but couldn’t tell from those.

When Darryl enables the correct interfacer, that’s one problem out of the way. At least we now know what’s actually coming out of his Shield.

I’ve spent quite a while ploughing through diagrams. Using the emonPi Shield drawing, and confirmed by the photo in the Wiki, I think the full serial connections are this:

Shield Signal Raspberry Pi
Name Pin Pin Name
GND 1 GND 6 GND
5 V 3 Power 2 5 V
“Tx” 4 ←data 8 Tx
“Rx” 5 data→ 10 Rx
RST 6 Reset 7 GPIO 4

Note: The Shield V2.4 and emonTx V3.4 send on the “Rx” pin and receive on the “Tx” pin. The emonTx V3.2 is labelled correctly.
The pin numbers (counting GND = 1) will always be correct.

For one-way data, with no programming from the Pi, only GND, 5 V & Data → are required.

Wiring diagram

And my wiring…

:+1: I’d completely forgotten that. It’s now in my “fount of all knowledge” file. The picture is much better than the Wiki one. And as for the wiring diagram or schedule in the Wiki…

1 Like

Hi Guys

Ok so this is where I am currently at after the suggestions:

This is the wiring I am using:

The data in the serial monitor of Arduino IDE is Key Value pairs:
image

My emonhub.conf:

#######################################################################
#######################      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
### Uncomment this to also send to syslog
# use_syslog = yes
#######################################################################
#######################       Interfacers       #######################
#######################################################################

[interfacers]

### This interfacer manages the EmonTx3 ESP format serial
[[SerialTx3e]]
     Type = EmonHubTx3eInterfacer
      [[[init_settings]]]
           # Un-comment line below if using RS485 adapter
           com_port = /dev/serial0
         #com_port = /dev/ttyRS485-0
         # default com port if using USB to UART adapter
         #com_port= /dev/ttyUSB0
           com_baud = 9600
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,

[[SerialDirect]]
     Type = EmonHubSerialInterfacer
      [[[init_settings]]]
           com_port = /dev/ttyAMA0      # or /dev/ttyAMA0 or/dev/ttyACM0 etc
           com_baud = 9600              # to match the baud of the connected device
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,
           read_interval = 10
            nodename = 6

        group = 210
        frequency = 433
        baseid = 6                             # emonPi / emonBase nodeID
        calibration = 230V                      # (UK/EU: 230V, US: 110V)
        quiet = true                            # Disable quite mode (default enabled) to enable RF packet debugging, show packets which fail crc
        # interval =  300                         # Interval to transmit time to emonGLCD (seconds)
        

[[MQTT]]

    Type = EmonHubMqttInterfacer
    [[[init_settings]]]
        mqtt_host = 127.0.0.1
        mqtt_port = 1883
        mqtt_user = emonpi
        mqtt_passwd = emonpimqtt2016

    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        subchannels = ToRFM12,

        # 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/

[[emoncmsorg]]
    Type = EmonHubEmoncmsHTTPInterfacer
    [[[init_settings]]]
    [[[runtimesettings]]]
        pubchannels = ToRFM12,
        subchannels = ToEmonCMS,
        url = https://emoncms.org
        apikey = xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
        senddata = 1                    # Enable sending data to Emoncms.org
        sendstatus = 1                  # Enable sending WAN IP to Emoncms.org MyIP > https://emoncms.org/myip/list
        sendinterval= 30                # Bulk send interval to Emoncms.org in seconds

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

[nodes]

## See config user guide: https://github.com/openenergymonitor/emonhub/blob/emon-pi/conf/emonhub.conf

[[5]]
    nodename = emonpi
    [[[rx]]]
        names = power1,power2,power1pluspower2,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

[[6]]
    nodename = emonTxShield
    firmware = emonTxShield
    hardware = emonTxShield
    [[[rx]]]
       names = power1, power2, power3, power4, Vrms
       datacode = h
       scales = 1,1,1,1,0.01
       units =W,W,W,W,V

[[7]]
   nodename = emontx4
   [[[rx]]]
      names = power1, power2, power3, power4, vrms, temp1, temp2, temp3, temp4, temp5, temp6, pulse
      datacodes = h,h,h,h,h,h,h,h,h,h,h,L
      scales = 1,1,1,1,0.01,0.1,0.1, 0.1,0.1,0.1,0.1,1
      units = W,W,W,W,V,C,C,C,C,C,C,p

Enabling the EmonHubTx3eInterfacer has made no difference.
Here is the EmonHub Log:

2021-03-14 21:46:07,797 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2021-03-14 21:46:07,800 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2021-03-14 21:46:07,802 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2021-03-14 21:46:07,803 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2021-03-14 21:46:07,805 WARNING  MainThread Setting emoncmsorg apikey: obscured
2021-03-14 21:46:07,806 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2021-03-14 21:46:07,807 INFO     MainThread Setting emoncmsorg senddata: 1
2021-03-14 21:46:07,808 INFO     MainThread Setting emoncmsorg sendstatus: 1
2021-03-15 08:09:56,860 INFO     MainThread Creating EmonHubTx3eInterfacer 'SerialTx3e'
2021-03-15 08:09:56,862 DEBUG    MainThread Opening serial port: /dev/serial0 @ 9600 bits/s
2021-03-15 08:09:59,709 DEBUG    MainThread Signal 15 received.
2021-03-15 08:09:59,753 INFO     MainThread Exiting hub...
2021-03-15 08:09:59,993 INFO     MainThread Exit completed
2021-03-15 08:10:03,010 INFO     MainThread EmonHub emonHub (emon-pi variant) v2.1.5
2021-03-15 08:10:03,012 INFO     MainThread Opening hub...
2021-03-15 08:10:03,013 INFO     MainThread Logging level set to DEBUG
2021-03-15 08:10:03,014 INFO     MainThread Creating EmonHubTx3eInterfacer 'SerialTx3e'
2021-03-15 08:10:03,018 DEBUG    MainThread Opening serial port: /dev/serial0 @ 9600 bits/s
2021-03-15 08:10:03,020 INFO     MainThread Creating EmonHubSerialInterfacer 'SerialDirect'
2021-03-15 08:10:03,023 DEBUG    MainThread Opening serial port: /dev/ttyAMA0 @ 9600 bits/s
2021-03-15 08:10:03,024 DEBUG    MainThread Setting SerialDirect pubchannels: ['ToEmonCMS']
2021-03-15 08:10:03,026 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2021-03-15 08:10:03,030 DEBUG    MainThread Setting MQTT pubchannels: ['ToEmonCMS']
2021-03-15 08:10:03,031 DEBUG    MainThread Setting MQTT subchannels: ['ToRFM12']
2021-03-15 08:10:03,032 INFO     MainThread Setting MQTT node_format_enable: 1
2021-03-15 08:10:03,032 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2021-03-15 08:10:03,033 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2021-03-15 08:10:03,034 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2021-03-15 08:10:03,036 DEBUG    MainThread Setting emoncmsorg pubchannels: ['ToRFM12']
2021-03-15 08:10:03,037 DEBUG    MainThread Setting emoncmsorg subchannels: ['ToEmonCMS']
2021-03-15 08:10:03,038 WARNING  MainThread Setting emoncmsorg apikey: obscured
2021-03-15 08:10:03,038 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2021-03-15 08:10:03,039 INFO     MainThread Setting emoncmsorg senddata: 1
2021-03-15 08:10:03,040 INFO     MainThread Setting emoncmsorg sendstatus: 1

And my feeds:

No data in any of them.

What on earth am I missing, I have a feeling it is something small.

So now you need to SSH into the Pi and connect to the shield via miniterm (as I have said before).

The other problem is you are creating 2 interfaces - only one can be correct. BUT connect via miniterm to check the port is receiving the data.

[edit]
The other thing is that you have pubchannels and subchannels wrong.

It is like MQTT - an interfacer publishes data abd subscribes to receive data (internally within emonhub).

So the Serial interface is receiving data from the serial and wants to publish it to another interfacer to send it on (MQTT/HTTP)

In the serial interfacer then you want to publish the data to another channel so you need a pubchannels entry (note this is an array so there is a trailing comma).

If you are sending the data via MQTT, you have a corresponding subchannels entry.

swap your sub and pub around thus…

[[MQTT]]

    [[[runtimesettings]]]
        subchannels = ToEmonCMS,
        pubchannels = ToRFM12,

(same in EmonCMS interfacer).

Still cant ssh. not sure why

Created the file, with no extension and connection refused.

Note my edit above.

Most likely you have the wrong IP address.

The only option is to connect a monitor (to check the IP address allocated) and then a keyboard to fix it.

Tx, Should I disable one, if so which one.

I am going to plug in a screen kyb. need to get this working lol

Sorry what edit?
It looks the same as my current config?

Lol, def dont have the wrong ip address.

I promise I am not a complete n00b, I am a coder in JS and full stack. Also have CCNA, CWNP etc etc etc.

Its just being a bit of a cow to me for some reason, so will connect it up the old fashioned way, lol.

No you have sub and pub channels inverted in the MQTT and emoncmsorg interfacers.

ah didnt spot that. thanks.

I am busy in the terminal now. will report back shortly

1 Like

its just sitting like this: