Sensors that detect and track small metallic objects are handy gadgets, whether used to route workpieces on an assembly line or comb a beach for “treasures” lost in the sand. A typical sensor design consists of an inductor integrated into an oscillator, so that entry of metal into the magnetic field of the inductor changes the frequency of oscillation. Figure 1 shows a particularly simple and cheap example that produces a ~100 kHz variable frequency pulse train suitable for direct input to the internal counter/timer peripherals of typical MCUs.
Figure 1. | Cross-couple flip-flop outputs with a choke to make an oscillator with period proportional to inductance and thus a simple sensor of metallic objects. |
Here’s how it works.
Q1, Q2, and associated Rs comprise an elementary set/reset bistable multivibrator (flip-flop) that, for as long as power is provided, would normally settle into, and hold one of two stable and mutually exclusive states: Q1 ON and Q2 OFF, or vice-versa. But things get more interesting (and less stable) when inductor L is added between the transistor collectors as shown.
Now, due to the voltage difference between the collector of the OFF transistor (at ~2.5 V) and that of the ON transistor (at ~0 V) and, assuming choke series resistance << Rn (n = 1, 2, 3, or 4), current starts ramping up through L with a time-constant of L/(R/2). This ramps down the voltage at the OFF transistor’s collector and thereby the current supplied to the base of the ON transistor. Eventually the base current drops too low for the current gain of the transistor to hold it in saturation, allowing it to turn OFF.
Whereupon the choke current (IL) drives the collector of this transistor to 5 V, and switches the opposite transistor ON, causing IL to begin to reverse and a new half-cycle of oscillation to begin, each half-cycle having a period of:
R = Rn n = 1, 2, 3, or 4; L = choke inductance, and
hFE = transistor current gain.
Thus,
Typical hFE for the 2N3904 is ~150, therefore Loge(hFE) ~ 5, and
Figure 2 and Figure 3 show in better detail where the timing relationships come from. Using the Figure 1 resistor and inductor values,
Of course, actual 2N3904 hFE is both device and temperature dependent, and real chokes have significant series resistance, parasitic capacitance, and are seldom precision components to begin with. So, the frequency expression above is somewhat approximate, but is nevertheless accurate enough to not interfere with the intended application.
Figure 2. | Inductor current wave shape during one ~5 µs oscillation half-cycle. |
Power consumption from 5 V is moderate at ~50 mW, and the circuit is extremely tolerant of supply voltage, functioning from <1 V to >10 V, provided that the fact that the output amplitude is supply-dependent is acceptable.
Figure 3. | Oscillator waveforms: IL and Q1, Q2 output signals. |