Somewhere along the line, even basic devices started becoming loaded with sensors. iPhones (and indeed many smartphones) now come with a pretty wide array of sensors. This includes things like basic light sensors, proximity sensors, accelerometers, barometers, magnetometers, and of course, the Touch ID fingerprint sensor. Some of these sensors are pretty interesting and easy to explain, but others are complex in design and operation.
One sensor that is typically very easy to use, even in analog circuits, is an ambient light sensor. Some types of light sensors use semiconductors and are more complicated, but one basic type of light sensor has been around for decades. It’s called a photoresistor. I took a basic electrical engineering course in college and one of our projects was to design a build a circuit with two LEDs and an op-amp. The circuit needed to show one LED when the room was bright, and flip to the other LED when the room was dark. There are actually at least two simple ways to use an op-amp for this, but the actual sensor used to gather information about the ambient light was a photoresistor. As the name might imply, the device simply changes its resistance based on how much light it is exposed to. More light means less resistance and less light means more resistance. Even simple circuits can be designed to accomplish complex tasks based on changing resistance like this.
An accelerometer sensor is much more complex than a light sensor, especially in terms of physical construction. The ones used in something like an iPhone are extremely small, but the basic construction is the same. They use a mass that is dampened by some type of spring device. When the sensor is accelerated, the mass, which is free to move independently, lags behind the initial movement. This lag in movement is what we measure and how the accelerometer measures acceleration. The lag can be measured in a number of ways, but one of the simplest is by using a piezoelectric crystal. When the mass resists the initial movement, it exerts pressure on the piezoelectric crystal. I’ve talked about piezoelectric crystals before, but just to refresh, when a piezoelectric crystal is compressed or pulled it will create a voltage. This voltage can then be measured and the magnitude can be converted into some amount of acceleration. By using three independent masses locked into three axes a single sensor can measure acceleration in any direction.
Proximity sensors can vary wildly in their construction and size. In high school I remember we used ultrasonic range finders in a number of our basic physics lab experiments. These devices emit an ultrasonic sound wave that propagates away from the device. When the sound wave hits an object, it bounces off of it and returns to the sensor. The internal circuitry is then able to determine the difference in time from the time the wave was sent to when it returned since the speed of sound is known. This allows it to compute the distance. A laser rangefinder works the same way, except it uses light (visible or infrared) instead of sound. Since light travels so much faster than sound, the circuitry must be capable of operating fast enough to measure the extremely short amount of time it may take for the light to be reflected back. Even a simple photoresistor could technically be used to create a kind of crude proximity sensor under certain conditions. If an object got close enough to the photoresistor, the ambient light would probably be reduced. This type of sensor wouldn’t really be able to determine distance, but it would be able to answer if something was close or not.
A barometric sensor is basically a specific type of pressure sensor. Pressure sensors are actually not too complex because once again, they often use piezoelectric crystals. In fact, this is pretty much the most basic property of piezoelectric crystals. When they come under pressure, they produce a voltage, which can be easily measured. Depending on what kind of pressure you’re looking to measure, the sensor can be set up to respond to that type of pressure. For example, a barometric air pressure sensor would need to have some way to have a sealed, known quantity of fluid or gas (air in this case) and then be able to pressurize or depressurize that fluid based on the environmental trigger.
In most cases, sensors are fundamentally simple, but engineers have come up with ingenious ways to miniaturize them so that we can enjoy the benefits of a large array of sensors in something as small as our phones. I eagerly await the day when Tim Cook announces that the iPhone will come with sensors able to detect Klingon warships under cloak. “One more thing” indeed!