Alright, which section to figure out first? How about the sensor? If that doesn't work, the rest of the project is a bit of a moot point. It would just be cart without the horse.... or some other idiom.
My initial plan was to use some kind of capacitive sensor that would simply be a metal plate mounted to the body of the guitar. As a matter of fact, the idea of a capacitive sensor was what started this whole project. I don't exactly recall what got me started on it, I just thought it was a cool idea in need of a application.
So one afternoon I soldered a lead to a small piece of copper clad board about 2" x 2", added a few components, hooked up the probe scopes and started waving my hand about. And I really didn't get far. Couldn't really detect any affects on transients without physically touching the pad. After a host of small modifications and trying different things I decided this needed a little more research. Perhaps I'll get around to giving the idea more serious time in the future. And I'm pretty sure there are IC's I can buy for this purpose with app notes.
With the not so successful capacitive test I let the project sit for a little while. Then one day at RadioShack looking for a relay for my car's power antenna I spied an IR LED and detector combo. The photodetector option was one I had considered, but I had convinced myself not to go down that road. But I decided to part with my $2 (which was way overpriced of course) and shoved them in a drawer at home.
Eventually I got around to playing with the photodetector(PH1) and it was a pretty simple design process. Now I really didn't know anything about using a photodetector as I had never used one before, so it was off to the internets to do a little research (also note that as a Radioshack part, there was little info about the part). Many designs I found admittedly I didn't fully understand at the time, but it became apparent how the device could be used. So the trick was to reverse bias it in series with a resistor(R16) and think of the detector as a sort of light controlled pot or light controlled BJT... or something. For the initial tests I slapped probably a 1K or 10K resistor on the breadboard and fed it to an op-amp buffer circuit using an MCP601 ( a part I had lying around). Oh wait, I still need an IR source.

Luckily, the packaging for the parts did include some maximum ratings. The emitter(D1) had a peak forward current rating of 150mA and a typical forward voltage drop of 1.3V. This we can work with using Ohm's Law:
Plugging in the numbers, assuming Vcc = 5V, we roughly get R17 = 25Ω. Well I have 100Ω handy. And besides, we don't need to be redlining the little guy. We'll have a forward current of only 37mA, but that'll be plenty. Now it is time to build and test.

Success! Not perfect operation, but I was able to observe a small voltage swing on the output as I moved my had closer and further from the diodes. I did try inserting an object in between the diode lenses which had no effect so long as they were pointing in roughly the same direction. And according to the packaging, that should be the case as the detector only has an angle of sensitivity of 20 degrees. So about that small voltage swing? Easy, just put a larger resistor in series with the detector. Since the photodetector is going to allow a current to flow, the voltage seen at the input of the op-amp is going to be that current multiplied by the resistor. Bigger resistor, bigger voltage. I did have to try a few values before settling on the 1MΩ you see in the schematic. Now I could detect my hand from about 1 to 10 inches away.
Up to now, I've been quiet about Q3 and the Zero setting pot(R1). That is because these guys came into play after the whole design was done and working. For the time being, I'm just going to tell you that Q3 was added to turn the LED on only when needed in order to save power.
The potentiometer on the other hand, was somewhat of a design necessity. I did this little project over the course of a few days, sometimes working in the afternoon, and sometimes in the evening. In the afternoon everything worked great, the detector output was stable and repeatable. In the evening though, I was getting fluttering values when nothing was present above the detector. As it turned out, the lamp on the hutch above my desk was emitting enough IR and/or near IR light to introduce a sort of noise. If you look at a datasheet for a photodetector, you will see they have a peak sensitivity to a certain wavelength of light. However, they will have diminishing sensitivity to the surrounding wavelengths on either side of the peak. My lamp, producing both heat and light, was definitely polluting my results.
A feature of any ADC is that you can set the lower and upper voltage references to scale the conversion. In this case using the 10-bit ADC on the the PIC16F916, I had 1024 bits of resolution. But those 1024 bits could mean 0-5V, or 1-2V, or 2-5V, all depending on the reference voltages used by the ADC. I simply used the 5V supply as the upper reference, then added the pot to set the lower reference. So when my lamp is producing, say 600mV of noise, I set my pot for 700mV at the wiper. Now the ADC won't output a number above 0 until I move hand close enough to overcome the 700mV threshold. In practice you need not know the actual voltages, just trim until the detector appears to stop detecting (it doesn't, but the microcontroller acts as such).
Of course, by setting the zero point to a higher voltage, we've reduced our physical detection range. In engineering we make compromises. But realistically, we don't need that sort of range to simulate a whammy bar anyway. To further improve the performance of the detector, we can use some kind of fixture for the two diodes which will improve the directionality of incoming light and also includes a tinted lens filter to reduce the incoming power from wavelengths surrounding the one of interest.
Well that was quite a lengthy discussion for the hand detection circuit, but now we can move on knowing the crux of the project works.
