### Similar presentations

A sensor is like one of our five (5) senses; it tells you what is going on in the outside world; except that sensors send information to an electronic device, like a computer. Copyright © Texas Education Agency, 2013. All rights reserved. 5

Sensors A device that measures something (a detector) A transducer that converts one form of energy into another form of energy (example: temperature into voltage) Produces an output related to what it measures Copyright © Texas Education Agency, 2013. All rights reserved. 7

Characteristics of a Sensor Is sensitive only to the property you want to measure and insensitive to any other property Does not influence the measurement itself The output has a mathematical relationship to the measured property Copyright © Texas Education Agency, 2013. All rights reserved. 8

Human Senses Humans have five senses: o Sight o Sound o Taste o Touch o Smell Humans have a brain to analyze and interpret what they sense. http://en.wikipedia.org/wiki/File:Structure_of_sensory_system_%284_models%29_E.PNG Copyright © Texas Education Agency, 2013. All rights reserved. 9

Human vs. Mechanical Human senses are generally much more sensitive than sensors we can build. There are many, many individual sensors. o For example, an eye has about 120 million rods for light detection. o That much data would be impossible for a current generation computer to analyze. Human senses are generally not precise. o How hot is it? o How many pounds of pressure are exerted? Copyright © Texas Education Agency, 2013. All rights reserved. 10

11 The number of sensors cannot be duplicated. Human ability to analyze data cannot be duplicated. Human senses work for the brain, and the output from them cannot (yet) be connected to a computer. Copyright © Texas Education Agency, 2013. All rights reserved. Human vs. Mechanical (cont’d)

Sensor Output Sensor output needs to be in a form that can be analyzed. o Output needs to be a number. o Computers work with binary numbers. Sensor output needs to be in a form that can be measured. Generally, this means the output must be electrical. Copyright © Texas Education Agency, 2013. All rights reserved. 12

Input Voltage is Useful The galvanometer is an example where a voltage creates a force that can be seen and measured. It is easy for voltage to be measured, and there are a lot of ways of doing so. This makes voltage the preferred type of input to a computer or electronic device. Copyright © Texas Education Agency, 2013. All rights reserved. 13

A Galvanometer A galvanometer uses a needle on a dial to indicate the amount of voltage or current present. Two forces: o The force of interaction due to a magnetic field created by and proportional to the input o The force of a spring deflected by the previous force The needle comes to rest at a position where the two forces are equal. Copyright © Texas Education Agency, 2013. All rights reserved. 15

Sensor Outputs Some sensors will produce a voltage output. This voltage output can be used directly by an electronic device. Other sensors do not produce a voltage output. The output they produce must be converted to voltage. Copyright © Texas Education Agency, 2013. All rights reserved. 16

Temperature Sensors One type of temperature sensor called a thermocouple produces an output voltage related to the temperature. Another type of temperature sensor called an RTD produces a resistance change related to the temperature. The resistance change can be converted into a voltage, so the two (2) sensors are roughly equivalent. Copyright © Texas Education Agency, 2013. All rights reserved. 17

Computers Need Numbers There is generally at least one more step in the conversion process. The process of converting the voltage value into a binary number. Some types of sensors can produce binary numbers without using voltage. Copyright © Texas Education Agency, 2013. All rights reserved. 18

Global Positioning System A GPS tells you your position. Data is sent digitally and received digitally from at least four (4) satellites. Your GPS receiver basically measures time. The time it takes for each signal to go from the satellite to the receiver is a function of the distance to the satellite. The onboard computer can triangulate a position from those four (4) signals. Time is accurate to 10 nanoseconds. Copyright © Texas Education Agency, 2013. All rights reserved. 19

Sensor Technologies Most sensor technologies are not as complex as GPS. The GPS example shows how digital data (binary numbers) are getting more and more important and more and more common these days for sensors. There may be multiple conversion processes needed to make a sensor useful. Because of how we use sensor data, in a computer, there is a link between sensor technology and computers. Copyright © Texas Education Agency, 2013. All rights reserved. 20

Computer Programming The link between a sensor and a computer is the software program. A sensor is only as useful as a software program can make it. o Sensor data must be analyzed. o Decisions must be made as a result. A software program is used to do both. Copyright © Texas Education Agency, 2013. All rights reserved. 21

Example Is the room temperature above 75 degrees and rising? Turn on the air conditioner. Is the room temperature below 72 degrees and falling? Turn off the air conditioner. A microcontroller can be, and often is, used to control an air conditioner. Copyright © Texas Education Agency, 2013. All rights reserved. 22

Categories of Sensors There are many different ways to categorize sensors: o What they measure o How they work o Type of output they produce Copyright © Texas Education Agency, 2013. All rights reserved. 23

Chemical: pH, smoke detectors, carbon monoxide, gas detectors Electrical: capacitance, galvanometer, Hall effect, resistance, voltage, current, metal detector, piezoelectric Mechanical: fluid flow (air and water), bi- metallic strip, encoder (rotary and linear ), position, diaphragm Radiation: Geiger counter, photoresistor, light sensitive diode, scintillation counter, particle detector, bubble chamber, Fabry- Perot Copyright © Texas Education Agency, 2013. All rights reserved. 25 Sensor Process Types

Position: galvanometer, bimetallic strip, bourdon tube, thermometer Voltage: thermocouple, microphone, piezoelectric effect, Hall effect Digital signal: MRI, video camera, GPS, range finder, switch Linear or non-linear output Copyright © Texas Education Agency, 2013. All rights reserved. 26 Sensor Output Types

Robotic Sensors Robotic sensors are only as useful as the ability to use a computer program to evaluate data and make decisions as a result. Sensors are getting more and more complicated and so are the computer programs needed to use them. Copyright © Texas Education Agency, 2013. All rights reserved. 27

28 There is a link between computer programming and the usefulness of a sensor. Therefore, we will categorize sensors based on the type of computer programming needed to make them work. Copyright © Texas Education Agency, 2013. All rights reserved. Robotic Sensors (cont’d)

Simple Sensors The simplest sensor acts like a switch. Produces only two values: o On o Off These values correspond directly to the language a computer uses: Binary (1 or 0). Copyright © Texas Education Agency, 2013. All rights reserved. 29

First Example Contact switch (Bumper Switch) Normally open switch Closes on contact with an object Open, value = 0 Closed, value = 1 Input + 5 V Output + 5 V Output 0 V Input + 5 V Copyright © Texas Education Agency, 2013. All rights reserved. 30

V S = + 5V V O = + 0V The diode is an open switch, the output is connected to ground. V O = 0 V Here is the same example using a light sensitive diode. Copyright © Texas Education Agency, 2013. All rights reserved. 31

V S = + 5V V O = + 5V The diode is a closed switch, the output is connected to power. V O = 5 V Here is the same example using a light sensitive diode Here is the same example using a light sensitive diode. Copyright © Texas Education Agency, 2013. All rights reserved. 32

Conditions The robot car drives straight until it hits something. When it hits something, it must stop. We put a push button switch on the front of the car. The way the car program knows when it hits something is when the switch closes. Copyright © Texas Education Agency, 2013. All rights reserved. 33

Data The position of the switch represents data; in this case, binary data (0 or 1). We need to “read” the position of the switch (voltage or no voltage on the input). Data needs to be stored in a computer’s memory to be used. We need a memory location for the data. We need to control the car based on the data. Copyright © Texas Education Agency, 2013. All rights reserved. 34

Commands Call the switch position data value “switchdata.” It is typical to use 16 bits for the data size. First command: int switchdata This is a typical C++ type of command. Copyright © Texas Education Agency, 2013. All rights reserved. 35

int switchdata switchdata is both the name we give to the switch data and to the memory location where the data is stored. Copyright © Texas Education Agency, 2013. All rights reserved. 37

int switchdata switchdata is both the name we give to the switch data and to the memory location where the data is stored. Right now we have no idea what value is going into “switchdata” so we set the initial value manually. Copyright © Texas Education Agency, 2013. All rights reserved. 38

int switchdata = 0; By setting the value we created something called a statement. Statements in C++ must be terminated by a semicolon. Copyright © Texas Education Agency, 2013. All rights reserved. 40

Next Command A microcontroller can only read a value on one of its inputs. The voltage output of the switch is connected to a microcontroller input pin (with a wire). o Assume the input pin is pin 7. o Use the read command for that pin. switchdata = GetDigitalInput (7); Copyright © Texas Education Agency, 2013. All rights reserved. 41

switchdata = GetDigitalInput (7); The value of the digital input (0 or 1) is placed into the memory location called switchdata. Copyright © Texas Education Agency, 2013. All rights reserved. 44