# More Gizmos

## Introduction

This page is a continuation of the Gizmos page; a collection of simple electronics ideas.

## Diodes

There is a lot to this subject but in brief: Diodes allow current to pass in one direction but not in the other at the cost of their own "activation energy" which corresponds typically to a voltage drop across them of about 0.7 volts.

Diodes also have a very small leakage current of perhaps microamps to a milliamp in higher voltage/current applications. So in short they are not "free" gateways but they can be very useful in circuits where simple gates are useful.

## LEDs

An LED is a diode, a device driven by current. Hence the question "How much voltage does an LED take?" isn't really the proper question. The right question is "How much current does the LED draw?" This question leads to a resistor value and the LED can be driven off of any voltage provided it is reasonably well above 0.7 volts. A 1.5V battery can drive an LED as well as a 12 volt battery, the only difference will be in the resistor used in series with the LED to limit the current it draws.

LEDs "of old" typically drew 20mA of current. Now they might draw 10 or 4 mA; just need to look at the specs. Furthermore across the LED the voltage drop can be taken as 0.7 volts. The LED circuit looks like this then:

                           LED
+V---(Resistor R ohms)-----|>|-----Ground


The voltage drop across the resistor will be (V-0.7) volts. The current we want is 20mA. Therefore R = (V-0.7) / 0.020 ohms. It's that easy. The resistor for a single 1.5V battery would be 40 ohms. The resistor for a 12V battery would be 600 ohms. If the LED is looking too bright (or burns out) maybe it would be a good idea to use a bigger resistor to further limit the current.

Finally it doesn't matter what side of the LED the resistor sits on but the direction of current flow does. The Ground or negative side of the LED is usually cut flat on the case and the lead on that side will be slightly shorter. If the LED doesn't light perhaps it is connected backwards.

Notice that a 100 amp-hour car battery will drive an LED for 208 days, which is a pitiful waste of energy when you don't have much to spare. But you might really really need to see some sign that a circuit is actually working. To the rescue: There is a really cheap part that will flash an LED once every few seconds--I read about this in a musician's electronics book--reducing the energy consumption. The LED can do its job flashing for 1/20th of a second every 5 seconds so that's a factor of 100 at least.

In the event that there is no easy way to install a flasher, there is nothing wrong with cutting one of the LED leads. These devices use up a lot of energy and nobody cares if they are flashing happily away inside some box in the Sahara desert.

## Digitizer Board from the Harvard Volcano Project

This is a nifty 3+1 channel digitizer that is released as Open Hardware and I need to put in a bunch more notes on it. There will be room in the 3.2 case for two additional boards, for example this one or the standard SymRes board I've used in the past for high frequency seismics. So we will have to look into flexible accommodation size. The PC/104 form factor is nice in the sense that the ISA bus also provides considerable mechanical support but not every board conforms.

## Digitizer Board as announced in Embedded Technology November 2006

Bittware (Concord NH) has released the Tetra PMC+ with 4 wideband 14 bit ADs running at up to 105MHz. That's high enough for just about any bat. Anyway the signals go into an FPGA and there are a bunch of DSP tools available as well as an adjunct board; see http://info.hotims.com/10956-415.

## Voltage Divider

Suppose you'd like to monitor a voltage like V-supply using a device designed for this purpose. Suppose however that this device has a working range of zero to five volts but the voltage you want to measure is between 11 and 16 volts. What to do?

The circuit shown above uses high-value resistors R-1 and R-2 in series between the V-supply and the ground to create an intermediate voltage suitable to the measuring device range. Shown is a comparator that produces a digital 1/0 output if the compare voltage is above or below a reference voltage. One could also put V-compare into an ADC (analog-to-digital converter) to measure the V-supply voltage more accurately.

We have, assuming practically all the current goes through the resistors:

Vsupply = VR1 + VR2

IR1 = IR2

$V_{R1}=I\cdot R_{1}$

$V_{R2}=I\cdot R_{2}$

Rtotal = R1 + R2

$V_{R2}=\frac{R_{2}}{R_{1}+R_{2}}\cdot V_{supply}$

In the Microserver PCS board we have both a Vfail and a Vwarn circuit with independent voltage dividers checking the same supply (which is slightly less than the external supply due to losses through the charge controller and the U16 part.) These circuits provide a 1 or 0 depending on whether the true voltage supply is above or below respectively fail and warning voltage thresholds. In this way the Microserver can anticipate when it is running out of power.

V-ref is 2.5V and the four resistor values are R-1fail="R51+R46": 101kohms, R-2fail=R47: 28.7kohms, R-1warn="R40": 110kohms, R-2warn="Rf1": 29.4kohms.

Notice that for a fixed V-supply, say 12 volts, we want the voltage to be lower at the comparator in the Vwarn circuit because this will trip the low-voltage condition (comparator = 0) before the other Vfail circuit does. To see how this is so, imagine slowly lowering the V-supply voltage. Both comparator circuits start out 1 but since the Vwarn circuit produces a lower value for V-R2 at the comparator, it will trip first. For this reason the ratio R-2/(R-1 + R-2) is smaller for the Vwarn circuit, about .211 for Vwarn compared to .221 for Vfail.

## Pull-down/Pull-up resistors

There are many ways to think about these circuit components. A pull-down resistor connects a part of a circuit to ground and therefore draws current any time there is a voltage present. Pull-ups do likewise but their 'distal' end connects to some voltage rail rather than ground. Current is of course voltage divided by resistance so a 5V bias and 10k-ohm pullup will draw 50 microamps.

This still begs the question of what a pull-down resistor accomplishes. If you ask an RF engineer he will provide you with an enigmatic smile...

...and start talking about resistors in a very non-intuitive way. You may become puzzled but if you persevere you will be able to vaguely translate his wisdom like this:

A brief example of the utility of a pulldown: Suppose you have a PMOS MOSFET, an electronic switch, and that it has three leads or pins called Source, Gate, and Drain. Placing a voltage on the Gate pin will lower the barrier and short Source to Drain (so now Drain is a voltage/current supply).

Connect Drain to a capacitor and turn the MOSFET "on"; the capacitor quickly fills up with charge to match the applied voltage. Some time later drop the Gate voltage to zero (telling the MOSFET to stop feeding the Drain). Some time constant associated with the MOSFET will eventually "get the point across" but it does not necessarily respond instantaneously; the capacitor will maintain its voltage on the Drain side perhaps long after the Gate pin has grounded.

Now add the pull-down resistor to the capacitor side and it comes to the rescue: Connect it from Drain to Ground and go through the same procedure. The capacitor drains quickly through the resistor and the MOSFET is shut off rapidly. The resistor behaves like a weak spring on a gate, pulling it closed when nobody is around. The trick is to set it up so that it doesn't draw much power from the circuit during normal operation (thereby making the circuit more power-consuming).

There is more to this but that's at least a brief conceptual introduction.

## Aberrant Behavior of Motes

A mote may fail to turn on when connected to batteries, particularly when reverse-biased in advance (by mistake). Two things to check prior to panic:

• Torque on the batteries to ensure they are making good contact with their clips (and check the voltage at the mote power in terminals).
• It may even be necessary to ground the Gd terminal. I accidentally reversed the batteries and suspect I may have left a screwy voltage bias on a capacitor or something; I grounded Gd with a probe and suddenly the Mote started up.

## Jumpers and Zero Ohm Resistors

There are places on circuit boards that may or may not be connected, and two levels of permanence associated with the "jumper" in question. First if it is anticipated that a User might configure the circuit one way or another, two header pins are in place and jumpered with a little plastic connector with metal inside. This is the most common jumper implementation as far as us Users are concerned.

Second is the Zero Ohm Resistor which exactly as it sounds is really a piece of wire soldered across two contact points. They use these in manufacture because the pick-and-place robot can deal with resistors but gets a headache trying to think about wires. Which come to think of it I do too. Zero Ohm Resistor jumpers are moved or removed usually with two fine-tip soldering irons (one on each end) and a microscope; they are generally quite tiny.