How does the New Horizons probe know it's close to Pluto and turn its science instruments towards Pluto and other targets of its observations during the flyby?
What this is called primarily is called Attitude Determination, and is a part of the attitude control system in most spacecraft. Wikipedia has a great bit on that, which states:
Two star cameras are used to measure the spacecraft attitude. They are mounted on the face of the spacecraft and provide attitude information while in spin-stabilized or 3-axis mode. In between the time of star camera readings, spacecraft orientation is provided by dual redundant miniature inertial measurement units. Each unit contains three solid-state gyroscopes and three accelerometers. Two Adcole Sun sensors provide attitude determination. One detects the angle to the Sun, whereas the other measures spin rate and clocking.
Okay, so what does all of that mean? There are two main ways that the spacecraft lines up it's attitude, then it measures the differences by measuring how much attitude change there is. Okay, so what are the systems?
- Star camera- Points to known bright stars, which gives a fixed orientation in space. Giving two points will allow you to know exactly how you are pointed.
- Sun Sensor- Similar to a Star camera, but really just finds the Sun. I'm rather impressed that it works as far as Pluto, this might not work as well the further it gets out. These are generally simpler than a star camera.
- Gyroscope- Used to detect rotation. These can find how the spacecraft has rotated from a known configuration.
- Accelerometer- Will measure acceleration in a particular direction. These also assist in finding rotation.
Put all of this together, and you know how the spacecraft is pointed. According to Spaceflight101, the accuracy is 471 urads, or about 0.025 degrees.
Okay, so that's how it knows where it is pointed, now how does it know where to point? These come from the ground, where a sequence of commands was provided some time ago, and the commands began execution. They most likely were commanded to start at a certain time, which there is a clock on board that provides the time. This was determined using some kind of ground software based on the travel path of New Horizon, and the position of Pluto. Some spacecraft have the ability to move slightly to photograph a target, but this is usually reserved for things like Comets, which have some uncertainty about them.
Of course, another good question is, how do we know exactly where Pluto is? And even a small difference makes a huge effect, when you are only a few miles away. This was detailed in a Universe Today article some time ago. Prior to the launch, Pluto's position was known to several thousand km. That seems like a lot, but is miniscule when compared to its large distance away, only a millionth off. But for New Horizon, that could mean missing the planet entirely. Through dedicated measurements, and even using New Horizon's instruments, we were better able to identify its position. Basically, the spacecraft was able to image Pluto, and depending where it showed up on the image determined exactly where it was. This allowed for it to be more accurately determined, especially relatively to New Horizon's trajectory.
All of this put together allowed New Horizon to point it's camera exactly at the right spots to get some cool science done.