I decided it was time to get the bubble sensors working. I started by changing the main loop to write the onboard LED with the state of the photosensor to aid debugging. This led me to notice something I've suspected for a while: the main loop is way too long (I'd estimate maybe 200ms; I don't have a scope or anything to measure with). I refactored a few things to fix this:
1. I ripped out my photointerrupter debouncing, edge counting code, and replaced it with built-in interrupts.
2. I changed the main loop to only update one analog sensor each time through the main loop, rather than reading from all four each time. It still reads each sensor a bunch of times (currently 4) and averages them together. If I need to make it even faster, I could probably speed things up by doing only one read per loop, and updating the value at the end of 4 iterations. But this seems to be fast enough for now.
In the process I noticed that I wasn't actually reading from the LM35 sensor before (I was reading from the TMP36 twice), whoops. I fixed that, and I'll collect some more sensor data, but this brings up an interesting question: why is it that the first time I read from the TMP36 it's super noisy, but the second time it's not? Still, it may be a moot point, because the LM92 is producing great results... except when it stops responding for no reason. I'll keep an eye on it.
Then I got started figuring out how to get the photo sensor to detect bubbles. My first thought was to add food coloring to the water. I experimented with green, blue, and yellow food coloring, and all three combined, but despite being very visually opaque, it apparently stayed pretty much IR transparent. I guess I experimentally confirmed the results here (which I was hoping were wrong, but no luck): http://www.av8n.com/imaging/dye-spectra.htm
I realized there are many easier things I can adjust than the absorbance spectrum of the water. The next thing I tried was cutting power to the LED in the sensor by a factor of 5 by swapping out the current limiting resistors. While this didn't completely fix the problem, I did notice that there was a particular position on the airlock which caused the sensor to trigger. A little more careful fiddling led me to discover a point where I could attach the sensor which does seem to detect passing bubbles, even with normal (transparent) water. Once I get my hands on a hot glue gun I should be good to go.