Skip to main content
Home
for DLMS smart meters

Main navigation

  • Home
  • Products
  • About us
  • Open Source
  • Community
  • Forum
  • Downloads
User account menu
  • Log in

Breadcrumb

  1. Home
  2. Serial Number Data Type

Serial Number Data Type

By technoshell, 5 June, 2025
Forums
Gurux.DLMS

Good Morning Sir,

I am using Arduino client code on ESP32 to read meter in MR mode with LLS. I am able to read the Manufacturer name and Active Energy successfully. But when I read Serial Number with obis code 0.0.96.1.0.255 I get the ASCII string on HPL meter but a Octet String on Secure Meter.
I use the code as under
cosem_init(BASE(ldn), DLMS_OBJECT_TYPE_DATA, "0.0.96.1.0.255"); // OBis for Serial No
com_read(BASE(ldn),2); // Read
obj_toString(BASE(ldn), &data);

How to identify what type of data is received octet string or normal string. ?Accordingly we can call for respective translation code.

Thank You and Best Regards
Technoshell

Profile picture for user Kurumi

Kurumi

2 weeks 3 days ago

Hi, You can check the…

Hi,

You can check the variant type like this:

if (ldn.value.vt == DLMS_DATA_TYPE_OCTET_STRING){
...
}
else if (ldn.value.vt == DLMS_DATA_TYPE_STRING){
...
}

BR,
Mikko

technoshell

2 weeks 3 days ago

I think it was Hex coded. It…

I think it was Hex coded. It showed up when I put in on Hex to ASCII converter. I will check sir. Thank you so much for your help.

technoshell

2 weeks 3 days ago

Sir , ldn.vt throws error…

Sir ,
ldn.vt throws error. Intellisense shows ldn has only two attributes one is base and other is value. Please advise.

Bet Regards

Profile picture for user Kurumi

Kurumi

2 weeks 3 days ago

Hi, My bad. The value is…

Hi,

My bad. The value is missing from the example code. I updated the code.

BR,
Mikko

technoshell

2 weeks 2 days ago

Thank You Sir. I wanted to…

Thank You Sir.
I wanted to read the serial number so I used the code

int com_readNamePlateSrno()
{
unsigned char i;
int ret;
char* data = NULL;
gxData ldn;
//Initialize connection.
ret = com_initializeConnection();
if (ret != DLMS_ERROR_CODE_OK)
{
GXTRACE_INT(PSTR("F"), ret);
return ret;
}

cosem_init(BASE(ldn), DLMS_OBJECT_TYPE_DATA, "0.0.96.1.0.255"); // OBis for Serial No
com_read(BASE(ldn),2); // Read

obj_toString(BASE(ldn), &data);

Serial2.print(data);

obj_clear(BASE(ldn));

free(data);

}

The result shows
Index: 2 Value: 54308521<CR><LF>

The Serial number is correctly read as 54308521
But soon after printing the above the program hangs and prints continues garbage.

Is there something wrong I am doing?

Thanks and Regards

Profile picture for user Kurumi

Kurumi

2 weeks 2 days ago

Hi, You need to close the…

Hi,

You need to close the connection after you have read the data. Now you leave it open and I believe that next com_initializeConnection is failing.

It's also important that you check that com_read is successful. The reading might sometimes fail.

BR,
Mikko

technoshell

2 weeks ago

Thank you sir. This worked…

Thank you sir. This worked well on the old version of Arduino code. I then downloaded the latest version to work with Encryption and facing some issues. But I will create a separate topic for this. Thanks once again

  • Log in or register to post comments
  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Thu, 06/19/2025 - 09:33
    Gurux.DLMS.Python 1.0.185
  • Wed, 06/18/2025 - 15:11
    Gurux.DLMS.Python 1.0.184
  • Wed, 06/18/2025 - 10:05
    Gurux.DLMS.Python 1.0.183
  • Wed, 06/18/2025 - 09:06
    GXDLMSDirector 9.0.2506.1801
  • Wed, 06/18/2025 - 08:41
    Gurux.DLMS.Net 9.0.2506.1801

New forum topics

  • object list not get downloaded for firmware upgrade association
  • HLS GMAC L+G 570
  • Unable to read parameter values from Landis+Gyr E550 meter using GXDLMSDirector - NoAccess status
  • data.SetComplete(false); But all data recieved
  • Crash (endless loop)
More
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin