Skip to content

Commit

Permalink
Adapt to PLR50C
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbrechtL committed Aug 18, 2019
1 parent 26728a4 commit faa9bc7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
10 changes: 7 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
# BOSCH GLM rangefinder

Python3 script to remote control a BOSCH GLM 100C or GLM 50C rangefinder.
**This is a fork of https://github.com/philipptrenz/BOSCH-GLM-rangefinder which controls BOSCH GLM 100C/50C.**

This script provides remote control features for the BOSCH GLM 100C/50C measuring device via its Bluetooth serial interface. The device uses the transfer protocol as described [in this blog post](https://www.eevblog.com/forum/projects/hacking-the-bosch-glm-20-laser-measuring-tape/msg1331649/#msg1331649).
Python3 script to remote control a BOSCH PLR50C rangefinder.

As the protocol seems to be identical for various Bosch measuring devices this script could also work for Bluetooth enabled rangefinders like PLR30C, PLR40C or PLR50C. If so please let me know!
This script provides remote control features for the BOSCH PLR50C measuring device via its Bluetooth serial interface. The device uses the transfer protocol as described [in this blog post](https://www.eevblog.com/forum/projects/hacking-the-bosch-glm-20-laser-measuring-tape/msg1331649/#msg1331649).

As the protocol seems to be identical for various Bosch measuring devices this script could also work for Bluetooth enabled rangefinders like BOSCH GLM 100C/50C, PLR30C, PLR40C or PLR50C. If so please let me know!

Here is also some interesting code: https://github.com/piannucci/pymtprotocol

## Features

Expand Down
26 changes: 16 additions & 10 deletions glm100c.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#!/usr/bin/env python

"""
Connect and control a BOSCH GLM100C laser range finder via Bluetooth
Connect and control a BOSCH PLR50C laser range finder via Bluetooth
May be adaptable for similar Bluetooth enabled BOSCH measuring devices, like GLM50C, PLR30C, PLR40C or PLR50C
Author: Philipp Trenz
Author: Philipp Trenz, Albrecht Lohofener
"""
import os
import bluetooth # install pybluez
Expand Down Expand Up @@ -65,6 +65,7 @@ def find(self):
nearby_devices = bluetooth.discover_devices(duration=8, lookup_names=True, flush_cache=True, lookup_class=False)
for index, val in enumerate(nearby_devices):
addr, name = val
print('Found device ' + name.upper())
if dev in name.upper():
self.bluetooth_address = addr
print('Found BOSCH ' + dev + ' @', self.bluetooth_address)
Expand Down Expand Up @@ -154,20 +155,25 @@ def __init__(self):
self.port = 0x0001
super().__init__()

class PLR50C(GLM):
def __init__(self):
self.port = 0x0005
super().__init__()

if __name__ == "__main__":

# Add argparse in a future.
try:
device = GLM100C()
except:
print('No devices GLM100C found')

try:
device = GLM50C()
device = PLR50C()
except:
print('No devices GLM50C found')
os.sys.exit()
print('No devices PLR50C found')
os.sys.exit()

#try:
# device = GLM50C()
#except:
# print('No devices GLM50C found')
# os.sys.exit()

# connecting can be speeded up when the mac address of the device is known, e.g.:
# device = GLM100C(bluetooth_address='54:6C:0E:29:92:2F')
Expand Down

0 comments on commit faa9bc7

Please sign in to comment.