cave surveying

How to build an electronic cave surveying instrument

This article was published in the BCRA CREG journal 54.

Introduction

I'll skip most of the introduction – Wookey gave a good overview on this topic in CREG Journal 52. Our aim is to replace the mechanical sighting instruments (clino, compass) and tape measure with something more easy (and hopefully at least as accurate) to operate. We don't need to consider measuring distances – this task has been solved by various incarnations of the Leica Disto or other laser rangers, which are (not cheap but) readily available. In contrast, only few people need a precise compass. Surface surveying is done using theodolites, which are much more precise than any device relying on the earth magnetic field. Even fewer people need an electronic compass that can be tilted (not to mention those who need to know the tilt, too). Well, we do – but this market is very small and so is the number of available products. In this article, I'll focus on the electronic compass/clino combination, Wookey already discussed other (inertial or GPS-style) instruments. In particular, I'm going to assume that we're going to have an instrument with three magnetic field sensors, two axis tilt measurement and an attached laser pointer for aiming. I'll call the two inclination angles "tilt" (the one you'd like to measure) and "roll".

Accuracy

I talked to several cavers and they all said that an electronic surveying instrument should be at least as accurate as the conventional ones. The Swiss SGH Berne group has an outdoor calibration site where each surveyor/instrument pair is regularly calibrated. Using this calibration scheme, they make sure that instrument errors for both compass and clino are below 1° (Wookey mentioned 2° for the compass).

The important point is: Tolerances are worthless unless you can verify them. For example, suppose someone told you he had a flash of genius and is able to measure voltage with an accuracy of 0.01% using a clever combination of a PIC generated PWM, an R/C element and comparator (maybe after having figured that a 16-bit timer resolution somehow means .0015%). What would you do? You'd borrow a 6.5 digit voltmeter from your workplace, connect several stable voltages to his circuit and your voltmeter and (if you're concerned about temperature) put it into the fridge or oven. Most likely, you'd discover that 2% is a more appropriate figure to characterise the performance of his circuit.

The calibration site I mentioned above simply consists of a centre point and three additional points in the field which have been accurately measured using a theodolite. A clino only has one degree of freedom – the rotation of the combined weight/scale around its axis. The only errors might be friction or slip-stick effects of the bearing or an absolute error in the readout. For the compass, a few more errors might be present (like a magnetic attached LED light), but it's still only one degree of freedom you have to check. Because of this, three measurements are sufficient to verify the instruments' accuracy.

An electronic compass is much more complex. Ideally, the sensitivity vectors of the sensors and the laser would all be aligned to one of the three arms of an orthogonal coordinate system. Of course the're not! As all six sensor/laser axes can aim into any arbitrary direction, there are about twelve degrees of freedom in this assembly (well, not entirely arbitrary. Let's say they point into roughly the right direction, plus/minus a few degrees). And that's only from the geometry, in addition, there is offset, amplitude error, drift, noise and temperature dependence of all sensors. To check if your calibration scheme works, you can either identify every single error source (like channel Y magnetometer offset voltage) and make sure it's within the allowed tolerances (how do you calculate those?) or (more realistic) you test the whole system. For the latter, as there are so many degrees of freedom of your system, I think you need a large number of reference points to be sure the thing works. Maybe eight headings with five inclinations each would do. But how do you do that with the required accuracy? Any calibration standard should be at least ten times as accurate as the unit under test. On the surface, checking a sighting compass to 1° is easy given the 0.003° accuracy of the theodolite reference measurements. After you made the 40 measurements, you know that in the south-east, heading is generally about –2° wrong, in the west above +30° inclination, you have –3° and in the north you have a +-1.5° error depending on the inclination (not even thinking about the different roll angles that need to be compensated for). It's difficult what exactly went wrong in the calculation if you don't have more information. I stopped my Auriga development mainly because it is very difficult to verify its accuracy.

Make or Buy

After all the difficulties I described above one might be inclined to simply buy the entire device and trust the specifications of its manufacturer. Unfortunately, there is no affordable surveying tool we could use. But there are some compass and inclinometer modules. If we had a tilt compensated compass with both heading and tilt output, we could simply add a laser pointer, think about how we'd calibrate the laser direction and put the whole thing into a waterproof box. To display the results, anything from a small LCD module to a handheld computer is possible. The table below shows some candidates for our new electronic surveying gear. Some notes: "Technological level" is my personal opinion on how advanced the module is. Accuracies are often quoted with restrictions (heading accuracy when level) or under different conditions, check the datasheets for details.

Compass modules overview

#

Manuf.

Type

URL

Price

Techno- logical level

Heading acc.

Tilt range

Tilt acc.

Supply voltage

Supply current

1

KVH

C100

www.kvh.com

?

*****

0.5° RMS

± 16°, ± 45°

no tilt output

8-18V

40mA

2

True North Tech.

Revolution

www.tntc.com

500$

****

0.5°

± 40°

0.2°

5-25V

15mA

3

Honeywell

HMR3000

www.ssec.honeywell.com

675$

***

0.5-1.5°

± 40°

0.6°

5, 6-15V

35mA

4

Honeywell

HMR3300

450$

***

1-4°

± 60°

6-15V

22mA

5

Aositilt

EZ- Compass 3

www.aositilt.com

**

0.5°

± 70°

?

5V

?

6

PNI

TCM2-20

www.precisionnav.com

699$

****

0.5-1°

± 20°

5, 6-18V

7

PNI

TCM2-50

769$

****

1-1.5°

± 50°

5, 6-18V

8

Devantech

CMPS03

www.robot-electronics.co.uk

22.12 GBP

*

0

-

5V

20mA

9

Point Research

TruePoint

www.pointresearch.com

?

*****

1° RMS

± 90° (!)

1° RMS

6-30V

0.27W

Number 1, the KVH C100 is definitely a nice module. It has a very high heading accuracy and is definitely rugged enough – anything that can be built into a battle tank must survive a caver too. The C100 is based on a fluxgate core that is floating in some liquid. Unfortunately, only the heading is measured, it has no outputs for the inclination. Number 2, True North Technologies' Revolution module, is currently the favourite compass in the Yahoo cave surveying group. You can see a simple setup at http://www.caves.com/truenorth/, which has been built by Mark Passerby & Nigel Dyson-Hudson. The module is small, pretty accurate at a moderate price (500$). The only drawback is the operating range of only 40°, limited by the two-axis electrolytic clino they are using. Honeywell has lots of magnetic field sensors, I selected two compass modules that would fit in our application. Toma Ondrach, maker of the "Kombi" instruments (http://kombi_measuring.tripod.com/), once told me he'd use one of the Honeywell modules in his gear. However, the new TNT Revolution is more accurate and less expensive (compared to the HMR3000). Number 5, made by Aositilt, does not really convince me. Their specifications are not clear and I don't believe the accuracy they specify. When searching the web for electronic compass modules, you often find references to PNI's TCM2 (# 6 and 7). Again, compared to the TNT Revolution, it's too expensive. Number 8, Devantech's CMPS03 module is not really an option, but it's dirt cheap so I added it anyway. Last, but not least, I really like the TruePoint module by Point Research. It's another module probably financed by the U.S. military and is used in their Land Warrior program (see http://www.mindjack.com/feature/landwarrior.html for some good ideas on pretty rugged gear). The TruePoint is the only module that uses MEMS (microelectromechanical system) accelerometers as inclinometers. As a result, it can be operated in any orientation and measure tilt angles up to 90°. The accuracy is not as good as TNT specifies for their revolution module, however, the 0.5° accuracy of the TNT module is limited to tilt angles <35°, while Point Research guarantees 1° accuracy over the whole tilt range. But – depending on the dip angle of the earth magnetic field, errors in the tilt measurements can have a large impact on compass accuracy. The application note AN22 (Philips, reference below) shows that in Hamburg, a tilt error of 1° can lead to a heading error of 2.3°.

 

Auriga

 

Quite some time ago, when I was thinking how to build an electronic cave surveying instrument, I started experimenting with sensors I could use. Starting in 1996 (I think) I tried to build inclination sensors. I tried potentiometers with weights on the axis (too much friction or not enough damping), magnetically damped encoder wheels (very good, but unusable with a compass), self-built electrolytic clinos (vodka-filled plastic constructions more or less sealed by two pcb's) – altogether not really working. Things improved when I got two electrolytic inclination sensors from Spectron Sensors. It took me a while to figure out a reliable signal conditioning (any DC voltage across their terminals destroys the clino), but afterwards, they proved very accurate. I salvaged a .05° incremental encoder somewhere from the junk and used it to calibrate the electrolytic sensor. Linearizing the data using a third order polynomial fit, an accuracy of 0.1° was easy to achieve. I mainly used a single-axis +-80° sensor – the dual-axis sensors (which could measure both tilt axes and which are used in the TNT compass) are restricted to a smaller measurement range.

On the compass side, I started working with the KMZ10 magnetoresistive sensor from Philips. This sensor requires a compicated circuitry (flip pulse generator, synchronous rectifier) to compensate for the offset errors of the sensor. In addition, it needs a (manually wound) compensation coil for maximum linearity. Later, Philips introduced the KMZ51 sensor with built-in compensation coils. There is an excellent application note on how to build an electronic compass and a detailed description of a compass schematic at http://www.semiconductors.philips.com/acrobat/applicationnotes/AN00022_COMPASS.pdf. In 1997, when I built my compass, I only had a schematic for the KMZ10 that has been published in the ELRAD magazine. I added a compensation coil driver and used it for the KMZ51:

click here for the schematic

This was a rather complicated schematic, but it worked. You can find a detailed description in the application note AN22 mentioned above.

So, I had both the magnetic field sensors and one inclination sensor. I intended to omit the second inclination sensor and replace it by a bubble level – simply hold it level when measuring (more on this later). The remaining piece was the control unit. I went through several iterations here as well. In the beginning, I used a small PIC microcontroller board. Soon, I realised that the complexity of the computations could not be handled by an 8-bit microcontroller I had to program in assembly language. The next try was an 68HC11 board (still availble! http://www.elektronikladen.de/mops11.html), which had a nice operating system and some kind of compiler language. The compiler was, however, so inefficient that the memory of this system soon was filled with a number of simple subroutines. In addition, I had to make the user interface entirely by myself. While the original idea of my PIC board was to make all data entries using a single knob with a rotary encoder, I built a small keyboard with 32 keys and intended to use an LCD module as display. At that time (still 1997), I already wrote little programs for my PalmPilot (which were in their beginnings that time, not the fancy stuff with camera and color video playback), like a japanese dictionary and such. I put the HC11 board away into some drawer (where it is still today) and started developing the software for the PalmPilot. The system architecture is as I described in an earlier article (palm programming for embedded applications), a microcontroller (a PIC16F877) for the sensor interfacing (A/D conversion, power management etc) and the PalmPilot taking over the user interface and the computation intensive part (which might go as far as inverting a 9x9 matrix). From there, things went more smoothly. I wasted quite some time in 1998 trying to develop software using the free GCC compiler until I bought the Metrowerks CodeWarrior in 1999 (yes, I know, I repeat myself. But I had to say it). I wrote two programs – one cave database software which could be used for entering and displaying surveying data and a second one for interfacing to the Auriga sensor box.

 

The computation involved correcting the inclinometer and magnetometer raw data and then calculating the heading. Correcting the clino was simple, as I mentioned above, using a polynomial fit. Calibrating the three-axis magnetic field sensor was much tougher challenge. This calibration would make an article itself, so I'll be brief here. The algorithm is both elegant and powerful, thanks to Gauss and some other clever guy (I can take credit only for its application). It entirely removes offset, amplitude, and all (!) geometry errors of the sensor array, yielding a unity length vector in an orthogonal coordinate system. This means the sensors could point in arbitrary directions as long as they are somehow distributed in all three dimensions. In addition, all soft- and hard-iron effects are removed. The drawback is the algorithm does some heavy matrix arithmetic that would need some simplification when they should be performed on a PalmPilot. I did the calibration offline using a Matlab program.

As convincing this may sound, the development and especially the debugging of the sensor was far from easy. The main problem is that it is extremely difficult to test a compass. Inside my apartment, the magnetic field strength varies by over 100% with wild changes in heading. For getting the calibration data, I had to go somewhere out in the open field and store the data in the PalmPilot. You can imagine that debugging is extremely difficult under the circumstances. That's the reason why I finally stopped working on it in the year 2000. You'd need a Helmholtz cage (for the magnetic field sensors only) or a non-magnetic gimbal mount – all with a precision of about 0.1°. This can be made, but the effort is higher than a single individual can probably afford. Looking back, I now also see that I neglected the geometry errors of the inclinometer and the laser pointer, which both affect the result too.

In the meantime, Luc Le Blanc took over the Auriga software development and made a rather sophisticated and uesful program out of it. You can read about it in Luc's article in this or the next issue.

What could we do?

If we want to build some kind of electronic surveying instrument, there are two possible ways:

  • Buy a TNT compass module and build a case and laser pointer around it
  • Build your own compass/clino module

Buy compass module

Watch www.caves.com and join the yahoo cave surveying group to see what they are doing. Let's say we use the TNT Revolution compass. If their specifications are true, there are only two reasons for not using it: first, 500$ is too expensive and second: +-40° tilt range is not enough. I suggest we don't care about the money and be content with it's tilt range for now. We still have some open points:

  • building a rugged (nonmagnetic!) case
  • how to display/store the data
  • what about a laser ranger?
  • calibration of the laser pointer?

There are several ways to display the data. You could use a small LCD module and a microcontroller to get the data from the RS-232 interface and simply show them in the display. Another possibility would be to use a PalmPilot (which – conveniently – already has an RS-232 interface) and connect the module to it. If you take into account how dirt cheap used old PalmPilots are nowadays (check ebay), it will be probably even the cheaper solution. Not to mention that you get a 100% working unit with graphical display and (single task) operating system. By the way, that's exactly what the people at caves.com are doing.

A laser ranger would be a nice addition. The more expensive ones have an RS-232 interface too, you can add it to your setup – just as TomᚠOndrouch did in his "Kombi" units. I am not sure if this is worth it. The proximity of the laser ranger will probably influence the compass (a challenge for it's hard and soft iron compensation) and laser rangers with serial interface are usually more expensive too.

Don't forget the calibration of the laser pointer. You would intend to mount it aligned to the sensitivity plane of one tilt axis (to have an exact tilt readout). If there are errors in the alignment, correction is trivial (subtract an offset only) as long as the roll angle is zero. It won't be, of course, and you have to find out a method of either adjusting the mounting error (should be possible by aiming at a fixed point and varying the roll angle) or finding an algorithm that identifies and removes it. If you don't do that, at least estimate the mounting error (depending on your mechanics, maybe +-5°?) and calculate what effect it has on the measurement readout.

Build it yourself

After experimenting a few years, I'd like to give a warning: Don't underestimate this development. Both electronics and math involved are highly non-trivial and you won't achieve a useful accuracy if you ignore part of it. Sensor application notes might be tempting, but the applications these documents have in mind are never high-precision measurements.

Beginning with the electronics, the magnetic sensor array should be no problem for someone experienced in precision analog design. You could use the KMZ51 based on the Philips schematic, making a low-power design if possible. For the clino, I think there is no point using an electrolytic clino. You might as well buy one of the modules I lined up above. In contrast to the electrolytic sensors, there are many companies developing new MEMS sensors. Analog devices for example has developed a new low temperature drift accelerometer. "The ADXL203 and ADXL103 are sampling in a 5 x 5 x 2 mm LCC-8 with the 203 priced at $7.50 and the 103 at $4.95, both in 10-k piece lots. Production volumes will be available in the 3rd quarter 2003" (www.analog.com). The main reason for using an MEMS sensor would be (besides cost) that they can measure a full 360° rotation and for that reason, the Gauss linear least square fit algorithm I used for the magnetic field sensors could be applied. With this, all geometric and (linear) electronic errors can be eliminated quite painlessly, removing (a major source of headache and) some degrees of freedom that would otherwise be very difficult to calibrate. I am just not sure if these sensors are precise enough. If you can't get a stable sub-degree accuracy independent of temperature and cross-axis tilt, you can't use them. So the first electronic task I'd suggest is finding a likely suspect for a precision MEMS clino, build one and see if it's accurate. This is not easy if you want to do this with 0.1° accuracy. But incremental encoders are easily available with this accuracy and a heater and fridge should also be within reach. And, fortunately, the gravity field is much more stable than the magnetic field, letting you make your experiments on your workbench (on the other hand, life would be infinitely more fun if the gravity field could be influenced as easy as the earth magnetic field. Instead of struggling up drafty shafts on muddy 11mm rope, you'd wind some gravity coils around your waist, helmet and boots, switch them on at the bottom of the shaft (rotating the gravity vector by 90°) and simply walk up it's walls).

Calibration is a point I underestimated first when I built the Auriga sensor (that's a shame because it really can be the fun part). The first thing to do is identify all possible mechanical and electrical errors. Second, you can think about how to remove them. Using the calibration algorithm mentioned above, all errors of the magnetic and gravity sensor arrays can be removed. But still the orientation of the magnetic and gravity coordinate systems and the laser pointer axis to each other is unknown. There should be a possibility to solve that problem (without a precision nonmagnetic gimbal mount). The resulting Matlab (or whatever math program we'd use) code is probably a thousand lines long, containing most likely more than one bug (like my favourite, multiplying a matrix from the wrong side). We'd need a simulation model that could generate data sets with arbitrary geometrical and electrical errors to verify the calibration. I did that already for the magnetic sensor calibration – that's the easy part.

One important point is left over: How do you test it? As I explained above, testing a compass/clino combination is very difficult. With testing I don't mean simply pointing in two directions and checking if the headings are correct. The unit must deliver accurate results in all headings, in all tilt (two axes!) angles and under all temperature conditions. While it is possible (but difficult) for example to build a precision gimbal mount, it is unrealistic for all those people who'd like to build the instrument to have such a setup. While the commercial compass modules come factory calibrated (using for example a helmholtz cage at one manufacturer), we'd either have to set up a central calibration service or come up with a calibration algorithm that's so clever it ensures precise operation regardless of how everything is put together.

So...

What's next? Mainly this project needs people working on it. If it helps, I can share any schematic, code or ideas about Auriga I have. I'd enjoy working on the calibration problem, at least concerning the math. Maybe there are more who'd like to join?