0% found this document useful (0 votes)
6 views

Gurux Node MCU

The document is a forum discussion about coding for secure energy meters using NodeMCU, focusing on reading values from registers and clocks via DLMS protocol. Users ask for syntax and troubleshooting advice, while experienced members provide guidance on using specific functions and handling errors. Key topics include the use of Invocation Counter, reading multiple registers, and utilizing the com_readScalerAndUnits function.

Uploaded by

gowthamraj.enthu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Gurux Node MCU

The document is a forum discussion about coding for secure energy meters using NodeMCU, focusing on reading values from registers and clocks via DLMS protocol. Users ask for syntax and troubleshooting advice, while experienced members provide guidance on using specific functions and handling errors. Key topics include the use of Invocation Counter, reading multiple registers, and utilizing the com_readScalerAndUnits function.

Uploaded by

gowthamraj.enthu
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

for DLMS smart meters

Menu

Home Forums Code For Secure Energy Meter Using Nodemcu and Show All

 

Code for Secure


Energy meter using
Nodemcu and Show
all reading on LCD
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 ayushshriwastav, 1 November, 2022


Forums
Known problems

How can i make a code for display reading on lcd of energy meter by
OBIS Code using Nodemcu. Can you suggest or link to me for making

code for Secure meter?

Kurumi 2 years 3 months ago

Hi,

Hi,

The example reads the clock object. Find //Read clock.

It also prints date and time for the serial port using GXTRACE.

You need to add register objects in the same way as the clock object has been

added.

The problem at the moment is that one of your settings is different than the me-

ter expects.

Try to connect with GXDLMSDirector for your meter. It will help you to get a

better idea of DLMS meters.

BR,

Mikko
ayushshriwastav 2 years 3 months ago

Hi,

Hi,

Thanks sir for reply. My question is not that use gxtrace or com_AllObject. My

question is that what should i write read value in gxtrace or com_retAllObject

and How should i write read value in gxtrace.?

for example, Can i write syntax in void loop() in Arduindo in given below-

ret = gxtrace("1.0.99.1.0.255") or not? please tell me syntax to read value of regis-

ter and clock in void loop()?

Thanks Sir,

Kurumi 2 years 3 months ago

Hi,

Hi,

gxtrace is send to write a trace. You don't use it for the communication. You can

think that gxtrace equals Console.WriteLine. It's used to print the value, not for

the communication.
Check this. It will read the date and time from the clock object and then write

the content of the clock object for the meter.

//Read clock

gxClock clock1;

cosem_init(BASE(clock1), DLMS_OBJECT_TYPE_CLOCK, "0.0.1.0.0.255");

com_read(BASE(clock1), 3);

com_read(BASE(clock1), 2);

obj_toString(BASE(clock1), &data);

GXTRACE(GET_STR_FROM_EEPROM("Clock"), data);

obj_clear(BASE(clock1));

free(data);

BR,

Mikko

ayushshriwastav 2 years 3 months ago

Hi,

Hi,

Thanks for replying sir, How can i read value of Register and Extended Register

in void loop() function in Arduino? What is syntax of Register and Extended reg-

ister in void loop() function?


Thanks sir

Kurumi 2 years 3 months ago

Hi,

Hi,

Add values that you want to read under the clock object. Something like this:

//Read register

gxRegister reg1;

cosem_init(BASE(reg1), DLMS_OBJECT_TYPE_REGISTER,

"YOUR_OBIS_CODE");

com_read(BASE(reg1), 3);

com_read(BASE(reg1), 2);

obj_toString(BASE(reg1), &data);

GXTRACE(GET_STR_FROM_EEPROM("Register"), data);

obj_clear(BASE(reg1));

free(data);

BR,

Mikko

ayushshriwastav 2 years 3 months ago


Hi,

Hi,

Thank you so much for replying sir . How can i find InvocationCounter for

Secure Meter?

Please tell me about InvocationCounter for Secure meter? How can I find it and

What is role of Invocation Counter in DLMS Meter?

Thank you sir

Kurumi 2 years 3 months ago

Hi,

Hi,

When you connect to the meter there should be an Invocation Counter data ob-

ject. It's used to improve security, but all meters don't use it.

BR,

Mikko

ayushshriwastav 2 years 3 months ago


Hi,

Hi,

I am very happy to hear for reply sir , thank you so much sir. If Some meter don't

use Invocation Counter then What should i write in " ret =

com_readAllObjects("0.0.43.1.0.255") " in the void loop()

Kurumi 2 years 3 months ago

Hi,

Hi,

Set it NULL if you don't want to use Invocation Counter.

com_readAllObjects(NULL);

BR,

Mikko

ayushshriwastav 2 years 3 months ago

Hi,

Hi,
Thanks for replying sir. I have found new error in NodeMCU Board in Arduino

IDE when clock and register define in void loop() function in given below. How

can I solve this sir?

Arduino: 1.8.18 (Windows 10), Board: "NodeMCU 1.0 (ESP-12E Module), 80 MHz,

Flash, Disabled (new aborts on oom), Disabled, All SSL ciphers (most compatible),

32KB cache + 32KB IRAM (balanced), Use pgm_read macros for

IRAM/PROGMEM, 4MB (FS:2MB OTA:~1019KB), 2, v2 Lower Memory, Disabled,

None, Only Sketch, 115200"

Kurumi 2 years 3 months ago

Hi,

Hi,

You need to define data variable like this:

char* data = NULL;

BR,

Mikko

ayushshriwastav 2 years 3 months ago

Hi,
Hi,

Thank you so much sir. It is working perfectly and i did make it Global Variable

char* data = NULL;

I have some question now that if i want to read more values of Register for ex-

ample reg2, reg3, reg4 and reg5 etc. So what will syntax be written in void loop()

function for reg2,reg3,reg4 etc??

Kurumi 2 years 3 months ago

Hi,

Hi,

Check my answer:

https://www.gurux.fi/comment/25325#comment-25325

BR,

Mikko

ayushshriwastav 2 years 3 months ago

Hi,

Hi,
Thanks for reply sir. I am receiving this error again after convert object to string

function obj_toString() in void loop() function in arduino ide in given below.

Where am i going wrong ? Please tell me real solution.

Kurumi 2 years 3 months ago

Hi,

Hi,

It's a little hard to say from your pics, but you need to set data to NULL after

free.

free(data);

data = NULL;

BR,

Mikko

ayushshriwastav 2 years 3 months ago

Hi,

Hi,
Thanks for replying sir. I am very happy that you are guiding well sir. I am at-

taching code of void loop() function of client.ino in given below - and please tell

me this is Right or Wrong?

void loop()

int ret;

// Read the clock

gxClock clock1;

if (millis() - runTime > 5000)

runTime = millis();

GXTRACE(GET_STR_FROM_EEPROM("Start reading"), NULL);

//TODO: Change logical name of the frame counter if it's used.

ret = com_readAllObjects(1.0..43.1.0.255);

com_close();

Kurumi 2 years 2 months ago

Hi,

Hi,
It looks correct to me.

BR,

Mikko

ayushshriwastav 2 years 2 months ago

Hi,

Hi,

Thanks for replying sir. Very nice responsive talking. I have added more register

whose name is reg2,reg3,reg4 in given below code. what is this correct code or

not because i am taking register value in same time and declare global variable

char* data = NULL; So please brief explain how is storing reg1,reg2,reg3 and

reg4 in data in same time? And please tell sir this code is correct or not in given

below-

client.ino

int ret;

// Read the clock

gxClock clock1;

//Read the Register

gxRegister reg1;

gxRegister reg2;

gxRegister reg3;
gxRegister reg4;

if (millis() - runTime > 5000)

Kurumi 2 years 2 months ago

Hi,

Hi,

This is the correct way to do it. You aren't reading the values with the same re-

quest. You can use readList to read multiple values with one request, but all the

meters don't support it.

BR,

Mikko

ayushshriwastav 2 years 2 months ago

Hi,

Hi,
Thanks for reply sir, Can you please suggest and give syntax me How can use

readList to read multiple values in code?

And also brief tell sir if meter don't support it then what should be do for it?

Kurumi 2 years 2 months ago

Hi,

Hi,

com_readScalerAndUnits do what you want to do.

https://github.com/Gurux/GuruxDLMS.c/blob/c65175efc8917f0ee3a7eb340ac4

e…

If that is not supported then you need to read objects one by one as you do now.

BR,

Mikko

ayushshriwastav 2 years 2 months ago

Hi,

Hi,
Very thank you so much. Very nice talking and I am very happy that you are very

helpful sir. Can you please tell how can read all value in

com_readScalerAndUnits()? Please can you write a syntax to read all value in

com_readScalerAndUnits().

Kurumi 2 years 2 months ago

Hi,

Hi,

I believe that you don't want to read all values. It's taking a long time, but this

does it.

https://github.com/Gurux/GuruxDLMS.c/blob/c65175efc8917f0ee3a7eb340ac4

e…

BR,

Mikko

Kurumi 2 years 2 months ago

Hi,

Hi,
I believe that you don't want to read all values. It's taking a long time, but this

does it.

https://github.com/Gurux/GuruxDLMS.c/blob/c65175efc8917f0ee3a7eb340ac4

e…

BR,

Mikko

ayushshriwastav 2 years 1 month ago

Hi, Thank you, But i am not…

Hi,

Thanks for helping but i didn,t get ouput. Sure, I will find.

1 2

Log in or register to post comments

Username

Password
Log in

Create new account


Reset your password

Latest Releases

Mon, 03/10/2025 - 09:21


gurux.dlms.cpp 20250310.1
Thu, 03/06/2025 - 08:27
Gurux.DLMS.Net 9.0.2503.0601
Wed, 03/05/2025 - 13:07
gurux.dlms.cpp 20250305.1
Wed, 03/05/2025 - 10:11
Gurux.DLMS.Net 9.0.2503.0501
Mon, 03/03/2025 - 09:09
gurux.dlms.c 9.0.2503.0301

New forum topics

Wrong SetRequest after latest update


How to use object methods?
SL7000 AC VOLTAGE L1-L2
CSR Invalid Counter
Parse meter's push data
More

Who's new
D@faizan4321
DarrekonTrure
Charleseton
GictorGrala
Wayneimach

RSS feed

Privacy FAQ GXDN Issues Contact

You might also like