Notes on homework:
Many sensors measure movement or distance indirectly, by sending out a pulse of light or sound and reading the reflected signal when it bounces off a target. These are called ranging sensors because they read a range of distance.
Miniaturized electromechanical (MEMS) sensors:
Still other sensors work by converting the energy they read into a change in capacitance. For example, accelerometers and other miniaturized electromechanical (MEMS) sensors typically have a tiny moving conductive mass at their core, suspended on tiny springs and surrounded on both sides by electrical contacts. Because the conductive mass is parallel to the outer contacts, a capacitance builds up between the contact. When the mass is moved, the capacitance changes between the two sides, effectively creating two variable capacitors. That variable capacitor is then placed in a resistor-capacitor circuit to convert the change in capacitance into a changing voltage.
- Temperature resister: as it changes because of heat, it either turns on or off the transistor so you can measure temperature.
- Accelerometer measures acceleration on x/y/z axes
- Gyrometer measures a changing angular acceleration (can tell when you are turning it)
- Whenever you have two contacts that are in parallel connecting to an electrical connection that creates a capacitor.
- Wurlitzer electric piano works with a comb of large metal bars where any vibration changes the capacitance between the fixed part and the moving ones.
Using a Sensor With a Microcontroller
analogRead function to find range:
Dividing the project up into the smallest steps really helps (to find where you went wrong - miswiring, missing a pin):
1) Can I talk to the sensor
2) What is its range?
Once you get numbers you need or expect then you can move on.
You probably don’t need to convert the sensor’s readings into its output voltage or its physical property. For example, if you’re using a force sensing resistor, you probably don’t need to know how many Newtons of force are being exerted on the sensor, or what the output voltage is. Instead, you probably just need to know whether someone is pressing gently, firmly, or really firmly against the sensor. Perhaps you just need a range from 0 to 10. When you write your conversion function, consider what the relevant result is for you, and write a function that delivers that result.