Welcome to our final core electronics-based chapter. In the previous chapter, we learned how to control three different forms of motors in complex ways. In this chapter, we will direct our attention to detecting movement and measuring the distance with our Raspberry Pi and electronics.
Detecting movement is very useful for automation projects such as turning on lights when you walk into a room or building, an alarm system, building counters, or detecting revolutions of a shaft. We will be looking at two techniques for movement detection, including a Passive Infrared (PIR) sensor that uses heat detection to detect the presence of a person (or animal), and a digital Hall-effect sensor that detects the presence of a magnetic field (or, more liberally, we can say that the Hall-effect sensor can detect when a magnet moves past it...