be adjusted and should be able to handle 100V or more.
Note the two diodes D2 and D3 which clamp the
input to the first op-amp. This is necessary to avoid
over-stressing the high impedance input in case the op-amp
goes well outside its linear region.
The circuit does some simple capacitive integration
and then bleed-down between C1 and R1, followed by
a comparator that can detect when the total duration of
the shocks over some interval have exceeded some level.
We use op-amps for all of this. They make short work of
problems like this, though it could be done with transistors
Again, all of this is guesswork, so you may have to
make some adjustments.
QI have a sensor that goes LOW when triggered. I would like to have it go HIGH instead. What’s the simplest way to accomplish this? Randal Mahone
ASince we’re already on the topic of sensors, this makes a nice segue. You may have seen this technique used by me already. I find that the simplest way to invert a sensor signal — or any
other digital signal that doesn’t need to be very fast — is
to use a simple transistor. Bipolar transistors are naturally
inverting devices, as are FETs and tubes.
First, we’ll start with the trivial inverter shown in Figure
2. There is both an NPN and PNP version. This simply limits
the base current to the transistor and senses the collector
current with a resistor, providing the output voltage.
One thing to be aware of is that the amount of current
that can be delivered is asymmetric; the transistor can
source or sink much more than the resistor generally can.
You can reduce the value of the resistor on the collector to
increase that current, but the price is more wasted power
and generally slower turn-on times for the transistor.
We can speed this up slightly using the technique
shown in Figure 3. Here, we simply add a capacitor to the
base resistor to allow the sensor output to force current
/ charge into the base
and to pull it out quickly.
This can enhance
both the turn-on and
turn-off times by rapidly
changing the charge
state of the base-emitter
Even when the
transistor is in saturation
— as it is when the
input is high and the
output is low — pulling
the charge out rapidly will reduce the time to come out
of saturation. The value can be small (in this case, 100 pF)
since it doesn’t need to move that much charge to have a
Note that this still won’t be ideal. It’s the equivalent
of resistor-transistor logic or RTL, and so it asymmetrically
drives the output. It’s active in one direction but passive in
the other, so it relies on a resistor to return to one state.
Resistors don’t provide constant current like a transistor
can, so the resistor side will generally look like an exponential decay when driving some capacitance, instead of a
Exponentials asymptotically approach a value. Fortunately, most circuits detect the low condition at a voltage
higher or lower (depending on the direction) than the final
Training a Train
QThere’s a model train at our library that runs around the perimeter of the room near the ceiling in the Children’s Books area. It’s rarely ever running as the management doesn’t want it
to wear out. I’m wanting to build a timer or motion sensor
of some kind that will trigger the train to run when kids are
there. Can you help?
AThis project could easily be an entire construction article, and that would be a bit out of the scope for the Q&A, but I’ll try to give some suggestions.
While a timer might be okay for some situations, I
think that a motion sensor combined with a timer might
be the most comprehensive solution. To fully implement
this, I’d suggest using some type of embedded processor.
An Arduino would be perfectly adequate, but I’m guessing
that a Raspberry Pi would be even better.
Why am I recommending the Pi? Well, there’s an
easy to learn and powerful scripting language available
QUESTIONS and ANSWERS
Post comments on this article and find any associated files and/or downloads at
n FIGURE 2. NPN and PNP logic inverters.
n FIGURE 3. A faster version
of the NPN logic inverter.
J5 R4 J6
March 2018 11