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?
DLMS is a complicated protocol. You can't just read the register value. I propose you download GXDLMSDirector and play with it to get an idea of DLMS meters and how to communicate with them.
Yes Sir I have download GXDLMSDirector and I did find device id in a OBIS Code form but i didn't get any reading such as Power Factor, Voltage, Current, frequency etc. So My question is that How can display Power factor , voltage, current, KWH etc on LCD with Nodemcu or ESP32 microcontroller with the help of RS232 using the code. Can you give me sir code reference video or link where is available??
You have connected without authentication and you can see only a few objects in the association view. You need to change the following to see more objects:
Change authentication level to Low.
Set the correct password
Change client address.
There are several parameters in DLMS meters and they vary between the meters. That makes reading complicated at the beginning.
I did find set Authentication level to low. But i am not understanding to find client address and password. How can i get exact client address and password for secure meter.
You need to ask for the password from the meter vendor. I don't know your meter model and manufacturer so I can't tell you the client address. If the meter doesn't reply try value 20.
Have you copied files under development for your Android directory?
Reading all values will take a long time. I propose that you read only the values that you need. You can read objects that you want to read like it's done in com_readAllObjects.
I am not using the Visual Studio Code . I am using Arduino IDE. I want read all readings of meter by ESP32 microcontroller via RS232. So, I need the program to read the all reading from DLMS Meter. Please share me exact program for Arduino ide .
Thank you so much for replying. I have found this error. Please also tell me How many .h file and which .h file include for client.ino
Arduino: 1.8.18 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"
Hi,
Thank you so much sir giving me good information. Yes I was not copied but i did copied now and i have find some other issue in given below
In file included from E:\Lecture and Research - CS\MPLABX ENG\aurdionproject\SECURE_ENERGYMET\SECURE_ENERGYMET.ino:2:
GXDLMSClient.h:39:10: fatal error: include/gxignore.h: No such file or directory
39 | #include "include/gxignore.h"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
include/gxignore.h: No such file or directory
Very very thank you, Yes i did include the folder and it's run perfectly. I have one question more how can display all readings like Current, Voltage, Energy , Power factor KWH, frequency on LCD. How should i choose hardware and How can display all reading on LCD by client.ino
In the Arduino IDE, use the OBIS code. What is OBIS Code and why it is use and how can display all reading like current, voltage, KWH, energy, frequency etc. from OBIS code on LCD screen with ESP32 Microcontroller using RS232? Program is already complied but i didn't understand how to display all reading value on LCD.
Thanks & Regards
If you read the association view you can see all the objects that the meter can offer. I propose that you download GXDLMSDirector and play with it. It will help you to understand DLMS devices and what they can offer.
This is giving the error ESP32. How can i solve it
Arduino: 1.8.18 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled
I did also install latest version ESP32 2.0.5 but #include <avr/pgmspace.h> is giving continuing the fatal error. This is error is not giving in NodeMCU, But in ESP32, giving the Fatal error in Helpers.h. What can i do for this. where can i get <avr/pgmspace.h>. Please help me on this.
Thank you sir. Please reply this fastly sir.
This is my new version ESP32 github link in given below.
link - https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/pack…
And ESP32 version is 2.0.5 but i am facing fatal error continously . Please solve the problem in given below-
1. Please Help me fatal error for #include <avr/pgmspace.h> for ESP32 in arduino IDE.
2. And also tell me which Pin of NodeMCU i should to select to connect microcontroller and Energy meter and what i need to define softwareserial in client.ino?
In file included from E:\Lecture and Research - CS\MPLABX ENG\ESP32\Energy_Meter\DLMSClient\GXDLMSClient.h:13,
from E:\Lecture and Research - CS\MPLABX ENG\ESP32\Energy_Meter\DLMSClient\DLMSClient.ino:2:
E:\Lecture and Research - CS\MPLABX ENG\ESP32\Energy_Meter\DLMSClient\include\helpers.h:25:10: fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>
^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: avr/pgmspace.h: No such file or directory
This is i am getting error.
Can you send me Development file
I did removed avr from avr/pgmspace and write only <pgmspace>. it is working perfectly. But i have confusion on some question in given below-
1. And also tell me which Pin of NodeMCU i should to select to connect microcontroller and Energy meter and what i need to define softwareserial in client.ino?
2. And also tell me ret = com_readAllObjects("0.0.43.1.0.255") meaning? means 0.0.43.1.0.255 which type OBIS Code? what can i take different integer datatype ret means int ret1, int ret2, int ret3 etc. and how can i read current , voltage and KWH in com_readAllObjects(" ");
I'm glad that you manage to solve this. I'll check if there is any way how to solve this with your settings.
1. You need to connect GND, RXD0 and TXD0. I haven't used softwareserial so you need to check this yourself.
2. 0.0.43.1.0.255 is the mane of the invocation counter. You need it only if you connect with the ciphered connection. I propose that you download GXDLMSDIrecor and play with it to get a better understanding of DLMS meters.
Thank you so much for reply.I have direct connect to Meter and PC. I am not using controller between PC and Meter. So, I didn't find any Invocation Counter and Security setup. and I didn't find main invocation counter "0.0.43.1.0.255". What can i do? How can i solve this.
You can ignore that. It's used only with secured connections. If you change
Add values that you want to read for com_readAllObjects and establish the connection.
I don't know what settings you are using, but you might be set the correct parameters for Init:
Client.init(true, 16, 1, DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
Thanks for replying. I am confuse the setting of Secure Energy Meter. I am attaching the image. what should i do change in this. and
Also tell me i am using DB9 connector for Energy meter. How can i connect DB9 connector connect to ESP32 microcontroller.
I am using Secure Meter Limited( Saral meter). My Authentication level is low and Client Address is 0x20 means 32 . So what should i do changes in setting in program .init.
Thanks for replying sir. I did find again this type mulfunction value on Arduino COM Port and Baud Rate 9600. I am using ESP32 Board and i am uploading program client.ino but i am getting continuously malvalue from meter after change the setting. What can i do? I have to change more setting in src and include folder or DLMSClient.h? why i am not able to read meter reading after uplaoding code of client.ino in ESP32and changing setting
The data that you are seeing is in ASCII, but the meter sends binary data. Download GXDLMSDirector and
select "Tools" and "Serial monitor". Then check "Hex" and you can see data in hex format.
Thanks for giving nice responce, I am glad to you. Yes, this is giving in Hex format. But How can i change this Hex into decimal. because i need to all reading in decimal for example - frequency = 49.57
And Also please tell me how can i do all hex reading line by line because i can't understand whose reading is related to this hex. please help me on this sir to reach actual value like as 2Ampear, 232 Volt, 50Hz frequency etc.
Thanks for replying sir. I did establish the connection between NodeMCU and Saral Energy meter in Arduino IDE through serial communication(DB9 female to (RS232 to TTL convertor)) and i am using code client.ino, and i am recieving this hex frame on GuruXDirector serial monitor from microcontroller. Please tell me,
1. How to convert this ascii frame into decimal or assci to hex to decimal value.
2. Which Gurux.DLMS library will be used in Client.ino in Arduino IDE to convert ascii to decimal value.
I am attaching image of connection of meter to NodeMCU and NodeMCU to PC in given below-
3. The meter is sending only one responce. it's not change the hex format after give many OBIS Code in client.ino. I am giving Voltage OBIS Code, KWH OBIS Code but meter send same hex frame. why this is?
1. There is no simple way to do it. You must parse the entire frame to get the value.
2. After you have established the connection for the meter this function will read value from the meter and convert value to string.
1.Thanks for replying. I am receiving same hex format to give many reading OBIS Code. the image is tagged in given below-
2.I am already using this code in client.ino whatever you have tagged in given below https://github.com/Gurux/GuruxDLMS.c/blob/220b212f800e37e420e511ff376ef…
I didn't understand this please tell me clearly this sir? How can i parse data frame into string.?
please answer me both question sir.
You can't read the value from the meter. ret value is an error code. You need to check why this happens.
Check if you can establish the connection for the meter.
Thanks for replying. I am already using this code in client.ino whatever you have tagged in given below https://github.com/Gurux/GuruxDLMS.c/blob/220b212f800e37e420e511ff376ef5...
I didn't understand this please tell me clearly this sir? How can i parse data frame into string.? I am not understanding clearly.
And also tell me,
This meaning - you can't read the value from the meter. ret value is an error code. You need to check why this happens.
Check if you can establish the connection for the meter.?
Why i can't read this sir? What i am going wrong? Please tell me briefly sir.
Thank you for replying. Can you please tell me that how can i print the real read Value and how can ignore return error code?
2. Can you please send me a code obj_toString method?
Thanks for nice reply. 1.
What is meaning of ret = com_readAllObjects("0.0.43.1.0.255") in void loop().Why is this define in loop function in Arduino. and How can i print the value using gxtrace method in void loop() function.
2. I didn't fine any Obj_toString Method in source code of the development folder? How can i find this in source code of development folder?
Thank you so much for replying sir.
1. I want to read value of Register, Extended Register, Clock and Calendar. So what should i use for this com_AllObjects or gxtrace?
2. What should i do write to read value as like in given below-
ret = gxtrace("1.0.11.7.0.255"); in void loop()?
Hi,
Hi,
DLMS is a complicated protocol. You can't just read the register value. I propose you download GXDLMSDirector and play with it to get an idea of DLMS meters and how to communicate with them.
BR,
Mikko
Yes Sir I have download
Yes Sir I have download GXDLMSDirector and I did find device id in a OBIS Code form but i didn't get any reading such as Power Factor, Voltage, Current, frequency etc. So My question is that How can display Power factor , voltage, current, KWH etc on LCD with Nodemcu or ESP32 microcontroller with the help of RS232 using the code. Can you give me sir code reference video or link where is available??
Hi,
Hi,
You have connected without authentication and you can see only a few objects in the association view. You need to change the following to see more objects:
Change authentication level to Low.
Set the correct password
Change client address.
There are several parameters in DLMS meters and they vary between the meters. That makes reading complicated at the beginning.
BR,
Mikko
Hi,
Hi,
I did find set Authentication level to low. But i am not understanding to find client address and password. How can i get exact client address and password for secure meter.
Hi,
Hi,
You need to ask for the password from the meter vendor. I don't know your meter model and manufacturer so I can't tell you the client address. If the meter doesn't reply try value 20.
BR,
Mikko
Hi,
Hi,
Thanks for your responsive reply. I will do take password and client address from meter Vendor.
Hi,
Hi,
Have you copied files under development for your Android directory?
Reading all values will take a long time. I propose that you read only the values that you need. You can read objects that you want to read like it's done in com_readAllObjects.
BR,
Mikko
Hi,
Hi,
How can i use your DLMS meter program in my Arduino IDE. How can access all readings by ESP32 in Arduino IDE.
HI,
HI,
I am not using the Visual Studio Code . I am using Arduino IDE. I want read all readings of meter by ESP32 microcontroller via RS232. So, I need the program to read the all reading from DLMS Meter. Please share me exact program for Arduino ide .
Hi,
Hi,
You can use this example as a base.
https://github.com/Gurux/GuruxDLMS.c/tree/master/Arduino_IDE
Before start you need to copy src and include folders from development folder under client, server or pushListener folders.
I propose that you play with GXDLMSDirector first. It will give you an idea from DLMS meters.
BR,
Mikko
Hi,
Hi,
Thank your for giving your nice responce. my confusion is that what can i use library
Hi,
Hi,
If you want to read the data from the meter, you need to use Client.ino. Then you need to set the correct settings using Client.init.
https://github.com/Gurux/GuruxDLMS.c/blob/220b212f800e37e420e511ff376ef…
The settings depend on meter type and if one of the settings is invalid the meter doesn't reply.
BR,
Mikko
Hi,
Hi,
Thank you so much for replying. I have found this error. Please also tell me How many .h file and which .h file include for client.ino
Arduino: 1.8.18 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled"
option enabled in File -> Preferences.
Hi,
Hi,
Did you do copy src and include folders from development folder under your project to DLMS project folder? I believe you didn't.
BR,
Mikko
Hi,
Hi,
Thank you so much sir giving me good information. Yes I was not copied but i did copied now and i have find some other issue in given below
In file included from E:\Lecture and Research - CS\MPLABX ENG\aurdionproject\SECURE_ENERGYMET\SECURE_ENERGYMET.ino:2:
GXDLMSClient.h:39:10: fatal error: include/gxignore.h: No such file or directory
39 | #include "include/gxignore.h"
| ^~~~~~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
include/gxignore.h: No such file or directory
Hi,
Hi,
You need to copy include and src folders directly under E:\Lecture and Research - CS\MPLABX ENG\aurdionproject\SECURE_ENERGYMET\
BR,
Mikko
Hi,
Hi,
Very very thank you, Yes i did include the folder and it's run perfectly. I have one question more how can display all readings like Current, Voltage, Energy , Power factor KWH, frequency on LCD. How should i choose hardware and How can display all reading on LCD by client.ino
Hi,
Hi,
In the Arduino IDE, use the OBIS code. What is OBIS Code and why it is use and how can display all reading like current, voltage, KWH, energy, frequency etc. from OBIS code on LCD screen with ESP32 Microcontroller using RS232? Program is already complied but i didn't understand how to display all reading value on LCD.
Thanks & Regards
Hi,
Hi,
If you read the association view you can see all the objects that the meter can offer. I propose that you download GXDLMSDirector and play with it. It will help you to understand DLMS devices and what they can offer.
BR,
Mikko
Hi,
Hi,
This is giving the error ESP32. How can i solve it
Arduino: 1.8.18 (Windows 10), Board: "ESP32 Dev Module, Disabled, Default 4MB with spiffs (1.2MB APP/1.5MB SPIFFS), 240MHz (WiFi/BT), QIO, 80MHz, 4MB (32Mb), 921600, Core 1, Core 1, None, Disabled
Hi,
Hi,
Can you select "File" and "Preferences"? What is the "Additional Boards Manager Urls" field?
Can you add plain text here?
BR,
Mikko
Hi,
Hi,
Thank you so much for replying. This is additional board manager URL filed in given below,
https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/pack…
What is this right or wrong?
Hi,
Hi,
I did also install latest version ESP32 2.0.5 but #include <avr/pgmspace.h> is giving continuing the fatal error. This is error is not giving in NodeMCU, But in ESP32, giving the Fatal error in Helpers.h. What can i do for this. where can i get <avr/pgmspace.h>. Please help me on this.
Hi,
Hi,
Thank you sir. Please reply this fastly sir.
This is my new version ESP32 github link in given below.
link - https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/pack…
And ESP32 version is 2.0.5 but i am facing fatal error continously . Please solve the problem in given below-
1. Please Help me fatal error for #include <avr/pgmspace.h> for ESP32 in arduino IDE.
2. And also tell me which Pin of NodeMCU i should to select to connect microcontroller and Energy meter and what i need to define softwareserial in client.ino?
Hi,
Hi,
I did try this and it worked without problems.
What board you are using?
What is your Arduino version?
BR,
Mikko
Hi,
Hi,
I am using Arduino IDE 2.0.2 and board is ESP32 2.0.5 version(ESP32 Dev Module). I am facing many times this problem
#include <avr/pgmspace.h>
In file included from E:
In file included from E:\Lecture and Research - CS\MPLABX ENG\ESP32\Energy_Meter\DLMSClient\GXDLMSClient.h:13,
from E:\Lecture and Research - CS\MPLABX ENG\ESP32\Energy_Meter\DLMSClient\DLMSClient.ino:2:
E:\Lecture and Research - CS\MPLABX ENG\ESP32\Energy_Meter\DLMSClient\include\helpers.h:25:10: fatal error: avr/pgmspace.h: No such file or directory
#include <avr/pgmspace.h>
^~~~~~~~~~~~~~~~
compilation terminated.
exit status 1
Compilation error: avr/pgmspace.h: No such file or directory
This is i am getting error.
Can you send me Development file
Hi,
Hi,
I did removed avr from avr/pgmspace and write only <pgmspace>. it is working perfectly. But i have confusion on some question in given below-
1. And also tell me which Pin of NodeMCU i should to select to connect microcontroller and Energy meter and what i need to define softwareserial in client.ino?
2. And also tell me ret = com_readAllObjects("0.0.43.1.0.255") meaning? means 0.0.43.1.0.255 which type OBIS Code? what can i take different integer datatype ret means int ret1, int ret2, int ret3 etc. and how can i read current , voltage and KWH in com_readAllObjects(" ");
Hi,
Hi,
I'm glad that you manage to solve this. I'll check if there is any way how to solve this with your settings.
1. You need to connect GND, RXD0 and TXD0. I haven't used softwareserial so you need to check this yourself.
2. 0.0.43.1.0.255 is the mane of the invocation counter. You need it only if you connect with the ciphered connection. I propose that you download GXDLMSDIrecor and play with it to get a better understanding of DLMS meters.
BR,
Mikko
I have direct connect to
Hi,
Thank you so much for reply.I have direct connect to Meter and PC. I am not using controller between PC and Meter. So, I didn't find any Invocation Counter and Security setup. and I didn't find main invocation counter "0.0.43.1.0.255". What can i do? How can i solve this.
Hi,
Hi,
You can ignore that. It's used only with secured connections. If you change
Add values that you want to read for com_readAllObjects and establish the connection.
I don't know what settings you are using, but you might be set the correct parameters for Init:
Client.init(true, 16, 1, DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
BR,
Mikko
Hi,
Hi,
Thanks for replying. I am confuse the setting of Secure Energy Meter. I am attaching the image. what should i do change in this. and
Also tell me i am using DB9 connector for Energy meter. How can i connect DB9 connector connect to ESP32 microcontroller.
Hi,
Hi,
If your authentication level is None, then the client address usually is 16.
You need a converter that converts the UART TTL level to RS-232.
If you connect RS-232 directly to RS and TX pins it might break your microcontroller.
BR,
Mikko
Hi,
Hi,
I am using Secure Meter Limited( Saral meter). My Authentication level is low and Client Address is 0x20 means 32 . So what should i do changes in setting in program .init.
Hi,
Hi,
You can use values:
Client.init(true, 0x20, 1, DLMS_AUTHENTICATION_LOW, "YOUR_METER_PASSWORD", DLMS_INTERFACE_TYPE_HDLC);
BR,
Mikko
Hi,
Hi,
Thanks for replying sir. I did find again this type mulfunction value on Arduino COM Port and Baud Rate 9600. I am using ESP32 Board and i am uploading program client.ino but i am getting continuously malvalue from meter after change the setting. What can i do? I have to change more setting in src and include folder or DLMSClient.h? why i am not able to read meter reading after uplaoding code of client.ino in ESP32and changing setting
Hi,
Hi,
The data that you are seeing is in ASCII, but the meter sends binary data. Download GXDLMSDirector and
select "Tools" and "Serial monitor". Then check "Hex" and you can see data in hex format.
BR,
Mikko
Hi,
Hi,
Thanks for giving nice responce, I am glad to you. Yes, this is giving in Hex format. But How can i change this Hex into decimal. because i need to all reading in decimal for example - frequency = 49.57
And Also please tell me how can i do all hex reading line by line because i can't understand whose reading is related to this hex. please help me on this sir to reach actual value like as 2Ampear, 232 Volt, 50Hz frequency etc.
Hi,
Hi,
The data that you are receiving are HDLC frames. Is your meter pushing those frames or do you have established the connection for the meter?
There is no easy way to convert those frames to decimal values. You can use Gurux.DLMS library for that.
BR,
Mikko
Hi,
Hi,
Thanks for replying sir. I did establish the connection between NodeMCU and Saral Energy meter in Arduino IDE through serial communication(DB9 female to (RS232 to TTL convertor)) and i am using code client.ino, and i am recieving this hex frame on GuruXDirector serial monitor from microcontroller. Please tell me,
1. How to convert this ascii frame into decimal or assci to hex to decimal value.
2. Which Gurux.DLMS library will be used in Client.ino in Arduino IDE to convert ascii to decimal value.
I am attaching image of connection of meter to NodeMCU and NodeMCU to PC in given below-
3. The meter is sending only one responce. it's not change the hex format after give many OBIS Code in client.ino. I am giving Voltage OBIS Code, KWH OBIS Code but meter send same hex frame. why this is?
Hi,
Hi,
1. There is no simple way to do it. You must parse the entire frame to get the value.
2. After you have established the connection for the meter this function will read value from the meter and convert value to string.
https://github.com/Gurux/GuruxDLMS.c/blob/220b212f800e37e420e511ff376ef…
BR,
Mikko
Hi,
Hi,
1.Thanks for replying. I am receiving same hex format to give many reading OBIS Code. the image is tagged in given below-
2.I am already using this code in client.ino whatever you have tagged in given below
https://github.com/Gurux/GuruxDLMS.c/blob/220b212f800e37e420e511ff376ef…
I didn't understand this please tell me clearly this sir? How can i parse data frame into string.?
please answer me both question sir.
Hi,
Hi,
You can't read the value from the meter. ret value is an error code. You need to check why this happens.
Check if you can establish the connection for the meter.
BR,
Mikko
Hi,
Hi,
Thanks for replying. I am already using this code in client.ino whatever you have tagged in given below
https://github.com/Gurux/GuruxDLMS.c/blob/220b212f800e37e420e511ff376ef5...
I didn't understand this please tell me clearly this sir? How can i parse data frame into string.? I am not understanding clearly.
And also tell me,
This meaning - you can't read the value from the meter. ret value is an error code. You need to check why this happens.
Check if you can establish the connection for the meter.?
Why i can't read this sir? What i am going wrong? Please tell me briefly sir.
Hi,
Hi,
In your source code, you are printing the return error code, not the read value. The return code is not zero which means success.
obj_toString method convert read value to string. Check it.
BR,
Mikko
Hi,
Hi,
Thank you for replying. Can you please tell me that how can i print the real read Value and how can ignore return error code?
2. Can you please send me a code obj_toString method?
Hi,
Hi,
GXTRACE method prints the value for the serial port. You will find the obj_toString method in the source codes of the development folder.
BR,
Mikko
Hi,
Hi,
Thanks for nice reply. 1.
What is meaning of ret = com_readAllObjects("0.0.43.1.0.255") in void loop().Why is this define in loop function in Arduino. and How can i print the value using gxtrace method in void loop() function.
2. I didn't fine any Obj_toString Method in source code of the development folder? How can i find this in source code of development folder?
Hi,
Hi,
1. Client connects to the meter and reads values every five seconds.
Check com_readAllObjects. and modify GXTRACE for your needs.
2. You can find it here:
https://github.com/Gurux/GuruxDLMS.c/blob/1fec075fbd0aeb1212fc1110bd9c7…
BR,
Mikko
Hi,
Hi,
Thank you so much for replying sir.
1. I want to read value of Register, Extended Register, Clock and Calendar. So what should i use for this com_AllObjects or gxtrace?
2. What should i do write to read value as like in given below-
ret = gxtrace("1.0.11.7.0.255"); in void loop()?