Skip to main content
Home
for DLMS smart meters

Main navigation

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

Breadcrumb

  1. Home
  2. Reading DLMS devices using Bluetooth





GPRS

Read basic information from Gurux.DLMS component before you start to create DLMS client.
Source codes of this example are available on GitHub.

Reading meters using Bluetooth connection – Step by Step

If you want to read your meters using Bluetooth connection your meter must support Bluetooth. If the meter is not supporting Bluetooth then you can use optical Probe that supports Bluetooth or Bluetooth to serial port converter.

Bluetooth connection is shown as serial port and you can communicate with your Bluetooth meter using a normal serial port connection.

In this example, we are using Raspberry Pi and Gurux DLMS library for Python to read DLMS meter. If you want to read your meter using Windows you can access your meter in the same way. The only difference is how to pair your Bluetooth device with Windows.

First, you need to pair the Bluetooth device with the Raspberry Pi. You can do it as described here.

1. Get list of Bluetooth devices.

hcitool scan

You get result like this, where XX:XX:XX:XX:XX:XX is BD address and HC-05 is device name.

 XX:XX:XX:XX:XX:XX       HC-05

Save DB address (XX:XX:XX:XX:XX:XX), you need it when you pair the device with Raspberry Pi.

2. Pair the meter with Raspberry Pi

Start pairing with bluetoothctl.

 sudo bluetoothctl

Then pair device:

agent on
default-agent
scan on

PIN code is requested when you run pair. Here we are using default pin code 1234.

pair XX:XX:XX:XX:XX:XX

Next trust the Bluetooth device.

trust XX:XX:XX:XX:XX:XX

Now you can close bluetoothctl application typing exit.

Next connect to the bluetooth device.

sudo rfcomm bind 0 XX:XX:XX:XX:XX:XX

Bluetooth device is now connected to /dev/rfcomm0

You need to run this command again if you restart the Raspberry Pi.

3. Getting Python source codes from GitHub

You can get client source code from GitHub typing

git clone https://github.com/Gurux/Gurux.DLMS.Python

Go to the Gurux.DLMS.Client.Example.Python folder get the required packages.

cd Gurux.DLMS.Python/Gurux.DLMS.Client.Example.Python
pip install -r requirements.txt

4. Reading the meter.

You can finally read your meter using Gurux.DLMS.Client.Example.python. Go Gurux.DLMS.Client.Example.python folder and run:

python main.py -S /dev/rfcomm0 -t Verbose

Thats it. If you have any questions or ideas how to improve Gurux.DLMS component let us know or ask question in a Forum


  • Create new account
  • Reset your password

Hire Us!

Latest Releases

Fri, 03/24/2023 - 14:22
gurux.dlms.c 20230324.1
Thu, 03/23/2023 - 11:01
GXDLMSDirector 9.0.2303.2301
Thu, 03/23/2023 - 09:10
Gurux.DLMS.Python 1.0.142
Wed, 03/22/2023 - 13:51
Gurux.DLMS.Net 9.0.2303.2201
Wed, 03/22/2023 - 10:15
gurux.dlms.c 20230322.1

Open bugs

Gurux.DLMS.AMI4
1
Gurux.DLMS.Android
1
gurux.dlms.c
3
gurux.dlms.cpp
3
gurux.dlms.delphi
1
RSS feed
Privacy FAQ GXDN Issues Contact
Follow Gurux on Twitter Follow Gurux on Linkedin