This simple noisy gadget uses a method known since the 19th century to generate the notes of a scale: the number of teeth on each gear corresponds to the frequency of a note, so when you let something buzz against each gear, you'll hear the corresponding note. Here's a video of the thing in action: flickr.com/photos/ranjit/5472598312/
This set of gears creates a just intonation diatonic scale - all the pitch ratios are related by simple fractions. The gears have 24, 27, 30, 32, 36, 40, 45 and 48 teeth.
You could use an optical sensor like a photo interrupter to pick up the pitches, or if you cut the gears from steel, you could use magnetic pickups like the Telharmonium did back in 1898! synthmuseum.com/magazine/0102jw.html