0

Last week I connected single-phase meter sdm120 to Raspberry pi. The code below worked find.

However, when I try connecting to the DDS024MR meter now, it shows no communication at all. I tried changing ports, etc. What did I do wrong? please help me.

#!/usr/bin/env python3

import time
import minimalmodbus

rs485 = minimalmodbus.Instrument('/dev/ttyUSB0', 1)
rs485.serial.baudrate = 1800
rs485.serial.bytesize = 8
rs485.serial.parity = minimalmodbus.serial.PARITY_EVEN
rs485.serial.stopbits = 1
rs485.serial.timeout = 1
rs485.debug = False
rs485.mode = minimalmodbus.MODE_RTU
print (rs485)

Volts_A = rs485.read_float(0, functioncode=4, number_of_registers=4)
#Volts_B = rs485.read_float(2, functioncode=4, number_of_registers=2)
#Volts_C = rs485.read_float(4, `functioncode`=4, number_of_registers=2)
#Current_A = rs485.read_float(8, functioncode=4, number_of_registers=2)
#Current_B = rs485.read_float(0A, functioncode=10, number_of_registers=2)
#Current_C = rs485.read_float(0C, functioncode=10, number_of_registers=2)
#Active_PowerA = rs485.read_float(10, functioncode=10, number_of_registers=2)
#Reactive_PowerA = rs485.read_float(1A, functioncode=10, number_of_registers=2)
#Power_Factor = rs485.read_float(2A, functioncode=10, number_of_registers=2)
#Frequency = rs485.read_float(36, functioncode=4, number_of_registers=4)
#Total_Active_Energy = rs485.read_float(00, functioncode=10, number_of_registers=2)
#Total_Reactive_Energy = rs485.read_float(00, functioncode=10, number_of_registers=2)

print ('Voltage: {0:.1f} Volts'.format(Volts_A))
#print ('Voltage: {0:.1f} Volts'.format(Volts_B))
#print ('Voltage: {0:.1f} Volts'.format(Volts_C))
#print ('Current: {0:.1f} Amps'.format(Current_A))
#print ('Current: {0:.1f} Amps'.format(Current_B))
#print ('Current: {0:.1f} Amps'.format(Current_C))
#print ('Active power: {0:.1f} Watts'.format(Active_Power))
#print ('Reactive power: {0:.1f} VAr'.format(Reactive_Power))
#print ('Power factor: {0:.1f}'.format(Power_Factor))
#print ('Frequency: {0:.1f} Hz'.format(Frequency))
#print ('Total active energy: {0:.3f} kwh'.format(Total_Active_Energy))
#print ('Total reactive energy: {0:.3f} kvarh'.format(Total_Reactive_Energy))
#print ('Current Yield (V*A): {0:.1f} Watt'.format(Volts * Current))
Parzival
  • 2,051
  • 4
  • 14
  • 32
marta
  • 1
  • 1
  • 1
    Hello Marta. Your baud rate seems to be wrong. You should try only the values accepted by the meter. According to the manual, those are: 1200, 2400, 4800, or 9600. – Marcos G. Apr 07 '21 at 07:04
  • @MarcosG. I did change that to 9600. It still shows no communication – marta Apr 07 '21 at 11:28
  • good, but you should check all connection details. Are you sure the baud rate is 9600. If somebody else used that meter before maybe it does not have default values anymore. What about the device ID? Are you sure it's 1? If you are sure of the configuration maybe you have a hardware issue: is the wiring correct? – Marcos G. Apr 07 '21 at 12:34
  • https://www.dropbox.com/s/o0csudhh3otop8l/DDS578R.pdf?dl=0 – marta Apr 07 '21 at 12:36
  • Here I a manual. I think I’m reading it correctly. I’m new to those things. Is it possible I have to do configuration of the code ? – marta Apr 07 '21 at 12:37
  • yes, I've already seen the manual. But in there you will find the default values. – Marcos G. Apr 07 '21 at 12:38
  • as long as the port configuration is the same as the one expected by the device (same baud rate, data bits, stop bits, and device ID) your code should be fine. If you want to be completely sure you can set your code aside and use something like [QModMaster](https://sourceforge.net/projects/qmodmaster/) and try to connect to the device and read registers – Marcos G. Apr 07 '21 at 12:43
  • Do I read it correctly? Bauderate : 9600, data bits: 1, stop bits1. – marta Apr 07 '21 at 17:13
  • Yes, that's what I understood too. But the manual is not very clear or well-written. – Marcos G. Apr 07 '21 at 17:41

0 Answers0