Design Ideas
-- EDN, 3/4/1999
The pullup function also improves the rising edge of the transmitted data. If the sensor connects to the µC through a long wire, the capacitance of the line degrades the rising edge of the data signals, because of the line-capacitance-R4 time constant. The short pulse from the pullup circuit improves the signal's rising edge. It's obvious that, when the pullup circuit turns on, Q3 must be off. However, the circuit protects itself against unintended signal corruption. If Q3 is open, the power voltage does not connect to the sensor's data line. If you replace R4 with a 1-mA current source, you can obtain effective data transmission with lengths as great as 500m (empirically verified). (DI #2317).
Dual one-shot makes rising- and falling-edge detector
Santo Camonita, Catania, Italy
The design in Figure 1 is an upgraded version
of the circuit in a previous Design Idea (" Edge detector runs off single
supply ," EDN, Dec 4, 1997, pg 140). It has fewer components, draws less current, and has higher input impedance. The circuit uses a 4098 dual monostable multivibrator with both sections connected. The circuit generates a pulse on both the rising and the falling edges of a signal. The duration of the output pulse is T=0.5R2C2. R1 and C1 provide power-on reset. The circuit has another advantage: It provides two independent true outputs (Q1, Pin 6 and Q2, Pin 10) and two independent complementary outputs (
, Pin 7 and
,
Pin 9). (DI #2316).
Simple circuit measures diesel's rotations per minute
David Magliocco, CDPI, Scientrier, France
You may find it useful to measure a diesel engine's rotations per minute to accurately adjust the idling or to compare the motor's speed under hot and cold conditions, for example. Not all cars or trucks come with a tachometer. The scheme in Figures 1 and 2 allows you to measure rotations per minute with a DMM or an oscilloscope. In Figure 1 , a piezoelectric sensor and an alligator clip, fastened directly to one of the four metal fuel pipes, detect the fuel-injection pulses. The piezo element generates a signal that connects to the signal-conditioning electronics in Figure 2 through a coaxial cable. The circuit uses a charge amplifier.
IC1, a versatile ICL7611 chosen for its high input impedance, low bias current, and reasonable power consumption, acts as an inverting current-to-voltage converter. C1 integrates the high-dV/dt sensor signal. R1 ensures that the output of IC2 is high in the absence of a signal. You must use high values for R2, R3, and R4. The two diodes at the input protect the amplifier against overvoltage spikes. R5 and R6 create a virtual ground, so the circuit uses the full common-mode input range of IC1. Figure 3 shows an oscilloscope trace of the amplifier's output. The three small peaks between the main pulses are parasitic and come from the injection pulses of the other cylinders. You can fine-tune the shape of the signal with C1. A value near 1 nF yields a smooth signal with low amplitude; a value lower than 100 pF gives a noisy signal with narrow pulses. The value for the trace in Figure 3 is 100 pF.
From one vehicle to another, the amplitude of the signal can vary over an approximately 2-to-1 ratio. You can't use a fixed threshold to shape the signal; either the threshold is too low, and you shape the parasitic pulses, or it's too high, and you obtain nothing. Thus, the signal-conditioning method compares the peak value to the average value: Only the main peaks are higher than the average value. C2 and R7 ignore the dc component of the charge amplifier's output signal, and transistors Q1 and Q2 charge C3 to the peak value of that signal. You adjust R8 and R9 for a 90% ratio, which gives IC2, a low-power CMOS comparator, a large enough signal to shape. IC2 delivers a logiclike signal that you can measure with a DMM (using the frequency/period range, or the rotations-per-minute range on an automotive DMM), or with an oscilloscope. (DI #2318).
Fast, compact routine interfaces EEPROM to µC
Grzegorz Mazur, Institute of Computer Science, Nowowiejska, Poland
The code in Listing 1 provides the interface between any MCS-51 family of µCs and a 24C01a/2/4/8/16 I2C EEPROM. The interface is purely software-driven, so any µC port pins can control the EEPROM. This code is approximately two times smaller and approximately 20% faster than similar routines published by Atmel Corp ( www.atmel.com). Careful coding of low-level routines and structural optimization produce the performance improvements.
The code is tuned for a -51 running at 12 MHz, but you can also use it at lower clock speeds. For higher speeds, you must adjust low-level routines by inserting "nop" instructions to match I2C-specified timings. The maximum data rate while reading memory content as 16-byte blocks is as high as 8.1 kbytes/sec. With minor modifications, you can use the routines to interface any I2C slave device to a -51 µC (DI #2329).
Photodetector sorts objects
Alan Erzinger, Harris Semiconductor, Palm Bay, FL
Most object-sensing systemshave problems detecting the presence of an object. The system in Figure 1 uses an oscillator to ease detection problems and allow sorting. The oscillator reduces power dissipation in the photodiode by operating the diode at 50% duty cycle. The oscillator also enables a 50% increase in the noise-filter time constant, and it functions as a timebase to allow object sorting. The oscillator chops the photodiode's bias. The signal the photodetector receives is a square wave; thus, a filter can remove optical noise. You normally need filtering when light shines through fans onto the optical detector. When required, you can place a bandpass filter in series with Q3's output.
The oscillator frequency has two limits: the response time of the phototransistor and the accuracy of the object-sensing system. Q4 and Q3 are connected in a cascode configuration to minimize the Miller effect in Q4. This connection reduces the pair's optical transient response to nanoseconds, thus allowing oscillator periods of submicroseconds. Objects on a conveyor belt travel at relatively low speeds. You can calculate their expected time in front of the photodetector, t, from t=d/s, where s is the conveyor speed in feet per second and d is the object width in feet.< /FONT>
An object 2 in. long with a belt speed of 3.5 ft/sec blocks the detector for 47.6 msec. If the oscillator period is 250 µsec, the object blocks the detector for approximately 200 periods, so each period equates to 0.5% length accuracy. The system senses two objects—one 2 in. long and one much longer—so 0.5% accuracy is more than adequate. When the detector is unblocked, the inverting input of IC1 is dominant, and it keeps the output of IC1 low. The low state prevents the oscillator's output from reaching the counter (IC3). Blocking the detector allows C3 to charge to 5V through R6, and the noninverting input of IC1 becomes dominant, starting the count. When the detector is unblocked, the one-shot comprising R11, C5, and IC4A pulses IC2B with an end-of-object pulse. The one-shot's trailing edge triggers the counter-reset one-shot comprising R12, C6, and IC4C.
C4 and R6 form a nuisance filter that rejects short optical noise. The timing is such to enable a 2-in. object to clear the detector while both Q6 and Q7 are high. When the end-of-object pulse coincides with Q6 high, Q7 high, and Q8 low, the output of IC2B indicates a 2-in. object. This situation is the only time window that can indicate a 2-in. object. If the object is longer than 2 in., Q8 goes high, indicating a large object. When the object clears the detector, the reset one-shot resets the counter for another cycle, and Q3 quickly discharges C4 in preparation for another cycle. With the component values shown, the system can sense and discriminate between objects as short as 2 in., separated by 0.1 in. (DI #2325).
Single-button lock provides high security
Maxwell Strange, Fulton, MD
Figure 1 is the block diagram of an easily programmed, single-button combination lock. You operate the lock by using a series of short and long pulses from a momentary switch that masquerades as a doorbell button. The circuit uses inexpensive CMOS logic. The retriggerable timer, T1, locks out entries made after the T1 code-entry window, thereby greatly enhancing security. The circuit in Figure 2 operates as follows: The Schmitt-trigger quad NAND gate, IC1, debounces the code-entry switch and, with the aid of simple analog circuitry, produces separate outputs for activation times of less than and more than 0.3 sec. These outputs connect to the select gate, IC5. The initial entry also sets timer T1 to enable the decoded decade counter, IC3. Each entry clocks IC3.
As IC3 steps through its counts, certain of its output positions represent "short" and connect to IC4's inputs; unconnected lines represent "long" positions. This coding arrangement sets the combination. Short pulse positions change the address of IC5 to select the short input pulse; otherwise, IC5 selects the long pulse input. The short and long inputs, if present in the programmed sequence, produce an output from IC5. IC6 counts the outputs and produces an unlock command only if it counts all pulses. The power-on-reset circuit ensures that no compromise of security arises under any conditions after a power outage. The timers are crucial to the high security of the system. You must enter the code within the 8-sec T1 window. If you make a mistake, you must wait at least 10 sec for T1 to time out before you make another attempt. If entries occur continuously and less than 10 sec apart, as an intruder might try, T1 continuously inhibits counter IC6.
The lock proves to be reliable over several years of use. The circuit in Figure 2 uses an eight-character combination, which you can quickly enter. A short pulse is a quick jab to the button; a long pulse is only slightly longer. A shorter sequence would also be secure; you can implement a shorter code by simply taking the unlock pulse from a lower count on IC6. IC6's output returns low after 10 sec when T1 resets. If desired, you can generate a lock command, which need not be secure, by adding the simple circuit in Figure 3 . (DI #2327).
















