How Everything Works









What is a sensor?

A sensor is an input device. It converts the tangible world into a series of signals that a processor can understand. Be it the sense of smell with a nose sensor and its processing by the human brain, distance with sonar and a bat brain, or electrical current with an ammeter and a computer, it all works by measuring the property of interest with a tool, then converting it into an electrical signal that the brain of the animal or computer processes. With this processed information, the animal or computer can better understand its surroundings and environment.

    There are an infinite number of sensor types in the world, and if a sensor doesn't exist but is needed, one can be built custom. Some standard sensors include:

  • Available light (photo diode, eyes)
  • Distance (infrared range sensor, acoustic range sensor)
  • Magnetic heading (digital compass)
  • Acceleration (accelerometer, gyroscope, inner ear)
  • Temperature (thermocouple, skin)
  • Touch (pressure sensitive switch, hair)
  • Electrical current (ammeter)
  • Angle (inclinometer, inner ear, eyes)

And they all work by measuring the parameter of interest and converting it into an electrical signal the appropriate processor can understand.

Can a computer understand its environment?

Humans are optimized for sensing; each of us is built with eyes, ears, a nose, highly receptive and reactive skin, and a tongue. We also have the ability to learn from experience, so if we sense something we are not familiar with, it is possible for us to determine what it is, how dangerous it is, how far away it is, or what its material properties are - we can make sense of what we sense. We even have the ability to describe sensations to other humans or even computers. But can we get a computer to do all the sensing itself?

The short answer is no. While computers are amazing machines with the ability to process anything and run programs, they have two major flaws: they crash when programmers have forgotten to tell them even minor details about their work and they must rely on digital copies of everything that exists in the real world. In other words computers don't have any sense if you don't give it to them and they can't make sense of the real world, only simulations of it.

Digital, what's that?

Before analyzing digital items, lets first look at what isn't digital. The opposite of a digital item is an analog item. An analog item is something that can be described using partial values, in other words, something that exists between a maximum and minimum measurable value. Take a lamp for instance; when the lamp is on, it glows yellowish, somewhere between orange and yellow. At the same time, it is quite warm, but not as hot as the sun. It's also bigger than a chess piece, but smaller than a refrigerator. The lamp's color, size and the strength of its light output can all be described in both precise and relative terms. This makes it analog.

Digital items work a lot differently. A digital item is binary, it has only two values, completely on, or completely off, yes absolutely or absolutely no. Some examples of this are the switch on the lamp, eating, and being in one place. The lamp is either on, or off, but never in the middle; in the act of eating, you are either doing it or not; and by being in one place, you are either there, or somewhere else. Since computers can only understand binary input (read "how switches work" to learn about binary) they are very well suited to understanding digital inputs, but since they only take in on/off values it is very difficult to describe an analog experience in digital terms.

So how do you input analog values into a digital computer?

It starts with logic. First you need to choose exactly what analog parameters are needed to accurately describe the real item (i.e. size, color, texture). Next you need to determine how big the range of each parameter is. So if the parameter is size, what is the biggest it can be, and what is the smallest it can be, and how many different size ranges should exist between the two. Obviously there are an infinite number of size options between the biggest thing and the smallest thing, but computers need a discrete integer value as their input (i.e. the number could be 7 on a scale of 0 to 256, but could not be 8.56 from 0 to 10).

After you have your parameters and ranges, you need to describe your item. If the item is a cell phone, the parameters may be how much blue color exists, how much red color exists, how much green color exists, size, distance, altitude, and weight, and the ranges could be 0 to 256 for all of these parameters. If it is a teal green phone on a counter, the parameters may look like the following table:

Blue 0-256 (off to on) 256 (bright blue)
Red 0-256 (off to on) 0 (no red)
Green 0-256 (off to on) 256 (bright green)
Size 0-256 (1in3 to 10in3) 40 (3 in3)
Distance 0-256 (0 ft to 5 ft) 100 (2 ft way)
Altitude 0-256 (0 ft to 5 ft) 200 (4 feet off ground)
Weight 0-256 (0 lb to 1 lb) 128 (0.5 lb)

But how do those get into the computer?

First, they need to be converted into binary numbers, or a representation of the number using several ones and zeros. If you need more info on this, check out "how switches work". Once you have these numbers in binary, you can send them through a serial port on the computer and the computer will store them in a file. Once there, the file can be accessed, read, and manipulated, and the computer can now tell you all of the details about the phone you had measured.