EmonTX to Rpi - Direct Serial Connection

spot on with /dev/serial0 I now have some data coming through


although not consistent and lots of errors

amended the conf file further to rem out the [[RFM2Pi]] section and it seems to have solved it.

my interfaces section now looks like this

[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 = 115200
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,


### This interfacer manages the RFM12Pi/RFM69Pi/emonPi module
#[[RFM2Pi]]
#    Type = EmonHubJeeInterfacer
#    [[[init_settings]]]
#        com_port = /dev/ttyAMA0
#        com_baud = 38400                        # 9600 for old RFM12Pi
#    [[[runtimesettings]]]
#        pubchannels = ToEmonCMS,
#        subchannels = ToRFM12,
        

       group = 210
        frequency = 433
        baseid = 5                              # 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 = 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/

[[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

Yes /dev/ttyAMA0 and /dev/serial0 are probably the same physical port.

Thanks again for your help I have something working, just need to extend two of the CT clamps and then will be in business.

That makes sense. With it enabled, you had a com port conflict. i.e. two devices were configured to use the same serial port at the same time.

1 Like

I’m trying to do this with an RPi Zero on a new shop emonTX (not modified in any way).

Can anyone tell me the difference between the EmonHubSerialInterfacer and the EmonHubTx3eInterfacer please?

Glyn did, way back:

1 Like

Thanks.

I got this running quite easily in the end

Next question, to power the emonTX via the RPi (so I only use 1 power supply), do I need to do anything other than remove the DC supply from the emonTX and connect the 5V from the RPi to the emonTX?

I do also have a 9V AC/AC PS connected.

You can leave the emonTx powered by the a.c. adapter if you wish - it might be cleaner than the PI’s 5 V.

Otherwise, feed it the Pi’s 5V and pull the jumper off so that you don’t backfeed the “a.c.” supply regulator.

That was what I wondered if I needed to do.

I’ll just leave it ‘as is’ and supply the emonTX via DC and AC and the Pi by a separate DC.

Cheers

That’ll ensure each component gets enough current, but it’s also a good idea to bond
them all together via their respective “ground” connections to ensure a common earth.

That sounded a bit like blah blah blah fryingpan

You’ll need to explain that a bit more… :grinning:

The idea is to tie the components together via a single connection from each component, then
earthing that connection. The “connection” is usually a chassis or “frame,” but lacking that, the negative power terminal on each component can be used. Doing that keeps all of the voltages referenced to a common point.

It’s a lesson I learned when I did GPS testing for the USAF.

“Component” means the Pi, the emonTx, and anything else that is powered.

Ok, but how could I do that? All I have exposed is the ground pin.

Connect the grounds from each device to a common point.

e.g. connect the negative leads of all your power supplies to that common point.

Bonding the various components to a common point ensures all of the signals are referenced to the same “ground.” That can help keep serial datacomm (as well as other electronic devices) from acting strange.

Grounding, or earthing, is for safety. Given the low voltages involved in an emonTx and RaPi,
there’s not much of a safety hazard. Nevertheless, it’s not a bad idea to connect the common point
to earth to keep static charge buildup to a minimum.

But practically, how would you do that? All 3 power supplies are plugged into the same power strip and the ground pins are connected. I cannot see that I can do any more.

What you must not do is ground one side of the a.c adapter if you’re using an emonTx V2, because that’s connected to the 1.65 V rail, though you can use one a.c. adapter with many emonTx V2’s (but not a mix of V2 & V3).

For all the rest (emonTx V3 & emonPi), the barrel of the a.c. connector is GND to the p.c.b., hence to any other device that’s connected via the RJ 45, the FTDI connector or the screw terminals.

1 Like

Sorry 'bout that, Brian.

I should have been a bit more specific with my description.
When I mentioned connecting the negative side of the power supplies together,
I took it you’d understand I was referring to the DC side of the PSUs. :wink:

1 Like

Next stage, I have now powered the PiZero, with a WiFi dongle attached, from the emonTX 3.3V output.

Seems perfectly stable and should be fine looking at the specs.

You may wonder why I’m doing this.

  1. It is mostly a proof of concept
  2. I’ve become less convinced over time with the ESP8266 devices. My experience of the Wi-Fi has been poor.
  3. This runs a standard emonhub so if there are issues at the receiving end and you are using the HTTP interface, it buffers the data.
  4. Cost. A PiZeroW is less than a tenner. Yes you need an SD Card, headers and wire (or jumpers).

YMMV.

[edit]
The power should be to the 3.3V not 5V as seen in the photo.
The power should be to the 5V not 3.3V as seen in the photo.

1 Like

@TrystanLea can I upload a bin file to the emonTX directly from the Pi? I don’t think I’d try and compile the file though :grin:.

Providing you have connected both the rx and tx lines of the serial comms, you can simply add a chip reset wire and use avrdude with rpi-avrdude as described in the rfm2pi wikis. I used to do it all the time at one stage.

Are you saying you are powering the zero from the ac:ac adapter via the emontx? I’ve never tried that as I expected the zero to significantly deform the voltage waveform at the very least.

IMO in all aspects the zero is superior to the esp method and factoring in the price and the sdcard, it’s still a winner. Even more so when hosting emoncms on it too (i know you prefer to seperate them though) for an all in one solution like an emonpi with 4cts for considerably less money.