Jbeale shared his tiltmeter project in the forum:
Apparently the most popular sensor for this purpose is an “electrolytic tilt sensor”, basically a bubble level with internal electrodes. These are not exactly consumer items. I tried building a simple pendulum tiltmeter using a split-photodiode, Optek OPR2100 (about $10 from Mouser) and LF411 opamp. The pendulum is a 0.064 x 3/4″ x 12″ strip of brass (K&S Metals #8247). Light from a 3W LED shines through a slit at the bottom of the pendulum into the detector. I have the photodiodes in zero-bias mode, wired anode-to-cathode so in balance, the current from one photodiode circulates through the other photodiode. This way the opamp only sources or sinks current (into the photodiodes, through feedback resistor Rf = 1 Mohm) when there is an imbalance in the photodiode current (= light level). I used a LF411 at +/- 15 V because I had it handy; I guess a more modern design would use a 5V single supply opamp and generate a 2.5V midpoint reference somehow. The pendulum will swing a long time unless damped, so I used a magnet assembly from an old hard disk drive for damping (eddy currents in the brass pendulum provide the force), this worked nicely.
Via the project log forum.