1
\$\begingroup\$

I'm trying to read registers from electricity meters. The meters are either Schneider A9MEM2055 or PM3255. I'm using a Waveshare RS232/485/422 to POE ETH gateway.

I'm getting modbus timeouts, which I find hard to troubleshoot.

It used to work, and now I can't get it to work anymore, although I don't see any reason why.

My code:

with ModbusTcpClient("192.168.1.200", port=4196, timeout=1) as client:
    # P3255
    result = client.read_holding_registers(0, 16, slave=5)

I double-checked the settings. The IP and port are correct, otherwise I get a network error rather than a modbus timeout.

In the meter config, I checked the slave address (5). The baudrate (9600) and the parity (even) are the ones set in the Waveshare gateway config.

Gateway modbus config

I'm reproducing the setup on my office desk. One gateway, one meter. The bus is about 15cm long. I connected TA to D0/- and TB to D1/+. I even tried switching them just to rule that out.

I'm pretty sure it used to work without either termination or ground, but just in case, I added a 120ohm resistor between the D0/- and D1/+ pins, and a cable between the Waveshare ground and the meter (not sure whether it should be on the 0V or the other one with the strange symbol but I tested both). I'd be curious to know if those are actually needed in this small setup.

PM3255 modbus wiring

The LED on the meter does blink upon modbus request, but the doc says it also blinks in case of line error, so this doesn't tell me much. It doesn't blink if I unplug a RX/TX cable but it does if I switch the cables.

I've been searching for troubleshooting tutos on the web and I'm still stuck there, clueless.

Hopefully I won't have to get my hands on a signal analyzer to dive into the electrical part of it. Not sure how much that would help anyway. I don't think the devices are broken.

From what I described, is there anything wrong with the wiring?

What could be wrong and what else can I check to further investigate this?

\$\endgroup\$
7
  • \$\begingroup\$ If it did work, but you had no ground and no termination, have you considered one of the devices is damaged? \$\endgroup\$
    – Justme
    Commented Aug 26 at 18:26
  • \$\begingroup\$ @jerome please write a specific question \$\endgroup\$
    – Voltage Spike
    Commented Aug 26 at 23:53
  • 1
    \$\begingroup\$ Well, that would be good if you could write that question down. This is a Q&A site, people need a question to answer \$\endgroup\$
    – Voltage Spike
    Commented Aug 27 at 14:44
  • 2
    \$\begingroup\$ @VoltageSpike I edited the question to make it more explicit but honestly it is still as open as before, basically "things don't work, here's what I tried, what else can I do?". \$\endgroup\$
    – Jérôme
    Commented Aug 27 at 15:13
  • 2
    \$\begingroup\$ Thanks, Reopened \$\endgroup\$
    – Voltage Spike
    Commented Aug 27 at 15:54

1 Answer 1

3
\$\begingroup\$

I got help from someone more knowledgeable on the matter and got it sorted out. There were a few issues.

Here's a few pieces of information I would have been happy to find somewhere on the Internet when I was stuck.

In the Waveshare configuration UI, there is a "Multi-Host Settings" section. I have no idea what multi-host means so I left if untouched. It appears I needed to set Protocol to "Modbus TCP to RTU". Might sound obvious, but due to the name of the section, I didn't even try anything there. I guess on my earlier working setup I touched everything and had this right.

More importantly, while the Tx-/Tx+ convention is universal, the A/B seems not to be, and it appears Waveshare and Schneider don't agree on which is A and which is B. So I got the wiring switched the wrong way. Some Schneider docs only show A/B which makes it even worse. Beware of A/B, only trust Tx-/Tx+. I did try to switch the wires but due to the other error it wouldn't work either.

My setup worked until I added devices to the bus. When I did that, I had to rewire the whole bus and this is probably when I switched Tx+/- the wrong way due to the A/B ambiguity.

I also learnt in the process that some gateways and devices support 4-wire Modbus. I tried a Teltonika gateway that has Rx+/Rx-/Tx+/Tx- pins and it wouldn't work until I connected Tx- and Rx-, and Tx+ and Rx+ together.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.