\require{AMSmath} \require{eqn-number}

BBWM (Bear Brook Watershed in Maine)


(last update: 02 Apr 2013)

-Under Construction-

- This is a work in progress -

- sorry about the mess -

BBWM is a paired set of watersheds in eastern Maine. It is the site of a long term environment monitoring station, which began in the late 1980's as a forest acidification test site.

Here's the official site for BBWM.

I began working there shortly after graduating from U.Maine in 1986/87.

Initially I dug ditches... sort of. I was the "human back hoe". Part of the instrumentation effort at BBWM was/is stream sampling. In order to do that, in an automated fashion, ISCOs were used. The ISCO 3700, still manufactured today is basically the same unit I dug pits for.

The pits I dug were not quite pits. The soils are thin and rocky in many places at BBWM. It does not take long to get to Till. Digging through Till, by hand, is a spectacularly futile exercise (with an emphasis on exercise), even if you are in your early 20's. So the ISCOs only got about half to three quarters burried. This meant that the rest of the "pit" ended up being a plywood, and building foam insulated structure.

And don't forget the drain for the pit, and the trench for the sample pipe. And be sure those are insulated as well or the whole kit and ka-boodle will freeze up solid.

It's hard to collect stream water samples when everything is frozen but the stream...

Anyway that's how I got started after I got my BA in mathematics.

Moving on to telemetry...

Getting a couple of ISCOs installed was my introduction to field telemetry. The ISCOs, a Belfort rain gage, solar panels, fog collector, various one off charge managers, power supply managers, heater drivers, battery banks... can't remember all the stuff...

At the time I was working with my roommate Dave Anderson. He had done much of the initial installation, along with Austin McHugh. Austin went off to work for Campbell Scientific Inc. (CSI), and a year or two later Dave went off to greener pastures, and I inherited all the telemetry system development. Much of it was already in place, thanks to Dave.

The first data logger used at BBWM was the CR21X manufactured by CSI:

Image of CR21X datalogger

It is now hopelessly out of date, and is no longer supported by CSI. CSI classifies it as a retired product. The CR21X data loggers were in place up until the 2004 - 2007 time frame.

I had left BBWM in the early/mid 1990s, so I don't know why the loggers were replaced. I have heard rumors of waterlogged data loggers, and other horror stories. Equipment got sent back to CSI, and they declared the stuff a total loss...

As I said I'm not sure what happened.

I became re-engaged with BBWM, in the spring of 2013. When I became aware that Ivan Fernandez (Ph.D) needed someone to figure out why the systems at BBWM were not working correctly.

A shadow of its former self...

To my great sadness I discovered the CR21Xs were gone, and so to was the entire RF telemetry network, and all the supporting equipment.

I have begun an equipment hunt but my efforts to date have revealed little.

Keep in mind I am trying to hunt down equipment that was first installed 25 years ago, and has not been in service for some 8 years. That is a very long time in the realm of environmental research. Such things are funded grudgingly... In my opinion... despite the eloquence, and dedication of the scientists, and research associates involved.

... anywho ...

Most of the CR21X data loggers, Motorola HT-90 data radios (HT-90s modified by CSI), DC95 RF modems, and all the other bits and bobs are nowhere to be found on site or otherwise.

What is still on site, although not working correctly, are the original Handar 436 Increment Encoders, and a couple CR1000 data loggers.

The photo below is of the West Bear CR1000 datalogger in the shop for testing.

Photo of CR1000 datalogger

Here's what a Handar 436 Increment Encoder looks like:

Image of Handar 436 Increment Encoder

Unlike when the CR21X loggers were installed, there are no CR1000 spares, and the Handar 436 was pretty much the only thing still being measured, other than outside air temperature. With no spares, that meant that the datalogger had to come back to the shop, so that the entire system could be checked.

Image of QD1 interface
QD1 Interface.

The small silver box, partially obscured by the stepper motor mount, is a QD1 interface from CSI.

The QD1 interface is used to condition the signals coming from a device such as the Handar 436. The conditioned signals are then passed from the QD1 to a data logger.

The QD1 interface has an internal oscillator used as a clock. The clock frequency runs at about 2.5 KHz. The clock is used to turn the power on and off to the "Encoder +5" port. Along with the "Encoder +5" port the "S1", and "S2" ports are pulled high (+5 volts) through resistors. The duty cycle of the ON pulse is quite low. Presumably the low duty cycle is used to minimize power consumption. The idea being that there is no reason to power the encoder when there is no change to its inputs. This is a safe bet, since typical stage height changes are measured in minutes, and hours not milliseconds.

The care, and feeding of magnetic field based rotary encoders...

There are two major types of rotary encoders (a.k.a incremental encoders). Optical rotary encoders, and magnetic rotary encoders.

A common form of the rotary encoder, at least in the past, is the ubiquitous computer mouse. Older computer mice had a rubberized metal ball which spun two chopper wheels. The chopper wheels interrupted a couple of LED emitter/sensor pairs. In this way an X/Y signal of the mouse's motion across a surface could be counted and sent to the computer.

The Handar 436 is a magnetic rotary encoder. The wheel inside the Handar 436 is a 100 pole magnet. Each channel of the Handar's output has two Hall-Effect switches. The A3132 is now obsolete. It has been superseded by the A1202.

The A3132 Hall-Effect switches act in the presence of a magnetic field. If there is a south magnetic pole they are in the ON state. If there is a north magnetic pole they are in the OFF state. If there is no field, their state is indeterminate, which can lead to all manner of mischief.

The nice thing about Hall-Effect sensors/switches is that there are no moving parts involved. This implies that they enjoy the reliability associated with modern semiconductor devices. If a standard relay or other mechanical switch were used, reasonable switch endurance would be measured in one hundred thousand switch cycles, possibly one million cycles. That may sound like quite a few cycles but in practice it is not.

However, reed switches/relays can survive 200 million cycles. Some can survive 1 billion. So there are some mechanical switching solutions that could manage quite a few cycles. The trouble is that they can be difficult or awkward to implement in this application.

Keep in mind that the Handar 436 generates 100 "switches" per single turn of its input shaft. With a typical stage height input wheel that equates to 100 "switches" per linear foot of stage height float travel. That means if the level of a stream or river goes up, and down by a single foot five hundred times, the lifetime of a typical mechanical switch or relay will expire. If the stream or river level changes often, and by more than one foot, a mechanical switch may not last very long.

So... how many switch cycles can be expected?

Here's an example using USGS data from 01-Oct-2007 through 31-Dec-2007, that's just three months out of one year:

\Delta_{sh} = 48243.58 \ ft
SPF = \frac{100}{ft}
N_{sw} = \Delta_{sh} \cdot SPF
N_{sw} = 4,824,358

This the period of October to December at BBWM is a rainy period, although September should be included. Unfortunately f

This the period of October to December at BBWM is a rainy period, although September should be included. Unfortunately f

Incremental Encoder Test Jig

Incremental Encoder Test Jig.

Handar436 Handar436 Handar436 Handar436 Handar436 Handar436 Handar436 Handar436 Handar436 Handar436 Handar436

What's wrong with the data...

The odd behavior looks like this:

West Bear odd behavior 2010

What's odd are the dropouts,

West Bear odd behavior 2010

The dropout areas are weird for a few reasons. One reason is their length, another is their duration, yet another is when they occur, and another is what happens after the dropout occurs.

Depth Of Dropout...

A fast deep drop out is hard to explain. Think of a concrete, mostly below ground swimming pool, which is 5 feet deep. How could you get the pool to drain completely in a few minutes?

You would have to cut a huge hole in the exposed face. It would be similar to cutting a big hole in Hover dam.

The depth of water where the BBWM weirs stop normal draining, through the V notch, is 5 feet. To get below that stage height there are only mechanism. One is evaporation. Evaporation takes a long time. The other is the large drain valve, which is normally locked. And this valve is usually only used once a year, to clean the weir. Usually during the summer, at low flow. Whenever possible the water in the weir is pumped into a storage truck, so that the water may be put back in after the weir is cleaned. In this way the water lost through the drain valve is minimized.

So... the only way the weir level can drop below the 5 foot level, is largely evaporation. A slow process.

Dramatic loss of stage height, in less than an hour, is hard to explain in the presence of evaporation only.

It seems more likely that some sort of problem is active in the measurement system.

Dropout Recovery...

The other inexplicable behavior is impossibly fast loss of stage height, followed by normal precipitation recording at an impossibly low (below 5 feet) offset.

Classic weir response
Figure 5.
Typical weir response.

The normal exponential decay of the stage height response cannot occur if the stage is below the 5 foot level. The exponential decay depends on water flowing over the V notch. If the stage height is below 5 feet, there is no flow over the V notch, so there cannot be the classic exponential decay signature.

Thus the behavior seen at the end of September 2010, and beginning in early October 2010 is impossible. At near 0 feet of stage height, there cannot be any flow through the V notch.

Figure 5 is an example of a weir response to a precipitation event with an exponential decay tail. In this case the graph is the signature of a precipitation event recorded from the West Bear weir in April of 2008.

The general form for exponential decay is,

r(t) = A \cdot e^{-t}

In the equation $r(t)$ is the response to the equation. The term $A$ is simply a place holder for the amplitude of the response, the limit of the peak of the weir response, during a given event. The term $t$ could be time, it could also be stage height. The point is that this simple equation can model the decay signature of a weir response to a precipitation event.

In order for this typical signature to occur, the water level in the BBWM weirs must be at or above the 5 foot stage height level. Water does not flow out of the weir V notch until the water level reaches 5 feet or more. No flow out the V notch, no exponential decay signature.

During the October 2010 to December 2010 period, the base line level is near zero feet. There would be no flow out of the weir until the level reached 5 feet. And yet the decay signature is clearly seen on several precipitation events. Somehow a 5 foot negative offset occurred in late September 2010.

In the shop...

It isn't likely that something in the stilling well is causing the dropout/offset behavior, although that has not been ruled out by any means. The stilling wells do need to be checked out.

The next long shot cause is the QD1 interface. Several of these units have been replaced, over the years. However, as it happens, they seem not to have been a problem. It appears they have been falsely accused.

So to try to get a handle on what was going on, the CR1000 datalogger, QD1 interface, and Handar 436 Incremental Encoder were brought back to the shop for testing. Low and behold the Handar 436 produced the following response,

Dropout Handar 436 test response

This is very strange.

The input wheel of the Handar 436 is slowly rotated back and forth. The oscillations are clearly seen, along with a slight random drift. The oscillation should be about three feet up, then three feet down. A full cycle takes about 3.5 hours. Each representative foot equates to a full rotation of the Handar 436 input wheel.

After about 3 days the slight random drift becomes a pronounced walk downward.

Somehow the data rapidly began a 3 foot walk downward, and seemed to be accelerating downward as well.

This rapid decline seemed reminiscent of the field data, so the test was stopped.

With this apparent common behavior suggested in the data, a root cause was sought.

Handar 436 output...

With this apparent common behavior suggested in the data, a root cause was sought.

The output of the QD1 interface, should generate something like the following,

Single pulse step Handar 436

The capture above shows a single direction pulse (red "A" marker on leading edge), which would be read by the datalogger. This pulse would increment/decrement the accumulated stage value by 0.01 feet. In this case it would decrement, since that is how the direction of rotation, and cabling worked out. For each falling edge pulse on the lower channel, there will be a decrement of 0.01 feet.

When the input wheel turns in the opposite direction the datalogger will increment the value by the same amount for each pulse received. In such a case the channel above the bottom channel will have the falling edge pulse.

The blue "B" marker on the right highlights the end of a 70 ms period.

This single pulse is the ideal waveform for an increment or decrement stage height change. Sadly it does not always work that way. The graphic below shows how a burst of pulses is often output,

Pulse burst from Handar 436

In this case there are a total of twelve falling edge events, within a roughly 70 ms period (same period shown before). Half occur in the increment channel, and half occur in the decrement channel. This type of pulse burst usually occurs after a single pulse pulse event, as the input wheel continues to slowly turn in the same direction. The pulse burst comes between 0.01 foot (hundredth of a turn) boundaries. Usually closely associated with a previous single pulse event.

Since the number of increment and decrement pulses balances, there is no net change in stage height. Pulse bursts of two or three have been seen. Pulse bursts of 30 have been seen. The burst events appear to occur at random. The burst duration seems to be below 100 ms.

This behavior suggests an instability that may or may not balance. It could be that, for whatever reason, the burst may be asymmetric and cause the stage height to rapidly walk downward.

Such heavily asymmetric bursts have not been demonstrated on the test jig but this burst behavior, hints that the Hall-Effect sensors in the the Handar 436 may be the source of the dropouts.

One would expect asymmetric pulse bursts should also occur in the upward direction. Such bursts have not been recorded but there has been anecdotal evidence of them in the test data. There is a random drift in some of the recored test data, clearly there is the expected upward asymmetry as well.

What the Handar 436 Incremental Encoder does.

The Handar 436 Incremental Encoder is a simple device. The internals are shown below.

Internal view of the Handar 436

In the photo, one of the side covers has been removed. The shaft runs horizontally across the photo with the input wheel on the right. There are two circuit boards bolted to the upper, and lower walls. Each circuit board has two Allegro Inc. A3132 Hall-Effect sensors mounted on it.

Highlight of the magnet Handar 436

In the photo above the magnet has been highlighted. The magnet is most likely an Alinco alloy "doughnut" or disk magnet (with a hole in the center). The magnet is about 76 mm (3 inches) in diameter, and about 8 mm (5/16 inch) wide. The poles of the magnet are on each face of the magnet disk.

The magnet is sandwiched between two iron alloy plates. Since the magnet poles are on either face of the disk, the teeth of the two metal plates define alternating N/S magnetic fields.

A gauss meter was not available at the time of this writing but the "screwdriver test" suggests that the magnet is still producing a reasonable mount of magnetic flux. The tip of a steel screwdriver seems to be drawn to the teeth poles with reasonable force. The suggestion being that there is enough field to cause the A3132 sensors to respond.

As the shaft rotates the fields between the teeth pass by the two Allegro Inc. A3132 Hall-Effect sensors on the circuit boards. Highlighted in the photo below. The number of teeth has been choses so that there are 100 sensor transitions per revolution.

Highlight of the location of the two PCBs in the Handar 436

Here's a photo of the lower circuit board.

Handar 436 PCB with showing the two A3132 Hall-Effect sensors

The two black rectangles are the A3132 Hall-Effect devices. These devices are obsolete, and Allegro has replaced them with the A1202.

This board has been reworked to include some capacitors. The capacitors are recommended in an Allegro Inc. application note. However, Handar did not include them in the original design. Note that the copyright date on the PCB is 1982. The larger sized tan capacitors are big because they are 400 volt rated. They were the only units of that capacitance I had on hand. Capacitors of lower voltage rating should be about the same size as the blue capacitors. Of coarse surface mount devices can be smaller still.

The spacing of the sensors on the PCB is such that one senor will change its state before the other, depending on which direction the magnet/shaft is turned. If the magnet spins in one direction the left sensor toggles first, then the right sensor toggles. If the magnet spins in the other direction the right sensor changes first, then the left. This is usually referred to as quadrature signaling.

Since the signals are in quadrature, the direction of rotation is known based on which signal acts first. The number of transitions per revolution is 100. The diameter of the wheel connected to the shaft is chosen such that one rotation equals one linear foot of distance at its circumference. In this way each sensor event equates to,

d_p = \frac{1 \ ft}{100}


d_p = 0.01 \ ft

Where $d_p$ is the equivalent distance per pulse.

Handar 436 generating simple quadrature signals
Figure 14.
Typical quadrature response.

Figure 14 is an example of quadrature signaling. In this case the Handar 436 is wired to a 5 volt power supply with pull-up resistors on its outputs.

The input wheel is then spun by hand. The oscilloscope (Tektronix TDS 210) is then allowed to capture a sequence of three pulses, as the Handar 436 input shaft spins down. Notice how the rising edge of channel 1 of the oscilloscope occurs before the rising edge of channel 2.

The square wave of channel one and channel two is made by the switching action of their respective A3132 Hall-Effect sensor. Each sensor is powered by 5 volts, and its output (open Collector) is pulled high by a 4.7 KΩ resistor.

As the poles (teeth) of the magnet wheel pass by the two sensors, they respond by turning their respective internal transistors on and off. If the transistor is off, the external resistor pulls the voltage high. If the transistor is on the Collector pulls the voltage low, since the internal transistor's Emitter is connected to ground internally to the A3132.

Handar 436 generating simple quadrature signals
Figure 15.
Typical quadrature response other rotational direction.

If the Handar 436's shaft is spun in the other direction, channel 2 now leads channel 1, as in figure 15.

The direction information is arbitrary in so much as the sense of direction can be swapped by simply swapping the output leads. While the sensors always respond the same way, when exposed to a North or South magnetic poll, how the quadrature signal is interpreted is dependent on which signal is "looked at" first.

To keep things conceptually simple, edge detection should begin when both signals are low. Direction sense will then be determined by which edge rises first, followed by the rising edge of the second, while the first is high. This strategy ensures an unambiguous set of detection criteria.


Although the previous example of signals in quadrature seems fairly obvious, with edges occurring in sequence. What happens if things don't happen on the order of 5 ms, as they did in figures 14, and 15?

What happens if there are seconds, minutes, hours or days between pulses?

It is entirely possible for the stage height of a V notch weir to stay at a particular level for days on end, and then drop by only one hundredth of a foot, where it again sits for a several more days. How can the Handar 436 deal with that sort of input?

The answer is that the Handar 436 can't cope with that. At least not without some help.

Some of the needed help is obvious, some of it is less so.

The obvious help comes in the form of the QD1 Interface. It provides two forms of help which makes the system's, and datalogger's job easier.

The less obvious help, not fully provided by the QD1, is a matter of stability. This issue, common to most all Hall-Effect sensors, isn't fully addressed in the operation of the QD1. It has to do with the indeterminate state of Hall-Effect switches when there is no magnetic field present or the fields cancel.

What the QD1 Interface does.

The idea of the quadrature output from the Handar 436 is fairly simple but using it can be tricky. This is where the QD1 Interface comes in.

In some ways, the use of the QD1 interface makes things a bit more complicated, in other ways it makes things simpler. The complexity is derived from the pulsed nature of the QD1. The simplicity is derived from the simple pulse counting allowed due to its outputs.

Typical QD1 output pulse
Figure 16.
Typical QD1 output pulse.

The QD1 does two jobs. One job is to determine which direction the Handar 436 is turning, and to generate the appropriate pulse for the datalogger to register. The other job is to reduce the power consumption of the Handar 436.

Rotational direction detection, and quantization

Whenever the Handar 436 generates a transition, the QD1 acknowledges this and sends out a single pulse in the appropriate output channel. The pulse is about 244 μs long (depending on the QD1 its clock runs at 4 KHz or so), and is an active low pulse, it transitions from +5V to ground. Such a transition is shown in figure 15. In the figure the scope has captured a QD1 output pulse, and the cursors indicate its length is about 244 μs.

The QD1 is supposed to keep track of which pulse fires first, and that determines which output port will be toggled for the datalogger to read. Every succeeding transition from the Handar 436 will then cause additional pulses on that QD1 output port, until the direction of rotation changes. At that point the other output port of the QD1 will begin pulsing accordingly.

All this signal processing in the QD1 dramatically reduces the amount of work the datalogger would otherwise have to do. With the QD1 in place, all the datalogger needs to do is look at two different ports, and increment/decrement accordingly. The datalogger does not need to figure out which went first, and when.

Reduced power consumption

The second job of the QD1 Interface is to reduce the power consumption of the overall system. It does this by turning the power off to the Handar 436, when no measurement is being made. The presumption is that if the power is turned on for a short time, often enough, no events will be missed, and there will be a substantial savings in power.

Since the stage height changes slowly, compared to the speed of electronic circuits, this is a safe bet. If the Nyquist sampling rate is presumed for the measured QD1 clock of 4.098 KHz,

\tau = 244 \mu s
f = \frac{1}{\tau}


f = 4.098 \ KHz

using Nyquist sampling,

f_{N} = \frac{f}{2}


f_{N} = 2.049 \ KHz

at 0.01 ft per pulse,

\Delta_{fps} = (0.01 \ ft)f_{N}


\Delta_{fps} = 20.49 \ fps

A change in stage height ($\Delta_{fps}$) of $20.49$ feet per second would be very fast indeed. In this case, so fast to be unrealistic.

The power savings is suggested by the duty cycle of the power pulses to the Handar 436. The power on time is 5.8 μs. The power off time is 244 μs. The duty cycle is,

D = \frac{5.8 \mu s}{244 \mu s}


D = 2.8 \%

If the Handar 436 were connected directly to 5 volt power, the duty cycle would be 100%. Using the QD1 Interface the Handar 436 is on only 2.8% of the time, so there is a substantial power savings.

Typical QD1 power duty cycle
Figure 17.
Typical QD1 power duty cycle.

Figure 17 is an illustration of how the duty cycle cuts down on consumed power.

The power on time is only about 5.8 μs. The relationship of this short on time is clearly seen given the overall period of 244 μs.

Figure 17 is an oscilloscope capture from the power pin of an unmodified Handar 436 PCB, being driven from a QD1 Interface unit. It exhibits relatively clean leading, and trailing edges. If a bypass capacitor is added to the power supply pin of a Hall-Effect device, as suggested by Allegro in application note AN27705, the trailing edge will have a significant exponential tail, at this time resolution (50 μs per division).

Regardless of bypass capacitors, the point is that a bunch of power can be saved without sacrificing any conceivable accuracy. It isn't likely that a stage height event will be missed by the system, even though it isn't on all the time.