Sdm120

Added an SDM120 modbus meter on the supply for my new ASHP and connected to my emonpi via the adapter bought from our hosts.

I’ve copied the config as detailed here (EmonHub Interfacers - Guide | OpenEnergyMonitor) and the log is showing …

2022-09-06 08:53:33,363 INFO MainThread Creating EmonHubMinimalModbusInterfacer ‘SDM120’
2022-09-06 08:53:33,364 INFO MainThread Connecting to Modbus device=/dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0 baud=2400
2022-09-06 08:53:33,365 INFO MainThread Setting SDM120 read_interval: 10
2022-09-06 08:53:33,366 INFO MainThread Setting SDM120 nodename: sdm120
2022-09-06 08:53:33,366 INFO MainThread Setting SDM120 prefix:
2022-09-06 08:53:33,367 ERROR MainThread Unable to create ‘SDM120’ interfacer: sequence item 0: expected str instance, int found

Any ideas?

1 Like

Do you see the USB device listed on the emonpi?

And does it match device = /dev/ttyAMA0

pi@emonpi:/dev/serial/by-id $ lsusb
Bus 001 Device 005: ID 1a86:7523 QinHeng Electronics HL-340 USB-Serial adapter
Bus 001 Device 004: ID 0403:6001 Future Technology Devices International, Ltd FT232 Serial (UART) IC
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
pi@emonpi:/dev/serial/by-id $ lsusb -t
/:  Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M
    |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M
        |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M
        |__ Port 2: Dev 4, If 0, Class=Vendor Specific Class, Driver=ftdi_sio, 12M
        |__ Port 4: Dev 5, If 0, Class=Vendor Specific Class, Driver=ch341, 12M
pi@emonpi:/dev/serial/by-id $ ls -l
total 0
lrwxrwxrwx 1 root root 13 Sep  5 18:17 usb-1a86_USB2.0-Ser_-if00-port0 -> ../../ttyUSB1
lrwxrwxrwx 1 root root 13 Sep  5 18:17 usb-FTDI_USB-RS485_Cable_FT3K7S4C-if00-port0 -> ../../ttyUSB0

I have the following config …

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        [[[[meters]]]]
            [[[[[sdm120]]]]]
                address = 1
                registers = 0,6,12,18,30,70,72,74,76
                names = V,I,P,VA,PF,FR,EI,EE,RI
                precision = 2,3,1,1,3,3,3,3,3

I’d need to check when home later, but i’m sure mine is just using

device = /dev/ttyUSB0

Rather that the big long reference.
Not sure it makes any difference though? :man_shrugging:

It shouldn’t. The ttyUSBnn is subject to change whilst the id path is specific to the device.

The polarity is definitely correct - the port won’t open if it isn’t. Bit stumped now.

Looking at the code, it’s failing when parsing the config under ‘meters’. Not obvious why though

Seems the config examples online refer to the master branch of emonhub. I checked the code for the stable branch (which is what I’m on) and the config below passes muster

[[SDM120]]
    Type = EmonHubMinimalModbusInterfacer
    [[[init_settings]]]
        device = /dev/serial/by-id/usb-1a86_USB2.0-Ser_-if00-port0
        baud = 2400
    [[[runtimesettings]]]
        pubchannels = ToEmonCMS,
        read_interval = 10
        nodename = sdm120
        # prefix = sdm_
        registers = 0,6,12,18,30,70,72,74,76
        names = V,I,P,VA,PF,FR,EI,EE,RI
        precision = 2,3,1,1,3,3,3,3,3

However I’m now getting …

2022-09-06 11:36:13,131 ERROR    SDM120     Could not read register @ 12: No communication with the instrument (no answer)
2022-09-06 11:36:14,149 ERROR    SDM120     Could not read register @ 18: No communication with the instrument (no answer)
2022-09-06 11:36:15,166 ERROR    SDM120     Could not read register @ 30: No communication with the instrument (no answer)
2022-09-06 11:36:16,184 ERROR    SDM120     Could not read register @ 70: No communication with the instrument (no answer)
2022-09-06 11:36:17,201 ERROR    SDM120     Could not read register @ 72: No communication with the instrument (no answer)
2022-09-06 11:36:18,219 ERROR    SDM120     Could not read register @ 74: No communication with the instrument (no answer)
2022-09-06 11:36:19,236 ERROR    SDM120     Could not read register @ 76: No communication with the instrument (no answer)
2022-09-06 11:36:21,046 ERROR    SDM120     Could not read register @ 0: No communication with the instrument (no answer)
2022-09-06 11:36:22,064 ERROR    SDM120     Could not read register @ 6: No communication with the instrument (no answer)

No idea why. The wires are definitely connected up OK and if I reverse them, the port won’t even open.

Maybe I need to do some config on the SDM120 itself?

Went through the config of the SDM120M and despite the documentation, the baud rate was set to 9600 so changed the emonhub config to suit and bingo.

1 Like