The vast majority of electronic circuits are designed to do a job in response to a real world need, and as such, they need to acquire some form of information from the real world. In the industry, this is the realm of the instrumentation technician.
In this month’s Fundamentals we are taking a look at some basic but less common input circuits, and also in The Classroom this month, we explore transistors and what they do. Many of the circuits here are basically transistor amplifiers with different sensors attached. Many sensors give outputs too low to use effectively, so the amplifiers increase the signal strength to logic levels that computers such as the Arduino and Raspberry PI, as well as non-programmable circuits, can use. So, let’s get into it!
Most circuits consist of inputs, where information to make the circuit work is gathered from the outside world; processes within the circuit, where the information is amplified or modified in some way to make measurement easier; and output circuits, which may be an electronic signal for another circuit such as a computer, or a physical action such as controlling a light, motor, or other output transducer.
A transducer is a device that converts one form of energy into another form. For example a microphone and a speaker are used to convert audio into an electrical signal so it can be amplified, and then fed back into audio so we can hear the result.
Instrumentation is all about transducers, their use and calibration so the signals can be used to measure a physical value. The simplest transducer is probably the most commonly used one, and because it is so common we forget why we use it! That transducer is the humble resistor. The resistor allows current to flow through it when a voltage is applied, and therefore the current flowing through a resistor is proportional to the voltage applied across it. The converse is also true, in that a current flowing through a resistor causes a voltage drop, or potential difference, to appear across the resistor.
If you want a simple ammeter, place a 1 Ohm resistor in series with the device through which you want to know the current. Due to Ohm’s Law, the voltage across the resistor will be V = IR, and as R = 1 Ohm, V = I; the voltage is equal to the current.
Touch Sensor
While many of us are familiar with small push button switches as inputs to a circuit, there are situations where a physical switch is either unsuitable or simply not novel enough. One such application is in bedside lamps, where the metal frame is used as the sensor, allowing a sleepy fumble that contacts the lamp body anywhere to become the switch. As some internet videos have recently shown, even household pets are able to use these to wake their masters at feeding time.
For reasons far too detailed to describe outside a medical text, all human bodies run on tiny electric signals. In a modern world saturated with electrical signals including the power supply, we also have in our body, an induction current from our surroundings; mostly originating from the electric fields around us in power distribution networks, but also from the many radio transmitters in use.
Modern homes contain a high proportion of artificial materials, which readily create electro-static charge — an enemy to electronics. Just walking across a polyester carpet or vinyl floor can generate tens of thousands of volts in your body. Remember this when handling your precious electronic devices!
There is almost nowhere to escape this electro-magnetic and electro-static pollution, except in the middle of nowhere, or in a Faraday cage. This tiny induction does however, provide a very small potential difference, or electro-static current, that can be used to activate a transistor.
As we can see in the schematic [1], the base of the first transistor, Q1, is not connected to any biasing voltage divider network, but rather one resistor to help ground high static voltages. The 1 MegOhm resistor, R3, reduces sensitivity but is usually large enough to go unnoticed by the circuit. However, if your circuit fails, you may need to increase R4 to 10M. During testing, we had this working without any resistor, but we were only driving an LED.
The circuit works because the induced electro-static voltage in the human body is actually quite high, but at a low enough current that we normally don’t feel a thing. In hot dry weather, you may experience a tingling in your fingers when you touch something metallic, or even see or hear a spark jumping from your body to the grounded metal.
There is normally more than enough voltage to overcome the barrier voltage of the base-emitter junction. The VR1 allows the sensitivity to be controlled, and for individual transistor tolerances to be accommodated. Normally, in breadboarding the circuit, VR1 can be a fixed resistor, as they are easily changed, but if your application requires it, R1 may be substituted with a trim pot; perhaps 100k to 1M.
Why THREE Transistors?
Note that there are three transistors used here. They are identical but the output of one drives the base of the next. Both have an amplification of about 100 in a small signal circuit, so the combined gain, potentially, is 100 x 100 = 10,000.
Note: Gain changes with conditions so should be taken off the datasheet “Loadline” curves.
The current in Q2 can be reduced if you are not using an LED, by moving R1 to the collector side.
An alternate system [2] uses a LM555 IC as the switch circuit. It's a very different approach to achieve a similar result. The 555 has two voltage comparators, a couple of constant current drives, and a driving transistor all inside, with more as well, hence the result is one of the most versatile ICs ever created. However, while building a circuit based on the ‘555 [2] may be easier, it is also a bit less satisfying as you will do less of the work yourself, and have a lesser understanding of what is inside the black box. We covered the basics of 555 in Issue 1's edition of Fundamentals.
A teaser is that the ‘555 can handle de-bounce and minimum pulse duration, set by the values of R6 and C2, currently making a pulse of about 0.7 seconds on, 0.1 off.
The ‘555 can even provide a series of pulses, similar to holding the space bar down on your text editor. To tell you how without explaining why, would be a failure on my part! So here we go:
Instead of a static touch pad, we can use a resistive touch pad [3], which is actually two closely placed electrodes. The person’s finger, usually, touches the two electrodes, bridging them with finger resistance, or galvanic skin resistance to be more precise. The skin acts as an insulator, although most of us can testify it is not a very good insulator. Poor insulators are also known as “resistors”!
So this exploits the human body’s rather poor, but adequate, ability to conduct a current. Remember it’s the skin with the highest resistance; inside we are all just a bag of salty water! So whether I place my finger on my multimeter probes one millimetre or one centimetre apart, I get a reading of about 10 to 12 MegOhm. That’s because the circuit, or my part of it, is two layers of skin either side of a salty mass. The salty mass has a very low resistance, but my skin has a resistance of about 5 MegOhm per layer, when dry.
We can also use a piezo as an input transducer [4]. A piezo is a tiny sliver of quartz crystal between two thin metal plates. As with many transducers, the transduction might be a two-way process. When a voltage is applied across the plates, the crystal is bent, but bending the plates generates a voltage.
Piezo microphones transduce air pressure into a voltage, and a voltage also causes a piezo to distort. An alternating voltage at an audio frequency can cause a piezo speaker to make a sound, due to causing a series of changes in air pressure.
The circuit [4] uses the piezo as a pressure sensor. If the piezo is clamped to a part of a frame that bends, the bending can cause a signal to be generated in the piezo. The piezo is used as a knock detector in modern computerised engines. They are also used in security devices.
The piezo can sense vibrations, and so can be used as a window shock sensor for an alarm, or even, with a bit of thought and careful mounting, as a basic seismograph. The options are really only limited by your imagination!
However, these applications require more sophisticated amplification than the transistor amplifier presented here. Our circuit is suitable more as an impact sensor than a seismograph! (But watch this space!)
The remaining diagrams relate to [3], although they use alternative transducers as examples of what you can do with transducers. For example, in many ways a diode can be a transducer. The diode can make light, as LEDs can attest; receive light as photodiodes attest; detect temperature; convert radio signals into a DC voltage; convert voltage into capacitance; and many other applications not normally of interest to makers.
If the contacts [3] are replaced with two electrodes, preferably stainless steel or other non-corrosive metals [5], then the electrodes can be used as a sensor for rain, water levels, or other liquids. For example, you could use the electrodes to sense rainfall and then control a motorised flush valve leading to a water tank, letting the first few minutes flow out carrying debris away, before diverting to the tank.
Alternatively, the contacts can be arranged [6] to form a soil moisture sensor. This can be plugged into the garden or pot plant soil, and used to feed information into a garden watering system, ensuring that only dry areas are watered. This saves both water, and energy if you have to use a pump for your watering system. Your pot plant could be “programmed” to say “Please Sir, I need a glass of water!”
The sensitivity of the device can be set by adjusting the trim pot [3], or by replacing it with a fixed value resistor, if you prefer. The rain sensor, for example, may need less sensitivity than the soil sensor, depending on the mineral salt content and pH of the soil, as well as the amount of dissolved gasses in the rain.
To test any of these circuits, where an output is given that goes nowhere (intended to go to a logic circuit), connect an LED and a 270 Ohm resistor to ground. In the case of using these as a logic input, the circuit grounds through the input.
Modern practice is to use integrated circuits (ICs) for many instrumentation applications, resulting in specialised instrument amplifiers, and mathematical amplifiers that can integrate or differentiate a signal, or provide a square root of the original signal. While all of these are specialised ICs, the basis of all of them is the operational amplifier, which is a subject for a future edition of DIYODE.
WARNING: Be careful what you feed your micro. They are sensitive to being overfed with voltage spikes! Some of the circuits in this edition of Fundamentals work on static charge.