Skip to main content
Home
for DLMS smart meters
Open source solutions for DLMS smart metering

Main navigation

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

Breadcrumb

  1. Home
  2. Forums
  3. Regarding Dlms C Client Code For Arduino IDE

regarding dlms c client code for arduino IDE

Forum Rules

Before commenting read Forum rules

Don't comment the topic if you have a new question.

You can create a new topic selecting correct category from Gurux Forum and then create a new topic selecting "New Topic" from the top left.

By himanshu parmar , 16 June, 2022
Forums
Gurux.DLMS

hello,
your library is very useful and well organized. I have collected data from python dams code in raspberry pi.
Now I am doing that same from Arduino. I have copied the library and also sources, including files. program is compiled and loaded in Arduino mega. but now I didn't show any data coming from the dlms meter. what is required to collect data from the dlms meter? I have a genus electric meter.

i seen this on serial
"Start reading
~?A?Zd~~?A?Zd~~?A?Zd~Start reading
~?A?Zd~~?A?Zd~~?A?Zd~~?A?Zd~"

ans com_updateInvocationCounter failed in code.

Profile picture for user Kurumi

Kurumi

3 years 12 months ago

Hi,

Hi,

First, check your DLMS and serial port settings. The meter doesn't reply if one of the settings is invalid.
Make sure that you have updated the correct settings. Find this and update the correct settings.

Client.init(true, 16, 1, DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);

BR,
Mikko

himanshu parmar

3 years 12 months ago

Hi,

Hi,

I have configure the same as you have mentioned. I seen that arduino is transmitting through optical cable and after that receiving some context. That is
" 7E A0 07 03 41 93 5A 64 7E "

*from message to xml
" <HDLC len="9" >
<TargetAddress Value="1" />
<SourceAddress Value="32" />
<!--SNRM frame.-->
<FrameType Value="93" />
<Snrm>
</Snrm>
</HDLC> "

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

Try with this:

Client.init(true, 32, 1, DLMS_AUTHENTICATION_HIGH, "YOUR_PASSWORD", DLMS_INTERFACE_TYPE_HDLC);

Your authentication level and client address are invalid.

BR,
Mikko

himanshu parmar

3 years 11 months ago

hello,

hello,
I changed the code as you mentioned but the response is the same.
response : "7E A0 7E A007 03 41 935A 64 7E"

Can you please elaborate how to connect arduino to dlms meter with optical to USB cable. I am connecting optical Cable pin rx, tx, GND pin with arduino pin. is there any change in connection?

Thanks and regards,
Himanshu Parmar.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

I just realized that this is an echo, not a reply from the meter. Try to read your meter with GXDLMSDirector first. It will help you to verify that your optical probe is working. You can also get the correct settings for the meter. If one of the settings is wrong, the meter doesn't reply.

BR,
Mikko

himanshu parmar

3 years 11 months ago

hello,

hello,
I have tried that USB cable with gurux Director and its perfectly working. I have done the same thing on python code and in that its perfectly working but here in arduino there is some issues. I have compare both TX bit that sending from Rpi and Arduino Both are same as mentioned above but in arduino there is no response.
your quick response is very helpfull.

Thanks and Regards,
Himanshu Parmar.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

Can you add the first row from the GXDLMDirector log as a hex string so I can compare the bytes and check that your DLMS settings are correct? Just the first line is enough. Don't add all rows from the log file.

BR,
Mikko

himanshu parmar

3 years 11 months ago

hello,

hello,
that problem is solved. My optical cable is not correctly responded to. Currently, I read clock object data. I want to read all parameter values from the obis code. How can I read that?

Thanks and regards,
Himanshu Parmar.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

I'm glad that you solved the problem. Communication problems can be really hard to solve. You need to define what object you want to read and the OBIS code.

This reads the register object:

https://github.com/Gurux/GuruxDLMS.c/blob/cf7c1bdd47287ac0a95fb439b1207…

BR,
Mikko

himanshu parmar

3 years 11 months ago

Hello,

Hello,

Using different objects with OBIS code, I have read all parameters.
Thanks for your support and quick response.
is it possible to do the same with ESP32 in the esp-IDF framework?

Thanks and regards,
Himanshu Parmar.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

There is no example for esp-IDF at the moment. It can be done in the autumn, but you should be able to use the source code with esp-IDF framework. Only the example is not implemented.

BR,
Mikko

himanshu parmar

3 years 11 months ago

Hello,

Hello,

I have uploaded the source code in ESP-IDF but wondering how to send data from uart to meter using esp32. is there any step that must follow for the serial communication with meter?

Thanks and regards,
Himanshu Parmar.

Profile picture for user Kurumi

Kurumi

3 years 11 months ago

Hi,

Hi,

The only thing that varies between compilers is how to send data to the UART.
Modify com_readSerialPort and send bytes to the UART.
https://github.com/Gurux/GuruxDLMS.c/blob/a5e6ebbdf2272e7e745db3fa2e439…

THen you need to modify the readDLMSPacket to read bytes from the UART.

BR,
Mikko

himanshu parmar

3 years 10 months ago

Hello,

Hello,

I have collected all raw data but now in profile generic I was getting one data using com_readRowsByEntry but I didn't get the updated value. I have seen the previous value from where it started.
here is my code:
com_read(BASE(pg), 3);
com_readRowsByEntry(&pg, 2, 1);
com_read(BASE(pg), 4);
com_read(BASE(pg), 5);
com_read(BASE(pg), 6);
com_read(BASE(pg), 7);
com_read(BASE(pg), 8);
obj_toString(BASE(pg), &data);

Thanks and regards,
Himanshu Parmar.

Profile picture for user Kurumi

Kurumi

3 years 10 months ago

Hi,

Hi,

Check if your meter is returning an error for com_readRowsByEntry. All the meters don't support read by entry method. That is common if there is only one row. You can check that quite easily with GXDLMSDirector.

BR,
Mikko

  • Create new account
  • Reset your password

Hire Us!

Latest Releases

  • Tue, 06/09/2026 - 11:16
    gurux.dlms.java 4.0.95
  • Tue, 06/09/2026 - 10:03
    Gurux.DLMS.Python 1.0.199
  • Mon, 06/08/2026 - 13:39
    gurux.dlms.cpp 9.0.2606.0801
  • Mon, 06/01/2026 - 10:15
    gurux.dlms.cpp 9.0.2606.0101
  • Thu, 05/28/2026 - 16:06
    gurux.dlms.java 4.0.94

New forum topics

  • Error reading L&G Meter
  • Pass a TCP Client to GXNet
  • Australian EDMI Mk10D (Essential Energy area)
  • Strange mix of data notificiation vs get response
  • DLMS Connection
More

Who's new

  • Tuanhgg
  • Adel
  • charnon
  • Paddles
  • Miguel Ángel
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin