NEW ZEALAND TARANAKI

# ## DIY sensors from voltage dividers

 Introduction: Voltage dividers and a very useful equation Touch sensor: Pull-up and pull-down switches Light sensor: Light and dark sensors Heat sensor: Temperature sensors Noise sensor: Sound sensors Resistors: Resistance Chart (colour codes) Capacitors: Capacitor table

### Why are voltage dividers useful?

Electronic circuits are often built up of smaller subsystems that carry out a particular function. A complex circuit may be made up of an INPUT stage, a PROCESSING stage, and an OUTPUT stage, each of these communicate by sending signals as changing voltages. A sensor subsystem can use a voltage divider to create an appropriate voltage signal for processing (in our case, by the PICAXE-08 chip).

What are voltage dividers?

Most High School students learn about series and parallel circuits. A common use of resistors in series is to divide voltages into different values from a fixed source of voltage. This means resistors connected in series are an ideal means for a sensor to create an appropriate output voltage signal.

If two resistors are used, the voltage applied across the resistors is divided into two parts that depend on the resistor values used. Lets look at an example circuit: Our voltage divider above has two resistors, across which a voltage is applied, with the output being taken from the junction of the resistors. The voltage out to the load is less than the input voltage. The output voltage depends on the ratio of R1 to R2. If R2 is small compared to R1 then the output voltage is small. As the value of R2 increases, so does the output voltage.

 It may be helpful to remember that R2 appears on the top line of the formula because Vout is measured across R2 . The BIGGEST change in Vout from a voltage divider is obtained when R2 and R1 are EQUAL in value.

BEFORE WE START - NEED HELP SETTING UP YOUR PICAXE? A 2xAA battery box with switch is a safe and tidy way to ensure that the batteries cannot be connected the wrong way around in a circuit. We are prototyping on Wishboard then use Veroboard (& 8-pin IC sockets) for finished circuits. Holes marked 1,2 and 3 (directly above link wire and below the 10k resistor) are where the programming lead is plugged in when neccessary. Now lets add some sensors!

### Signals from switches / touch sensors

What happens if one of the resistors in the voltage divider is replaced by a switch? The switch can be used to provide a voltage signal to our PICAXE which can trigger it into action.

The circuit can be built in either of two ways: This circuit delivers a HIGH voltage when the switch is pressed. A resistor value of 10kW is often used.The pull down resistor forces Vout to otherwise become LOW. On our Wishboard circuit 3V means connect to the +ve rail and 0V means connect to the -ve rail. This second circuit delivers a LOW voltage when the switch is pressed. On our Wishboard circuit 3V means connect to the +ve rail and 0V means connect to the -ve rail.

In circuits which process logic signals, a LOW voltage is called 'logic 0' or just '0', while a HIGH voltage is called 'logic1' or '1'. These voltage divider circuits are perfect for providing input signals for logic systems.

We used this system in The Bike Indicator Science Fair project.

Apart from normal toggle switches or push button switches, another variety of push button switch is called a miniature tactile switch. You could experiment with magnetically-operated reed switches, tilt switches and pressure pads, all useful in alarm applications.

Mighty Mouse could use this system to provide a sense of touch via wire whiskers acting as contact switches.

Andrew Hornblow suggests using a 5 Mohm resistor as the pull up resistor and replace the switch with direct human interaction via skin resistance. If you use the ADC pin 1 you might be able to fashion a Lie Detector circuit!

### A light sensor as part of a voltage divider.

 This is a light dependent resistor, or LDR A LDR is a special type of resistor. The light-sensitive part of the LDR is a wavy track of cadmium sulphide. As more light falls onto the track, the resistance decreases...

What happens if one of the resistors in the voltage divider is replaced by an LDR? Again, like the switches above, it can be used to provide a voltage signal to our PICAXE which can trigger it into action.

The circuit can be built in either of two ways: A sensor subsystem which functions like this could be thought of as a 'dark sensor' and could be used to control lighting circuits which are switched on automatically in the evening. On our Wishboard circuit 3V means connect to the +ve rail and 0V means connect to the -ve rail. This circuit delivers a HIGH voltage when the light is present. A resistor value of 10kW is often used. On our Wishboard circuit 3V means connect to the +ve rail and 0V means connect to the -ve rail.

Sometimes there is too much light creating a "false" signal. An alternative is to use a Infra-red Phototransistor. We used this system in our Science Fair Laser Wars! combat game. The transistor is sensitive to infra-red so can be more useful in areas that are brightly lit. TV remote controls use IR LED's to trigger a phototransistor in the TV. "Normal" daylight does not cause a "false" alarm since our sensor reacts to "invisible" IR light.

Mighty Mouse uses LDR's to either run away from light or move toward light. You can even get him/her to follow a line drawn on the floor or desk!

Using digital multimeters as data loggers in science and maths

### Temperature sensors

A temperature-sensitive resistor is called a thermistor. There are several different types.  The resistance of most common types of thermistor decreases as the temperature rises. They are called negative temperature coefficient, or NTC, thermistors. The Black Box! data logger uses this type of thermistor. The -t° next to the circuit symbol tells us that as the temperature rises the resistance falls.

It is possible to manufacture positive temperature coefficient, or ptc, thermistors. These are made of different materials and show an increase in resistance with temperature.

• How could you make a sensor circuit for use in a fire alarm? You want a circuit which will deliver a HIGH voltage when hot conditions are detected.
• Which type of circuit will you make? Check the previous switch and light sensor circuits above...figure this one out for yourself!

Lots of different types of thermistor are manufactured, each has its own characteristic pattern of resistance change with temperature.

Suppliers catalogues usually give the resistance at 25°C, which was 100 kOhm in the case of the Black Box! data logger.

Usually, catalogues also specify a 'Beta' or 'B-value'. When these two numbers are specified, it is possible to calculate an approximate value for the resistance of the thermistor at any particular temperature from the equation: Where:

• RT is the resistance at temperature T in Kelvin (= °C +273)
• RT0 is the resistance at a reference temperature T0 in Kelvin. When the reference temperature is 25°C, T0 = 25+273.
• e is the natural logarithm base, raised to the power in this equation.
• B is the B-value specified for this thermistor.

Using a spreadsheet it is possible to to generate characteristic curves for any thermistor by calculating resistance values for a range of temperatures. You can apply this equation to make sure that the voltage dividers you build will always be as sensitive as possible within an useful range of temperatures.

We used this system in our Black Box! data logger.

Using digital multimeters as data loggers in science and maths

### Sound sensors

Another name for a sound sensor is a microphone. The diagram shows a cermet microphone: To make them work properly, cermet microphones need a voltage, usually around 1.5 V across them.

An alternative is to use a peizo speaker element as a sound detector. A suitable darlington transistor amplifier can be added so a PICAXE chip can detect sounds such as a hand clap.

We used such a sound sensor in The Professors electronic ear - a classroom noise level alarm; a must for all teachers!

### Resistance Chart

Resistors are too small to print resistance values on. Instead, a standard colour code is used. The resistor above has four bands; two represent the first and second digit of the resistor value, the next band is the multiplier and the last band represents the tolerance. Some resistors have five bands. Using digital multimeters as data loggers in science and maths

### Capacitor Table

Capacitors may be marked to show their capacitance value, voltage rating and polarity, however, the value and voltage rating identification can be difficult because of the variety of systems in use.

Units: The unit of capacitance is the Farad, but this unit is extremely large. In practice smaller units are used such as the microfarad (abbreviated µF), nanofarad (nF) and picofarad (pF). Some capacitance values are commonly expressed by only one unit while others can be under two or more units, e.g. 0.0047 is often written as 4.7nF or 4700pF.

Values: Larger capacitors are marked in microfarads and indicate this by the abbreviations 'µF', 'µ' or even the obsolete 'MFD'. Smaller capacitors are marked in nanofarads or picofarads and may abbreviate the unit to 'n' or 'p'. If the value contains a decimal point the 'µ','n' or 'p' is sometimes put in place of the decimal point. Therefore a 4.7pF capacitor can be marked as 4p7. If no unit is given, a judgement, based on the capacitor's physical size, must be made to determine which unit is intended. For example, a small ceramic capacitor marked '4.7' is probably 4.7 pF, whereas a large plastic capacitor marked '4.7' is more likely to be 4.7µF. If the value is in nF then this is always written.

Another marking system uses 3 numeric digits to indicate the value in picofarads. The first two digits represent the first two digits of the value and the third digit is the multiplier or number of zeroes. For example, a capacitor marked 104, such as those used for noise suppressionon Mighty Mouse, would be read as 1, 0, 0000. This would be formatted as 100,000 pF and would commonly be known as 100nF or 0.1µF. Likewise a capacitor marked 472 would be 4700pF, also known as 4.7 nF.

Some common values and their possible markings:

 microfarads nanofarads picofarads EIA code 0.0001µF* 0.1n* 100pF 101 0.00022µF* 0.22n (n22) 220pF 221 0.001µF 1n(1n0) 1,000pF 102 0.0033µF 3.3n(3n3) 3,300pF 332 0.01µF 10n 10,000pF* 103 0.047µF 47n 47,000pF* 473 0.1µF (µ1) 100n 100,000pF* 104 0.82µF (µ82) 820n 820,000pF* 824 1.0µF (1µ0) 1000n* 1,000,000pF 105

(*) Not normally expressed in this form.

Voltage Rating: Voltage rating is usually marked and is often identified by the symbol 'V'. Most electrolytic capacitors clearly indicate their voltage rating. If the capacitance and voltage rating are both marked, a unit is also marked for at least one of the quantities so that the two cannot be confused. Polarity sensitive capacitors, such as electrolytics, are usually marked with a '+' or '-' symbol adjacent to one lead to indicate polarity.

### TRY THESE:- All rights reserved