iLDM 150 - lz1asl/CaveSurvey GitHub Wiki
Device
Cheap device with 70m range and +/-65' clinometer. Precision of 1.5mm for the distance and 0.5' from the clinometer.
http://www.cem-instruments.in/product.php?pname=iLDM-150
Usage
To use with CaveSurvey:
- Configure to work in meters and degrees, distance and inclination over Bluetooth.
- For distance select a cell and press the measurement button on the device twice.
- For inclination switch to the "inclination" mode and select the inclination cell. You should see the measurements updated in real time. Press a key to fix the current value.
iLDM Bluetooth Protocol
Note, only a subset of the protocol will be used for this project.
To establish connection:
- Discover the device
- Cancel the discovery
- Get BluetoothSocket as a client calling createInsecureRfcommSocketToServiceRecord to 00001101-0000-1000-8000-00805F9B34FB (see http://developer.android.com/reference/android/bluetooth/BluetoothDevice.html - createInsecureRfcommSocketToServiceRecord(UUID))
To send a message:
- Prepare command as a hexadecimal String and encode to byte array: "D5 F0 " + command + " 0D" (spaces were used for clarity), where command codes vary from "E0" to "EF"
- Write to the BluetoothSocket.getOutputStream()
To handle the response:
- Thread to retry reading in a byte buffer
- Messages are 25b long
- Starting "-43" bytes are removed
- Valid packet is extracted
- bytes:
- byte 0:
- byte 5: error code
- byte 6: recording mode:
- 1 from top of the device
- 2 from bottom of the device
- byte 7: measure unit, index for " ", "m", "in", "in+", "ft", "ft&in"
- 4 measures, each encoded in 4 bytes:
int measure = (0xFF000000 & buffer[(8 + j * 4)] << 24
| 0xFF0000 & buffer[(9 + j * 4)] << 16
| 0xFF00 & buffer[(10 + j * 4)] << 8
| 0xFF & buffer[(11 + j * 4)]);
where:
- missing values are encoded as large negative values, e.g. -26843545
- 10.1' angle is represented as "101"
- 2.43m distance is represented as "2430"
- depending of the mode the places of the measures may vary
- byte 25: should be 13 (data validation)
MeterMode Commands:
- 0 = Single
- 1 = Continuous
- 2 = Area
- 3 = Volume
- 4 = TwoTriangle
- 5 = ThreeTriangle1
- 6 = ThreeTriangle2
- 7 = DipDistance
- 8 = Addition
- 9 = subtraction
- 10 = Timing
- 11 = Stakeout
- 12 = AutoHorizontal
- 13 = AutoVertical
- 14 = AutoThreeTriangle1
- 15 = AutoThreeTriangle2