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. Forums
  3. Arduino Kampstrup

Arduino Kampstrup

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 Gerdus, 5 April, 2022
Forums
General discussion

Hi
Iam bussy with Arduino platform, In the GXDLMSDirector I had to set the maximum payload to 1010 for kamstrup for it to work. Must I do the same in the dmls ansi C Pak. I have search for HDLC_BUFFER_SIZE.
Regards Gerdus

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi Gerdus,

Hi Gerdus,

Usually maxInfoTX or maxInfoRX don't need to change. Meter tells what values it can accept, but Kampstrup meter is a little bit different. It's not possible to change maxInfoTX or maxInfoRX in the Arduino wrapper at the moment.

Ad hoc: Open GXDLMSClient.cpp and change this:
//Initialize DLMS settings.
cl_init(&settings, useLogicalNameReferencing, clientAddress, serverAddress, authentication, password, interfaceType);
//ADD THIS LINE!
settings.maxInfoTX = settings.maxInfoRX = 1010;

I'll add this to the work list. The new version is released in the next week and changing maxInfoRX and maxInfoTX is there.

BR,
Mikko

Gerdus

4 years 2 months ago

Thanx, I have added the line.

Thanx, I have added the line. Kampstrup default password is 12345, where can i set it.
Regards Gerdus

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

Client.init(true, CLIENT_ADDRESS, 1, DLMS_AUTHENTICATION_LOW, "12345", DLMS_INTERFACE_TYPE_HDLC);

BR,
Mikko

Gerdus

4 years 2 months ago

Hi,

Hi,
What is the difference between the DLMS address and HDLC CLIENT address ?
Regards Gerdus

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

There is two address. Client address and server address.
http://www.gurux.fi/dlmsAddress

The client address is changed when the authentication level changes. The server address is usually the same for that communication channel. If you change the communication channel, the server address might be changed.

BR,
Mikko

Gerdus

4 years 2 months ago

Hi

Hi
My default DLMS address is 32, 0010 0000. If I understand it correctly my DLMS address will be in the range from 32 - 224. 0010 0000 - 1110 0000.
Regrads Gerdus

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

That is CLIENT_ADDRESS.
Try with this:

Client.init(true, 32, 1, DLMS_AUTHENTICATION_LOW, "12345", DLMS_INTERFACE_TYPE_HDLC);

BR,
Mikko

Gerdus

4 years 2 months ago

Hi

Hi
I am communicating over RS485 half duplex line with the kamstrup meter. I need to toggle the Tx and RX enable line for it to Tx and Rx data. I have done here, is it at the correct place in the firmware:
//Send data.
digitalWrite(3, 1); //enable Max485 to TX
digitalWrite(2, 1);
delay(1000);
if ((ret = Serial1.write(data->data, data->size)) != data->size)
{
//If failed to write all bytes.
GXTRACE(GET_STR_FROM_EEPROM("Failed to write all data to the serial port.\n"), NULL);
}
//Loop until packet is complete.
do
{
if ((ret = com_readSerialPort(0x7E)) != 0)
{
if (ret == DLMS_ERROR_CODE_RECEIVE_FAILED && resend == RESEND_COUNT)
{
return DLMS_ERROR_CODE_SEND_FAILED;
}
++resend;
GXTRACE_INT(GET_STR_FROM_EEPROM("Data send failed. Try to resend."), resend);
if ((ret = Serial1.write(data->data, data->size)) != data->size)
{
//If failed to write all bytes.
GXTRACE(GET_STR_FROM_EEPROM("Failed to write all data to the serial port.\n"), NULL);
}
}
digitalWrite(3, 0); //enable Max485 to RX
digitalWrite(2, 0);
ret = Client.GetData(&frameData, reply);
if (ret != 0 && ret != DLMS_ERROR_CODE_FALSE)
{
break;
}
} while (reply->complete == 0);
return ret;
}

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

It's impossible to say because there are variations in how to handle different RS-485 chipsets.
Have you done RS-485 connection by yourself or are you using Arduino Hat or module?

BR,
Mikko

Gerdus

4 years 2 months ago

Hi

Hi
I have done Rs485 Modbus with arduino .

Profile picture for user Kurumi

Kurumi

4 years 2 months ago

Hi,

Hi,

Is this a Hat or have you done this with Maxim 485 chip? If you have done it, can you share the board schematic?

BR,
Mikko

Gerdus

4 years 2 months ago

Hi

Hi
Here is the circuit with 120 termination on/off Control.

Image

Gerdus

4 years 1 month ago

Hi

Hi
My send data to the meter does not look the same as the working data from GXDLMSdirector. See the frame format.

Here is the string from the Arduino: Not working
7E A0 14 03 41 93 36 82 81 80 08 05 02 03 F2 06 02 03 F2 03 F0 7E FF

Here is the string from working GXDLMSdirector :
7E A0 20 21 25 93 9E 08 81 80 14 05 02 03 F2
06 02 03 F2 07 04 00 00 00 01 08 04 00 00 00 01
0A 75 7E

Here is how the client ini string looks like:
Client.init(true, 32, 1, DLMS_AUTHENTICATION_LOW, "12345", DLMS_INTERFACE_TYPE_HDLC);

Regards Gerdus

Image
Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi,

Hi,

Try with this:

Client.init(true, 0x12, 0x10, DLMS_AUTHENTICATION_LOW, "12345", DLMS_INTERFACE_TYPE_HDLC);

Your client and server address are different and for that reason, the meter doesn't reply. If you are using a daisy chain, each meter has a unique server address and you can't use server address 1.

Check Device address from here:
https://www.gurux.fi/Gurux.DLMS.Objects.GXDLMSIecHdlcSetup

BR,
Mikko

Gerdus

4 years 1 month ago

Hi

Hi
I have change the client.ini as suggested by you, Here is the string I get Now:
7E A0 14 21 25 93 80 36 81 80 08 05 02 03 F2 06 02 03 F2 03 F0 7E
GXDLMS Director
7E A0 20 21 25 93 9E 08 81 80 14 05 02 03 F2
06 02 03 F2 07 04 00 00 00 01 08 04 00 00 00 01
0A 75 7E
The first difference I see is 3 byte Arduino 14 and GX 20 and then it is the 7 byte 80 DX is 9E.
So it seems to me it is the frame format wich is different A0 14 GX A0 20
Regards Gerdus

Profile picture for user Kurumi

Kurumi

4 years 1 month ago

Hi Gerdus,

Hi Gerdus,

It seems like your meter can't handle SNRM if MaxInfoTX or MaxInfoRX is changed and WindowSizeTX or WindowSizeRX is missing.

This is changed for ANSI C to the same as C# so you can read your meter. Get the latest version and let me know if you have problems.

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