USB to RS485 adapter for Smart Metering


I’ve been searching the forum for a while, but couldn’t really get the information together I needed. I have a smart meter that supports RS485 and got a DSD Tech USB to RS485 stick, which is said to work with Linux and on other smart home projects, it seems to be used successfully.

However, since I’m totally new to that matter, I am stuck at the very beginning of how to use it. What I managed is to figure out where it’s linked to

# ls -la /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0
lrwxrwxrwx 1 root root 13 Mar  5 11:17 /dev/serial/by-id/usb-Silicon_Labs_CP2102_USB_to_UART_Bridge_Controller_0001-if00-port0 -> ../../ttyUSB0

and to get some more information about it

# lsusb
Bus 001 Device 007: ID 10c4:ea60 Cygnal Integrated Products, Inc. CP2102/CP2109 UART Bridge Controller [CP210x family]

but … here I am now and stuck. I understand I need to set up the Serial Binding for OpenHAB, but have no clue, what to actually put in. Unfortunately there’s not much documentation (actually none) that I have. Has anybody successfully connected a smart meter this way successfully to OpenHAB? If there’s somebody who has successfully accomplished this undertaking I would be very grateful for any help or assistance I could get, so that I manage to set things up myself. Serial communication is something I’m new to (a friend of mine said that I’m too young for it :see_no_evil: ).

Ah - and I’d at best like to publish the information from the smart meter to MQTT, but I think if I manage to get things loaded in to a thing, I’ll get the MQTT part done by myself.

Thanks a lot in advance for any help.

What language does the mystery smart meter talk? Many with an RS485 hardware interface talk Modbus protocol,but that’s not guaranteed.

That was a good first question that helped me when searching a bit. So on the specification side, I hope I got all correct is this what is said for it:

  • Modbus-RTU mode
  • 9600 bps
  • Data bit: 8
  • Parity: even
  • Stop bit: 1

I copied it but I have no Idea what I wrote there :see_no_evil:

You’d probably want to use the Modbus binding with openHAB, then. You don’t need the serial binding at all here, the modbus binding manages that for itself.

Modbus selects from many hundreds of possible devices by their “modbus ID” or “slave ID”, a numerical address.
You are going to need to know what your mystery smart meter maker set that to by default, or find out how to set it yourself.

Next, modbus selects from several thousands of different possible data sources by register address, register type, and data format (integer, float, 16, 32-bit etc.)
None of that is guessable, so you will need to work out a way to find this out for your secret make and secret model meter, how did the mystery maker define what’s available.

Thanks a lot!

OK OK - I understood the sarcasm. I went to the electricity box and looked for a name and googled for it. Here seems to be a specification of it:

I will try to figure out what you said and get that said. Anyhow, if you can give me some additional hints, that would be great!

Thanks again a lot for your help.

Ooh, three-phase!

Okeydoke, the basic connection details in the datasheet are what you’ll need to set up a Modbus binding “Serial” Bridge Thing.

What’s missing there is register details - the location of the words of data. (Modbus reads and writes only binary or 16-bit data chunks, by address, these are “registers” in modbus-speak)

A bit of googling threw up someone who has reverse engineered that info out of Orlo utility software for another project.
This looks enough to get started -

A list of registers a few posts in.
Doesn’t say what type - input or holding -but we can guess fifty-fifty. Poking around the PR for their project,looks like we want holding type.
This is information you need to make a binding Poller Thing.

Gives address and “datawidth”, we can assume that 1 is standard 16-bit and 2 means take two words and treat as 32-bit.
There’s a couple of different ways to interpret 32-bit, again we can make guesses and see if data turns out like expected.
Again from peeking at their PR, looks like float format is used for at least some readings…
This is info we need to make binding data Things.

Up to you to sort out physical connection - use twisted pair wiring.

1 Like

Thanks a lot. So - if I read you well - I use Serial Binding still instead of Modbus, don’t I?

I’ll try to get along with what you said and will report back whether I got it working (and how) or not. Yet, it seems it’s gonna take me some time, as it’s not my every-day business :see_no_evil: but one of the following week-ends should give me the time. I hoped there was already some solution available, but this way I’ll learn something new (hopefully).

Nope. Modbus binding needs to manage all its own serial business.
If you’ve made a serial binding Thing, you’ll need to get rid of it so that Modbus binding can use the serial port instead. It’s strictly one “user” at a time.

Expect this to to be a hard road - Modbus has a lot of fiddly manual configuring, and we have guesses to make. But it is essentially simple-minded, and you only have to do it once. Walk, don’t run, start by trying to read just one known datapoint, like frequency.

1 Like