Poor Man's Digital Survey Device

This is a low cost device for Cave Surveying, it uses an Android Phone and should work with any Backlit Laser Distance Measure. It needs a custom enclosure (case, box, whatever) that allows buttons to be pressed on both devices. For the proto type I used:

A £50 Laser Distance Measure off ebay

Low cost Laser Distance Measure

 

A Samsung Galaxy Y Phone

Samsung Galaxy Y Android Phone

 

A custom made enclosure to house both devices (I made this from GRP)

 

The phone is the clever bit. It has a 3 axis magnetometer and a 3 axis accelerometer, it also has a camera. The basic process is to point the Laser, read the bearing, measure the distance and then then use the camera to OCR (optical character recognition) the Laser distance reading. All the readings are logged on the phone and there is the option to save the Image of the distance measurement so that the OCR can be verified. The phone has a Flight Mode which turns off all the transmitters and reduces the interference with the magnetometers. However there is a crucial thing to note about Android phone magnetometers - THEY ARE ALWAYS IN CALIBRATE MODE - this has pros and cons. The main advantage is that it is really easy to calibrate the magnetometers, the main disadvantage is that you always need to calibrate before taking a reading. The upshot is that I can get better than 1% loop closures (as good as I can get with a compass).

I have put a more detailed description of working with Android Magnetometers >here<

 

Setting up and using

The fundamental requirements are

  • a backlit laser measure (the back light is important, trying to light from the front causes glare and uneven lighting that makes the OCR process fail)
  • An Android phone – only tested on a Samsung Galaxy Y at the moment
  • A non-ferrous enclosure (ideally plastic, I used GRP) that holds the phone and laser measure parallel and sufficiently far apart that the phone camera can focus on the LCD of the laser. This enclosure must also allow buttons to be pressed on the laser and the phone. The enclosure must hold the Phone and Laser rigidly so that they do not move in relation to each other.

On starting the application you will see a basic screen with the Bearing, Clino and Distance at the top, two buttons (View and Leg) and a checkbox (Section). NB. Whenever the application is running the phone is put in Flight Mode this means that no calls can be made or received (this is to reduce interference with the magnetometers).

Before the device can be used it is necessary to set up some basic parameters. Critical amongst these are defining the area on the Laser LCD where the distance digits are to be read and defining the threshold at which black and white pixels can be distinguished. The application contains functionality to help with this. To get these values it is necessary to capture an image off the Laser using the precise setup that will be used in the field (i.e. the phone and Laser should be in the enclosure). The process is:

  • Start the Surveyor application on the phone
  • Click the phone's Menu button and choose "Settings"
  • Tick the "Save Image" checkbox and then exit settings
  • Click the "Leg" button
  • Enter some station names (anything will do for this)
  • Click "Ok to read Brg"
  • Wait for the pop-up message to disappear and then tap the screen on a blank area
  • The camera preview should now be shown and you should be able to see the LCD reading (turn the LCD Back light on!)
  • Read a distance on the Laser, ideally this should be long enough to show all the digits that your Laser is capable of (e.g. if it can read 50m take a reading over 20+ metres)
  • Click OK on the screen. This will now have written the captured image to your Phone's SD card (that's why you selected "Save Image" above)
  • Now click the phone's Menu button again and select "View"
  • You will see a mainly blank screen, click the phone's Menu button again and select Open File.
  • You should see a list with one file named after the station names you used above. Click the file to open it.
  • The captured image is displayed on the screen.

There are two things we now need to set up, the digit area and the black/white threshold. To set up the Digit Area:

  • Click the phone's Menu button and choose "Select Area"
  • Click at the top left of the area with the measured distance digits are displayed and drag down to the bottom right. The aim is to define a rectangle around the digits which is slightly larger but does not include any other characters on the Laser LCD screen or the LCD screen edge itself.
  • The resulting coordinates are shown at the bottom of the screen. The click and drag process can be repeated until a reasonable rectangle is defined (don't worry of it is a bit out, it can be manually edited)
  • Note the coordinates and then click the phone's Menu button and choose "Settings" then "Digit Area" and enter the coordinates noted above.
  • Exit settings and a red rectangle should be drawn around the area you defined. Check that this is ok, reselect or manually edit the values in Settings->Digit Area to adjust.

Now it is necessary to set the threshold. This is entered as a percentage of the average brightness a pixel is considered to be black. If it is too low the digits will bleed into one another and if too high the digits will be disjointed. For my setup about 80% is a good value. Having performed the steps above to define the digit area do this whilst the captured image is still displayed (you can get back to this point by starting the Surveyor application, choosing "View" from the phone's menu then "Open File" from the phones menu and select the file).

  • Click the phone's Menu button and choose "Process Image"
  • The results of the processed image will appear at the top of the screen and a popup will appear giving the OCR'd reading.
  • If the OCR reading contains underscores (e.g. 12_456) then it has failed. It may also misread certain numbers so check that the OCR value matches the image.
  • If the OCR value is incorrect go to "Settings" and change the B/W Threshold value, click process again and check the result.

Having got everything set up it should be possible to start taking readings. The process is:

  • Click the Leg button
  • Enter the station data and turn on the Laser and Backlight
  • Calibrate the Phone. This needs to be done every time, the backlight in the phone's display affects the phone magnetometers (and the Laser may also have an effect) so the phone must be calibrated with the screen and laser as they will be for taking the bearing. Calibrating the phone is easy it just involves a couple of three axis rotations, best done by waving it around in a three dimensional figure-of-8. This site seems to give the best description for calibration
  • Point the laser at the next survey station and tap the screen to read the bearing.
  • The phone camera preview is then displayed so you can see the Laser LCD. Read the distance and hit the Ok button.

By Default data is saved in a file called Survey.txt in a directory called Surveyor on the phone's SD Card. Images of the Laser LCD are also saved here for verification. (These can be changed in the settings for the app).

There is a "Sect" tick box which at the moment is probably best considered as experimental.  The intention is that with this box ticked, you will take a shot to a known station and then take a number of readings (left, right, up, down and anything in between) to produce a section of the cave at that point. It is a tick box because it will continue to read bearings and distances whilst the box is ticked. Un-ticking the box will exit section mode.

 

 

Building

The code is licensed under the GPL. Please remember this is an early Beta release so whilst it is largely functionally complete it needs a lot more testing, especially on different phones/lasers. Please let me know of any issues you find and submit back any fixes/changes

The code is available here: Surveyor-Beta1.1-20121018.zip

A binary for SDK 10 is available here (click this link from your phone)

To build the code you need the Android SDK from Google and the Eclipse IDE (strictly speaking this is not required but it's free so get it!)

There are two Eclipse projects Surveyor and SpeleoLib, these can be imported into Eclipse from File->Import and then Import Existing projects into Workspace. The Surveyor needs to reference SpeleoLib (this is probably already part of the project properties but if not go to Properties for the Surveyor project, select Android and then click the Add button next to the lower "Library" window).

All being well it should build for Android SDK Version 10 and upwards.