Can I connect emonTx's to EmonPi via a wired connection instead of wireless?

…to avoid interference. I will soon buy an emonPi and two (perhaps 3) emonTx’s to be able to monitor all circuits I am interested on.

Unfortunately no, or at least, not easily. You can certainly connect one emonTx, but there’s no provision in the emonPi for a second serial connection, and there’s no provision in the emonTx to use a multi-drop serial protocol.

If you really need to do that, you will have to have RS 485 or similar adapters on each emonTx and emonPi, look at modifying the emonTx’s to act as slave devices (i.e. respond to a command to do a measurement and return the result) and the emonPi to act as bus master to request those measurements and process the returned values. I don’t know of anyone who has done this and reported the results. The nearest I can think of is MartinR’s “full fat three-phase monitor” in the Archived section - from memory, that used three emonTx V2’s with one acting as the master.

1 Like

I believe @pb66 (Paul) runs this and I am expecting this scenario to work on my outhouse soon.

Regards
Dave

Yes, you can use USB-serial adapters and connect up to 4 to the emonPi (without using an additional USB hub).

Search thr forum for “serial-direct” for lots of examples of connecting emonTx’s via serial, both via the GPIO which is not an option on the emonPi (because it’s occupied by the emonpi add-on board) and also via USB-serial adapters. There will be info both the physical connection and setting up emonhub to receive the data.

It’s all out there and been done many times but if you have more questions, ask away.

Another option is to use a bigger emonTX. I started building a shield based on this project : https://boredomprojects.net/index.php/projects/home-energy-monitor
In fact the shield is ready, but the code in current state is incompatible with my very old emonTX and OKG so I need to rewrite some stuff and reprogram my entire configuration to make sure it is working.
I’m also currently using MartinR’s I2C configuration suggested by @Robert.Wall. I’ve hooked up 3 emonTX slaves to 1 emonTX master giving me 12 measurements on different circuits and phases.
Here’s a picture of the new shields:

If you think that picture will be useful to the community, can you please load it here, and not on a 3rd party site? Otherwise, if/when it gets removed from there, your response above won’t be as valuable as it might have been with the picture.

I was in quick edit mode and only had access to the twitter link. Edited it now.

This is exactly what I wish to do… I figured that I needed 3 usb serial adapters
( good ftid ones )

I still have a couple of relevant questions :

  1. If I order a EmonPi now will it include wireless network connection (wifi) ?
  2. Upon ordering emonTx will it include the firmware to allow serial connection ?
  3. What is the update rate of the emonTx and can the EmonPi handle 3 via serial at 5 seconds ?
  4. If I wish to compare the pulse on my smart meter to the EmonPi data logs for accuracy is that supported ?

Hopefully I can connect all 3 emonTx to monitor my appliance rings and water heater etc via serial and have the EmonPi log the overall incoming power and potentially Solar in the future via wifi while keeping and eye on how accurate the “smart” power meter billing claims…

While I could build my own I’m happy to purchase through the shop to support the men/women/children

regards

John Jones

  1. Yes (it has the RPI model 3 inside, with an acrylic fascia to let the signal out!)
  2. I believe so - but the actual dialect of the serial data seems to be in a state of change, so some programming might be necessary.
  3. The default is 10 s, but you can change that in the sketch. A programmer will be required. The emonPi can handle that (and faster), emoncms.org will refuse.
  4. If you use and accumulate the input pulses, yes - but you’ll need to distinguish in your input processing between import and export, because I believe your meter pulses ignore export.

Not that “they” will believe you if you contest it! You’ll need to calibrate everything very carefully to get inside the accuracy band of your supplier’s meter, and you’ll need some pretty good test gear to do that.

On behalf of @glyn.hudson, @TrystanLea and @Gwil - Thank You. :thumbsup:

The emonTx V3 can be connected to the emonPi without any change in emonPi FW.

Just connect to emonPi using USB adapter and add the following to emonhub.conf:

[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/ttyRS485-0
           # default com port if using USB to UART adapter
           com_port= /dev/ttyUSB0
           com_baud = 115200
      [[[runtimesettings]]]
           pubchannels = ToEmonCMS,

It should work for multiple USB devices, by duplicating and changing USB0 to USB1. I’ve not tested this

Yes, you can connect a optical pulse sensor to the emonTx V3: Optical Utility Meter LED Pulse Sensor - Shop | OpenEnergyMonitor

I know this post is very old, but I have been all over the place trying to find a simple, concise answer .
I have a emonpi and an emonTx.
The wireless comm is poor between them.
What I want to do is wire the comm together.
I don’t think RS232 (serial) is going to work due to distance limitations (50 feet, and I need about 100 feet), so my other option is RS485.
I have a USB to RS485 adapter (assuming the emonPi end?)
I have several RS232 to RS485 adaptors with +5,gnd,DI,DE,RO,RE pins and the two A/B rs485 terminals.
This one;
https://www.amazon.com/gp/product/B088Q8TD4V/ref=ppx_yo_dt_b_asin_title_o02_s00?ie=UTF8&psc=1

First, from what I have gathered from all the different posts that i have read, it is possible, but the details are rather poor, and second, do I have the correct RS232 to RS485 adapter?
My adapter is consists of several resistors (terminating and pullup) and a MAX485 chip, with two headers and a screw terminal strip.
Don’t know how to connect the DE and RE terminals as they are enable pins.
The blog that owenduffy has shows an adaptor but NOTHING is mentioned as to WHERE/WHAT it is… not helpful!
this blog:
https://owenduffy.net/blog/?p=9942

IF I can get away with wired serial, I could, but the distance I am looking at is probably too long for that, hence the RS485.
I have tried to search for answers, but have come up empty handed (or at least too scattered as to what i want to do).

I think what you have should work, but the data that’s available for the Amnbest part is - shall we say - novel, and requires a bit of unpicking.

First,

Yes, that’s correct.

Second, the Amnbest adapter. It mentions it is half-duplex. That’s OK, you are only sending from the emonTx RS232 to the RS485, so it also means that you can permanently enable data in that direction and never enable data in the opposite direction. (Half-duplex means you can send data in both directions, but not at the same time, hence the need to enable either the receiver or the driver.)

Further down the page, you get the pin connections.
The first catch is the emonTx is NOT labelled conventionally: Tx receives data and is looking for the other Tx pin, and Rx sends data and is looking for the other Rx pin. Confusing? Absolutely.

As the Tx only ever transmits (unless you’re programming it or calibrating it, which you will need to do with the programmer connected directly instead of the RS485 adapter), you can permanently enable the driver and never enable the receiver.

A & B. These are the RS485 connections. You may or may not need the GND connection to the other end - there was a long discussion about that a few months ago - the link is lower down.
RO – Receiver Output. You don’t need to connect this - no data will be coming in. In fact, if it does, it might well corrupt the calibration of the emonTx.
RE – Receiver Output Enable. This should be pulled high to disable the receiver. According to the diagram it does have an internal pull-up, so this can be left with no connection.
DE – Driver Output Enable (high to enable) This should be pulled high to enable the receiver. According to the diagram it does have an internal pull-up, so this can also be left with no connection.
DI – Driver Input (to Tx pin of micro controller) As I wrote above, this goes to the Rx pin of the FTDI connector on the emonTx.
GND Connect to the emonTx GND (either on the FTDI or the screw connector)
VCC. Connect to the 5 V pin of the screw connector, and you’ll need the 5 V USB power to supply the emonTx - the a.c. adapter does not supply the 5 V rail, only the 3.3 V.

And I think that should work hardware-wise. I’d advise reading https://electrical-engineering-portal.com/correct-cabling-modbus-rs485 and this topic too RS485 and other sensor cabling

Despite what the first reference says about A & B legs, if it doesn’t work it’s worth swapping them and checking, because some manufacturers apparently label them wrongly.

According to Glyn’s much earlier post, you’ll need to send the data in the EmonHubTx3eInterfacer output format in your emonTx. Depending on the age of your emonTx, it might be called that or “Key:value” format.

That is what I was unsure of… thank you for clarifying that!

Yes, I have seen that in other posts, thanks again!

Once again, thank you. Makes this SO much easier!

I appreciate ALL the detail that you have given me! REALLY brings it all together and 'splains the details that I have been searching for, rather unsuccessfully. Thank you so very much!

i bought my EmonTX a couple of months ago, and when connected to Arduino terminal, I have EmonTX v. 3.4 and EmonLibCM Continuous monitoring version 2.0, so i think that is the latest version?
Isn’t there a newer FW version for the TX that supports more than 3 temperature sensors? I thought I saw that in Github… think I should try and get the RS485 working FIRST though!

Also need to get my Emonpi to talk to the RS485 to USB adaptor that i have.
I thought I read that I can SSH into the Pi and modify a file?
Also, modify and upload a file to the TX to talk RS485 and not the text that the serial is talking now?
On the TX, do I use my USB to serial converter to send the FW to the TX. I am using Arduino IDE since I am somewhat familiar with it.
Just need to get the libraries setup correctly… I always seem to have a problem with that… DARN IT!

Once again, thank you so VERY much for helping me out! It is appreciated!

My notes say that is the latest (unless it’s been changed and nobody has told me, which is highly likely).
The problem with emonLibCM is the processor is very busy, and fetching temperature readings takes an inordinate amount of time, to the point where you lose too many energy samples while the sensors are sending their data. That’s the reason for limiting the number. You can increase it - at your peril.
Here is the emonTx getting the value from just TWO temperature sensors - it takes 1½ mains cycles (nearly two for you) to do so.

RS485 is a hardware connection. It has nothing to do with the format of the data that is being carried.
If you turn RF off using the on-line settings/calibration, the output should be sent in the correct format. You don’t need the radio any more, and turning it off will prevent two sets of values arriving in emonCMS.

If your converter is equivalent to the programmer sold by the shop, then yes, you use that (with the emonTx right next to the laptop so that the programmer plugs straight in to the emonTx).

There’s a page in Learn about setting up the Arduino IDE with the 3 major operating systems. I advise you not to go near platformio - when I tried it, it effectively destroyed my OEM set-up and it took hours to put everything straight again.

Well that makes sense to limit the number of inputs to be processed. After all the Tx has 4 CT, 1 ACV, and 3 temps and 1 pulse inputs, so there is alot to process.
I was wondering why the limitation on the Tx’s 3 temp inputs vs. the Pi’s (up to) 6 temps. The Pi has MO-Power!

Yes, I am aware of the RS485/RS232/etc. just being a type of hardware communication and NOT a “data format”.
I just thought i remembered reading somewhere on this forum that the data coming out of the serial port is not formatted correctly for the Pi unless the radio is turned off, and yes, the radio does need to be turned off so that the Pi doesn’t receive two sets of data. Might also take some load off the Tx’s processor.

I did look at the Learn section, but at the time I was probably totally confused with reading all the posts, so the info didn’t make sense. I will revisit that section.
I did try platformio a while back and didn’t really like it. I will NOT go near it now after hearing that it totaled your setup… and I am somewhat familiar with Arduino after using it with my 3D printer controller. Just been a while…

Thank You for being patient with me and offering all your help! I does get frustrating reading some many different posts and trying to make sense of it all, but the information is there!

My USB to UART converter seems to work ok. It is 5/3.3v switchable and I have been using it to monitor the TX while it is running using Arduino’s monitor. I just haven’t talked to the TX yet.
I just have to use short jumpers between the TX and converter, with 5v/gnd/tx/rx connected… seems to work ok!
I am taking a read of the learn section now and will dive into it NOW that you have helped me so much!

I think the library lists need to be updated - I’ll look at that.

Indeed it does. The additions are:

Library Link Notes
emonEProm https://community.openenergymonitor.org/uploads/short-url/eSkSOEesXkOL2FtaMCkrzhnUAOF.zip Manages the EEPROM when saving config & energy values
rfmTxLib https://community.openenergymonitor.org/uploads/short-url/2itZ1bA7J0D1bfJO2byhattak9U.zip Transmit-only - message format is compatible with JeeLib.
  The following are NOT compatible with JeeLib and the RFM12B and the RFM69 in ‘compatibility’ mode (i.e. using “#define RF69_COMPAT 1”).
rf69 https://community.openenergymonitor.org/uploads/short-url/5aI8TKgQAIJqOGOIH5443qD1oz1.zip RFM69 ‘Native’ format - does not check for a busy radio channel
rfm69nTxLib https://community.openenergymonitor.org/uploads/short-url/pv8ewlR5XzEfB8M4Qge6ekUIlOR.zip RFM69 ‘Native’ format version of rfmTxLib

True, the Pi does have more power.

But, the front-end processor used in the emonPi is the same ATMEGA 328p that’s in an emonTx.

The emonPi’s front-end is essentially a stripped-down version of the one used in the EmonTx.

Well still having problems.
I received a proper serial to RS485 adaptor, with the controller chip and rx/tx in/outs and +5 and gnd and A/B for the 485 bus, and connect only the +5, gnd, and Rx pins on the emonTx’s programming header.
The RX light on the RS485 adapter blinks when sending, so I have the correct pins.

I used Glyn’s addition to emonhub.conf and changed it for a sUB to RS485 adapter:

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

and this is what I got in the log (spoiler alert… ERRORS)

2021-08-31 05:16:10,130 INFO     MainThread Opening hub...
2021-08-31 05:16:10,130 INFO     MainThread Creating EmonHubJeeInterfacer 'RFM2Pi'
2021-08-31 05:16:12,137 INFO     MainThread RFM2Pi device firmware version & configuration: not available
2021-08-31 05:16:12,138 INFO     MainThread Setting RFM2Pi baseid: 5 (5i)
2021-08-31 05:16:13,140 INFO     MainThread Setting RFM2Pi frequency: 433 (4b)
2021-08-31 05:16:14,142 INFO     MainThread Setting RFM2Pi group: 210 (210g)
2021-08-31 05:16:15,144 INFO     MainThread Setting RFM2Pi quiet: 1 (1q)
2021-08-31 05:16:16,147 INFO     MainThread Setting RFM2Pi calibration: 230V (1p)
2021-08-31 05:16:17,150 INFO     MainThread Creating EmonHubTx3eInterfacer 'SerialTx3e'
2021-08-31 05:16:17,152 **ERROR    MainThread [Errno 2] could not open port /dev/ttyRS485-0: [Errno 2] No such file or directory: '/dev/ttyRS485-0'**
2021-08-31 05:16:17,154 INFO     MainThread Creating EmonHubMqttInterfacer 'MQTT'
2021-08-31 05:16:17,158 INFO     MainThread Setting MQTT node_format_enable: 1
2021-08-31 05:16:17,159 INFO     MainThread Setting MQTT nodevar_format_enable: 1
2021-08-31 05:16:17,159 INFO     MainThread Setting MQTT nodevar_format_basetopic: emon/
2021-08-31 05:16:17,161 INFO     MainThread Creating EmonHubEmoncmsHTTPInterfacer 'emoncmsorg'
2021-08-31 05:16:17,163 INFO     MainThread Setting emoncmsorg apikey: set
2021-08-31 05:16:17,163 INFO     MainThread Setting emoncmsorg url: https://emoncms.org
2021-08-31 05:16:17,164 INFO     MainThread Setting emoncmsorg senddata: 1
2021-08-31 05:16:17,165 INFO     MainThread Setting emoncmsorg sendstatus: 1
2021-08-31 05:16:17,462 INFO     MQTT       Connecting to MQTT Server
2021-08-31 05:16:17,567 INFO     MQTT       connection status: Connection successful
2021-08-31 05:16:17,568 INFO     emoncmsorg sending: https://emoncms.org/input/bulk.json? data=[[1630383377.200861,5,1414.5,-1.05,2828,240.82614,21,20.8,21,21,21,0,3]]&sentat=1630383377&apikey=E-M-O-N-C-M-S-A-P-I-K-E-Y
2021-08-31 05:16:17,673 INFO     MQTT       on_subscribe
2021-08-31 05:16:19,087 INFO     MQTT       Publishing 'node' formatted msg

So OBVIOUSLY I am doing something wrong, or missing a step…

I tried verifying the FW with Arduino, selecting the atmega 328p xplained mini, and the verify failed. Isn’t this the correct board?

I want to disable the radio, but according to what Glyn wrote, no FW mod is needed, just add the lines to emonhub.conf like I tried, but that didn’t work…
REALLY stumped! (obviously not enough knowledge… but I’m trying!)

A little more testing tonight…
I connected to the emonTx, disabled the radio (x0), saved to eeprom (s), exit (x) and the emonTx continued to run.
I disconnected my serial to USB converter, and connected my serial to RS485 converter and the Rx light on the converter flashed in sync with the emonTx’s activity led.

I copied and pasted Glyn’s code from above and uncommented the line for Rs485, and commented the ttyUSb0 line (I thought that was for direct serial and not RS485.

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

Log shows that it cannot open port and no data, so something is different between what Glyn posted and how the EmonPi is now…OUI!