i want to read energy consumption data from my linkwell AC static kWh meter using arduino. I have the optical reader with me. Can anyone give me a example project to get start. It was very urgent.
yes i have copied the files, when i commend all the files in the ignore file it get compiled, why ?.
i just want to read the voltage, current, energy consumption details from the meter. i have connected my optical probe to serial2 (RX2 and TX2) of esp32 then what are the commends to be uncommented. please help. my current Arduinoignore.h file is
thanks for the replay, can you please tell me which are the lines in the ignore.h file to be uncommented with respect to the new updated version. also please tell me on how to modify the code to use the optical probe connected to the Serial2 of esp32. I have to use the LLS key for communicating with the meter, so where should i place the LLS key in my code ?
how can i find the LLS_CLIENT_ADDRESS of my meter and how to add my authentication key ? should i enter it in asci format or in hex ?, i can give you the AARQ of my meter obtained from gurux director can you tell me the LLS_CLIENT_ADDRESS. also please comment on using the RX2 and TX2 for my code where my optical probe is connected to ESP32.
my board manager is supporting serial port but i have connected the optical probe to another pins, can i map the pins to the desired pins. if not can you please explain the connection of the circuit. like where to connect the tx/rx pin of optical probe and
i have already used the gurux director the settings are
baude rate 9600
parity none
8 bit
where should i change HDLC_WITH_MODE_E to HDLC in the client code ?
i have connected the meter with gurux director and i was able to read the data from it. but when i connect the meter using esp32 using the client code i got this output at the debug serial port. can i enable any log option in the clent code to see what is happening in the code.
when i decoded the data send by my optical probe connected to esp32 with another usb optical probe connected to docklight the data for SNRM is sending correctly. but the response from the meter is not processed by the client code. can i enable any debug option to see more details at the serial
Hi, Check this: https:/…
Hi,
Check this:
https://github.com/Gurux/GuruxDLMS.c/tree/master/Arduino_IDE/client
BR,
Mikko
i have tried it but i got…
i have tried it but i got error while compiling
/Users/macbook/Library/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-gcc -MMD -c @/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/flags/c_flags -w -Os -Werror=return-type -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"macosx\"" "-DARDUINO_FQBN=\"esp32:esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,PSRAM=disabled,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/flags/defines -I/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client -iprefix /Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/include/ @/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/flags/includes -I/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/qio_qspi/include -I/Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32 -I/Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/variants/esp32 -I/Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/libraries/EEPROM/src @/private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/build_opt.h @/private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/file_opts /private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/sketch/src/curve.c -o /private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/sketch/src/curve.c.o
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c: In function 'cosem_init4':
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:642:29: error: 'gxSecuritySetup' undeclared (first use in this function)
642 | BYTE_BUFFER_INIT(&((gxSecuritySetup*)object)->guek);
| ^~~~~~~~~~~~~~~
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:642:29: note: each undeclared identifier is reported only once for each function it appears in
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:642:45: error: expected expression before ')' token
642 | BYTE_BUFFER_INIT(&((gxSecuritySetup*)object)->guek);
| ^
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:643:35: error: expected expression before ')' token
643 | bb_set(&((gxSecuritySetup*)object)->guek, DEFAULT_BLOCK_CIPHER_KEY, sizeof(DEFAULT_BLOCK_CIPHER_KEY));
| ^
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:644:45: error: expected expression before ')' token
644 | BYTE_BUFFER_INIT(&((gxSecuritySetup*)object)->gbek);
| ^
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:645:35: error: expected expression before ')' token
645 | bb_set(&((gxSecuritySetup*)object)->gbek, DEFAULT_BROADCAST_BLOCK_CIPHER_KEY, sizeof(DEFAULT_BROADCAST_BLOCK_CIPHER_KEY));
| ^
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:646:45: error: expected expression before ')' token
646 | BYTE_BUFFER_INIT(&((gxSecuritySetup*)object)->gak);
| ^
/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client/src/cosem.c:647:35: error: expected expression before ')' token
647 | bb_set(&((gxSecuritySetup*)object)->gak, DEFAULT_AUTHENTICATION_KEY, sizeof(DEFAULT_AUTHENTICATION_KEY));
| ^
/Users/macbook/Library/Arduino15/packages/esp32/tools/esp-x32/2405/bin/xtensa-esp32-elf-gcc -MMD -c @/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/flags/c_flags -w -Os -Werror=return-type -DF_CPU=240000000L -DARDUINO=10607 -DARDUINO_ESP32_DEV -DARDUINO_ARCH_ESP32 "-DARDUINO_BOARD=\"ESP32_DEV\"" "-DARDUINO_VARIANT=\"esp32\"" -DARDUINO_PARTITION_default "-DARDUINO_HOST_OS=\"macosx\"" "-DARDUINO_FQBN=\"esp32:esp32:esp32:UploadSpeed=921600,CPUFreq=240,FlashFreq=80,FlashMode=qio,FlashSize=4M,PartitionScheme=default,DebugLevel=none,PSRAM=disabled,LoopCore=1,EventsCore=1,EraseFlash=none,JTAGAdapter=default,ZigbeeMode=default\"" -DESP32=ESP32 -DCORE_DEBUG_LEVEL=0 -DARDUINO_RUNNING_CORE=1 -DARDUINO_EVENT_RUNNING_CORE=1 -DARDUINO_USB_CDC_ON_BOOT=0 @/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/flags/defines -I/Users/macbook/Downloads/GuruxDLMS.c-master/Arduino_IDE/client -iprefix /Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/include/ @/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/flags/includes -I/Users/macbook/Library/Arduino15/packages/esp32/tools/esp32-arduino-libs/idf-release_v5.3-cfea4f7c-v1/esp32/qio_qspi/include -I/Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/cores/esp32 -I/Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/variants/esp32 -I/Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/libraries/EEPROM/src @/private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/build_opt.h @/private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/file_opts /private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/sketch/src/datainfo.c -o /private/var/folders/pf/btnyds813370pxzbt2v4g5l00000gn/T/arduino/sketches/781185D94772807151BCC67AE0F267DC/sketch/src/datainfo.c.o
Using library EEPROM at version 3.1.1 in folder: /Users/macbook/Library/Arduino15/packages/esp32/hardware/esp32/3.1.1/libraries/EEPROM
exit status 1
Compilation error: 'gxSecuritySetup' undeclared (first use in this function)
Hi, Did you copy the include…
Hi,
Did you copy the include and src folders from development folder to GuruxDLMS.c-master/Arduino_IDE/client
client
...client
...src
BR,
Mikko
yes i have copied the files,…
yes i have copied the files, when i commend all the files in the ignore file it get compiled, why ?.
i just want to read the voltage, current, energy consumption details from the meter. i have connected my optical probe to serial2 (RX2 and TX2) of esp32 then what are the commends to be uncommented. please help. my current Arduinoignore.h file is
Hi, Ignoring the security…
Hi,
Ignoring the security setup caused this. This is now fixed. Get the latest version.
BR,
Mikko
hi Kurumi, thanks for the…
hi Kurumi,
thanks for the replay, can you please tell me which are the lines in the ignore.h file to be uncommented with respect to the new updated version. also please tell me on how to modify the code to use the optical probe connected to the Serial2 of esp32. I have to use the LLS key for communicating with the meter, so where should i place the LLS key in my code ?
Hi, You don't need to…
Hi,
You don't need to uncomment anything from gxignore.h. Just get the latest version and update that under the development folder.
To connect with LLS you need to change this line:
Client.init(true, 16, 1, DLMS_AUTHENTICATION_NONE, NULL, DLMS_INTERFACE_TYPE_HDLC);
to this:
Client.init(true, YOUR_LLS_CLIENT_ADDRESS, 1, DLMS_AUTHENTICATION_LOW, YOUR_LLS_PASSWORD, DLMS_INTERFACE_TYPE_HDLC);
You shouldn't need to do anything if your Arduino version supports UART.
BR,
Mikko
how can i find the LLS…
how can i find the LLS_CLIENT_ADDRESS of my meter and how to add my authentication key ? should i enter it in asci format or in hex ?, i can give you the AARQ of my meter obtained from gurux director can you tell me the LLS_CLIENT_ADDRESS. also please comment on using the RX2 and TX2 for my code where my optical probe is connected to ESP32.
7E A0 41 03 41 10 E4 8F E6 E6 00 60 33 A1 09 06 07 60 85 74 05 08 01 01 8A 02 07 80 8B 07 60 85 74 05 08 02 01 AC 07 80 05 46 41 57 53 54 BE 10 04 0E 01 00 00 00 06 5F 1F 04 00 00 1E 5D FF FF 04 99 7E
Hi, Client address is 0x20…
Hi,
Client address is 0x20. The password is: FAWST
This connection doesn't use an authentication key.
I can't say anything from the UART, because I don't know what board or chipset you are using.
BR,
Mikko
iam using ESP32-WROOM-32
iam using ESP32-WROOM-32
Client.init(true, 0x20, 1, DLMS_AUTHENTICATION_LOW, FAWST, DLMS_INTERFACE_TYPE_HDLC);
can you please check the code snippet and verify this right or wrong
Hi, Try something like this:…
Hi,
Try something like this:
Client.init(true, 0x20, 1, DLMS_AUTHENTICATION_LOW, "FAWST", DLMS_INTERFACE_TYPE_HDLC);
BR,
Mikko
hi, thank you for the…
hi,
thank you for the response, can you please comment on how can i modify the code to use Serial2 port of my ESP32-WROOM-32.
Hi, If your board manager…
Hi,
If your board manager doesn't support Arduino serial port, you need to replace your own implementation where the serial port is used.
BR,
Mikko
my board manager is…
my board manager is supporting serial port but i have connected the optical probe to another pins, can i map the pins to the desired pins. if not can you please explain the connection of the circuit. like where to connect the tx/rx pin of optical probe and
Hi, You need to check the…
Hi,
You need to check the correct PINs from the chipset documentation.
Pins vary between the chipset models.
BR,
Mikko
i am using Docklight for…
i am using Docklight for debugging my circuit. my meter is not responding when i send
"/?!\r\n" what may be the reason ?.
my meter is also not responding with the client code.
Hello, Your meter does not…
Hello,
Your meter does not support IEC Mode E. Try to change HdLC_WITH_MODE_E to HDLC.
Check your baud rate. The best option is to download GXDLMSDirector and connect with that to check the correct parameters.
BR,
Mikko
i have already used the…
i have already used the gurux director the settings are
baude rate 9600
parity none
8 bit
where should i change HDLC_WITH_MODE_E to HDLC in the client code ?
when i run the below code i…
when i run the below code i got output
" 10-04-2025 12:17:56 Received bytes:
010-04-2025 12:17:56 com_initializeConnection failed 25210-04-2025 12:17:56 Start reading10-04-2025 12:17:58 Received bytes:
010-04-2025 12:17:58 Data send failed. Try to resend. 1 "
can you guide me what did i do wrong and how to solve it.
[code snippet removed]
Hi, Please, don't add code…
Hi,
Please, don't add code snippets from GitHub. It doesn't help.
Try to connect with your PC first to check if the MCU sends any data.
Then check your baud rate.
Try to connect with GXDMSDirector first to check the correct settings.
BR,
Mikko
i have connected the meter…
i have connected the meter with gurux director and i was able to read the data from it. but when i connect the meter using esp32 using the client code i got this output at the debug serial port. can i enable any log option in the clent code to see what is happening in the code.
when i decoded the data send by my optical probe connected to esp32 with another usb optical probe connected to docklight the data for SNRM is sending correctly. but the response from the meter is not processed by the client code. can i enable any debug option to see more details at the serial
Hi, The common problem with…
Hi,
The common problem with optical probes is that the power levels are too low.
Check that there is enough power to use the optical probe.
You can send debug info to the other serial port, but I believe that debugger is better to solve this.
BR,
Mikko
i got response from my meter…
i got response from my meter when i modified my optical probe the response i got is
:Start reading :com_initializeConnection SUCCEEDED 0 :Logical Device NameIndex: 2 Value: 56 54 4B 2D 33 36 53 4D 20 31
:ClockIndex: 2 Value: 04/11/2025 19:33:14
Index: 3 Value: 330
Index: 4 Value: 0
Index: 5 Value: 01/01/1970 00:00:00 UTC+00:00
Index: 6 Value: 01/01/1970 00:00:00 UTC+00:00
Index: 7 Value: 0
Index: 8 Value: 0
Index: 9 Value: 0
next i want to read the voltage, current, and energy from the meter, what are the modification i want to do in my code. please help.
dose i want to edit the line
ret = com_readAllObjects("0.0.43.1.0.255");
iam using indian standard meter.