The Fundamentals of Interactivity: Sensors You Touched Before Getting out of Bed
The smartphone. You picked it up the minute your eyes opened.
You might not often ponder about how many sensors are inside the smartphone. I don’t usually think about it. Most of the time I’m thinking about the ten thousand messages it shoots at me every day. Or I’m thinking about how the notification sound is really starting to get irritating. Also, why am I getting Twitter notifications about Snoop Dog?
(Why do all the tech nerds run around in “Hello World” tee shirts? Hello world is generally the first program someone will write when learning a new programming language. The program will create the display “Hello World.” It’s also useful for checking to make sure the compiler, the development environment, and the run-time environment are all installed correctly. (More on that in another post.) If you sew, you know you always sew a line of stitched on a piece of scrap fabric first to check the stitch count, the tensions. Is the machine how I left it? This is the same idea.)
Once I’m done with all those distracting messages, I can take a moment to wonder about what is inside that phone? As I do, a ton of other questions come up. How do they work? What is the phone doing with them? And the cascade follows. I’d like to take a minute to answer some of my own questions.
"And turn on the light!"
Ah, that is a great place to start! The good old basic switch is in every single room of our house and often with redundancies. What happens when we flick the switch to our light? Well, the light goes on. But how?
A basic circuit. Let’s pretend the light you turned on this morning had its own power source. Here’s what the circuit would look like. On the bottom is the icon for a switch. When the switch is closed, the electricity flows through the circuit and to the light. When it is open, the electricity cannot flow. There is a gap in the line, no connection. I’m breezing over that a little bit quickly. If you want to learn more about this basic circuit check out this project I made with colleagues from Otherlab called Light Up Lab!
Why am I telling you this? Because sensors can replace switches. Instead of having a physical connection, they transmit data to turn different components, namely the light, on and off.
What are these things inside my phone (AKA: Sensors)?
Every phone is a little bit different and has its own semi-secret recipe of components. You may hear these components called MEMS. Which is an abbreviation for MicroElectroMechanical Systems.
Here’s the basic list of what is going on inside.
- Microphone: The Mic is used during phone calls or voice recognition to take in the user’s voice and interpret or relay what they are saying. Wonder how it works?
- Camera: The cameras can take photos and video often from front or rear. These cameras are TINY!!! Here it is next to an 18 ligne button. I would say, this is definitely small enough to embed in a garment.
Ligne is the unit of measure used to describe the size of buttons. 18 Ligne is 11.5 mm. Click here for the button size chart from Britex.
- Gyroscope: Is used for device orientation. I’m talking about a miniature sensor that works like the gyroscopes they use as motors in satellites. Even better! Think of the flywheel on a sewing machine. Did you know your sewing machine had a flywheel? The flywheel is a part of the gyroscope. If you want to understand better,click here to read about how the MEMS Gyroscope works on Sparkfun.
- Magnetometer: This sensor is used to help determine magnetic north in a compass and could be used to detect metal.
- Accelerometer: An accelerometer gives us the data to calculate the change in velocity over a unit of time. Or how fast it is moving. Here’s how it works.
- IMU: An Inertial Measurement Unit (IMU) uses accelerometers and gyroscopes, and sometimes also magnetometers to give accurate data about position. This is probably not a beginners sensor. They have long been used in aircraft, spacecraft, and guided missiles.
- Proximity Sensor: There is usually an Infrared LED and IR Light Detector close to the ear speaker that lets the device know when you’re on a call.
- Light Sensor: Allows the device to sense ambient light and adjust the screen brightness automatically.
- Barometer and Thermometer: Are used in some devices to detect air pressure and air temperature. If the device overheats it will shut down.
- Fingerprint Scanners: Newer devices have fingerprint sensors to unlock the device and add security measures in apps that access financial information. This article talks a bit about how they work. The most common methods are optical scanning and capacitance scanning.
- Heart Rate Monitor: In some newer devices, a heart rate monitor is placed near the ear speaker.
- GPS chip: A regular GPS receiver uses satellites to locate where it is on earth. When on the ground, 3 satellites can get a good reading. If not on the ground and/or you want altitude position, at least 4 satellites are required. Each of the satellites has an atomic clock and sends time coded messages at a specific frequency read by the receiver. Phone GPS systems work in a slightly more complicated way leveraging data from the cell phone company. Read more on SparkFun.
If you’re curious about which sensors your particular phone, there are a ton of apps to identify them. Search for Sensor Test and you’ll come up with: Sensor Play, Sensor Test, and a slew of others. Which one you go with may depend on whether your phone is Android or Apple. It will even tell you a mini data sheet about the sensor.
Data sheets are often used in engineering fields to describe the technical parameters of a component. This is the same as a Spec Sheet used to describe technical properties of fabrics or garments.
Are there more of these things? (Yes, Sensors)
Yes! We are just skimming the surface here. Some other kinds of sensors include, but are not limited to the ones listed below.
- FSR: A Force-Sensitive Resistor (FSR) is a simple sensor that allows you to detect physical force. They change in resistance based on how much they are pressed. (If you’re confused about what resistance is, think of a river. A river with no rocks flows fast and free. Then think of a river with a ton of rocks and even boulders. The rocks and boulders slow down the flow of the river. In this case, the resistor is like if you took a giant invisible force and pressed down on the rocks so that the water could flow freely.) This is one of my favorite sensors because of how simple and robust it is. Remember light up sneakers!? Some version of this was likely used to trigger your sneakers to light up.
In 2006, Nike released a sneaker called Nike+ which connected to your iPhone and told you information about acceleration, speed, velocity, height, air time, G force, amplitude, trajectory, and the list goes on. (See the next section of this post for more on the Nike+ Project.) The sensors were predominately pressure sensors that were either embedded in the shoe, added to an insole, or later sold as just sensors, like the one below.
- Humidity sensor: This one is named well. You could set up your own bathroom IoT switch to turn on the fan when the shower is hot and running for a while.
- Motion sensors: Some motion sensors are more sensitive than others. Pay attention to the range you require for your project and shop accordingly. You might also check out Ultrasonic Range Finders for longer-range projects. Light sensors and infrared sensors described above under Proximity Sensor. A camera can also be utilized for this purpose.
- Piezo: converts voltage into vibration or vibration into voltage. If you are a musician, you may have heard of a piezo pickup. These use physical vibration from an analog musical instrument and turn it into voltage to create digital sound. Ever open up a singing music card? That’s also a mini piezo. If you like working on cars, you’ve heard of a fuel injector. Hundreds of small piezo slices are stacked at the end of a pintle valve. When the piezo stack is triggered to expand, the pintle sprays fuel. Who knew fashion would be your segway into automotive? A piezo can be programmed to make low-quality noise, like a ring tone.
- Flex sensor: A flex sensor works similarly to an FSR. Instead of changing resistance with physical impact force, these sensors change resistance based on bending in one direction. I was definitely not aware of the Nintendo PowerGlove, but this is an example of a device using flex sensors.
New sensors are becoming available all the time. Keep Stretch Sense on your radar!
If you want to learn more, my favorite place to go to learn about and buy components is Adafruit. Other popular places to shop include Sparkfun, which also has great educational material, and Digikey. For beginners, I recommend Adafruit because the site explains things very clearly and has a more limited selection making it less overwhelming to shop. It’s also run by an amazing woman who graduated from MIT named Lady Ada (Limor Fried). Once you get a handle on the fundamentals, a good place to go for a greater variety of components is Digikey, but it takes some time to learn how to shop their site.