It's fun to check how fast various things--fans, drills and the like--are rotating. And it's easy to do with the following ingredients that many of us will have at home:
Disclaimer: This works on my phone. It might not work with your LED or your phone. It might damage your phone, etc. All the responsibility is yours.
Background: An LED converts electricity to light but also can be used in reverse as a photodiode that converts light to electricity. The resulting current is low but sufficient to be captured by the microphone input of a phone (at least my Galaxy S3). An oscilloscope app can then capture the output and you can get the rotational speed.
I've used three different methods depending on what the rotating object is. The through-light method is for fans and other objects that you can shine light through. The matte object method is for objects like drills with plastic chucks that are not reflective. The metallic object method is for objects like drills with shiny metal chucks.
One tricky thing is that you might think that the light the LED will most efficiently convert to electricity will be of the same wavelength as the light it emits, but that does not seem to be true for the red LEDs I have. The red LED that I've tested seems most efficient in generating electricity from light in the green range (I get about 1.5 volts by shining a green laser). It seemed to have no measurable output from my white LED flashlight with a red filter (maybe the red component of the flashlight was too narrow and missed the sensitivity window of the red LED). This is important, because it means that if the LED were encased in red plastic, the photodiode function would be effectively killed. So if you use a red LED, make sure it's got clear plastic. Interestingly, the infrared LED that I tested was quite responsive in the red and infrared ranges, so if you want to work with a red laser or infrared light as your light source, use an infrared LED. I am assuming other LEDs will be like mine, but if not you may need to rummage around in your scrap electronics box.
The LED makes a super-simple light detector for your phone. While your phone may have its own light detector, this doesn't work with the oscilloscope apps I've tried, and has a much lower sampling rate than the microphone. The microphone input has a decent sampling rate, though unfortunately it filters out constant voltages on my phone and hence is only sensitive to changes.
I was originally going to explain how to do all this with a stand-alone oscilloscope, and indeed one can do it this way, but one of my kids pointed out that few people have oscilloscopes, so I switched to using a phone. Which is anyway easier than dragging my vintage 30 lb oscilloscope from room to room.
Step 1: Make a light detector for your phone
This is very simple. Get a headset cable with a four connector 3.5mm jack. Hook up the LED's anode (positive, longer leg, no flat) to the microphone input and the LED's cathode (negative, shorter leg, flattened plastic ring) to ground.
On my phone, if you end up reversing this, the LED will emit a very weak light and so you know you've got it reversed. With the correct connection there is no light.
The four connectors on the 3.5mm jack are: tip, ring, ring, sleeve. On Android phones, the ring nearest to the sleeve is typically the microphone input, and the sleeve is ground. So as in the diagram, the anode goes to the wire connected to the ring nearest the sleeve and the cathode to the sleeve. I understand that iPhones have it reversed, but I don't have an iPhone and am just going by something some website said.
I actually didn't have to do any soldering myself because I didn't have a spare headset cable at home but I happened to have some 3.5mm four connector male to DB9 female cables (from Sharp 7xx organizers). It is very unlikely that you have one of these, but if you do, you can just stick the LED right into the DB9 female connector (after checking which DB9 pin connects to which jack connector). The fit will be loose, so I wedged in some solid copper wire to keep the LED secure.
Step 2: Setup oscilloscope software
I used OsciPrime. The big blue arrows on the sides and bottom of the screen bring in toolbars. I set up as follows:
The details on how to put in these settings (except the last one--doesn't fit on screenshot) are on the first screenshot.
Once you have these settings, plug in the light sensor, activate the oscilloscope (the play button in the upper right corner) and play around with shining a bright flashlight at it, from close up. If your microphone input is like on my phone, only changes will register, so you will need to wave the flashlight around to see it.
If you see nothing, unplug the sensor and see if you can view your voice at least via the built-in phone microphone. That might help with troubleshooting.
Step 3: Through-light measurement (e.g., fans)
If you're measuring the speed of something that has periodic spaces in it that you can shine a light through, e.g., a fan or a wheel with thick spokes (thin ones might not register), the easiest way is to simply shine the flashlight from one side and put the light sensor on the other, while running the oscilloscope app.
If all goes well, you will see a periodic pattern on your screen and can press the play/pause button (upper right in OsciPrime) to pause and measure.
Then you need to figure out how many wavelengths in the pattern correspond to a full rotation. This basically means just to count the number of spaces in the rotating object that light can get through. For a fan with solid blades and spaces between this, this will just be the number of blades.
Then use the left and right markers in the oscilloscope app to mark out a complete rotational sequence. In OsciPrime you can use pinch zoom for greater precision, and the left and right markers are triangles pointing right and left, respectively. OsciPrime (and presumably other good apps) will the automatically measure the amount of time between the markers (10.1 ms in the screenshot) and tell you the frequency (99 Hz). The frequency then gives you the number of rotations per second. Multiply by 60 for RPM (5940 in the example).
For greater precision you can mark out several rotational sequences and multiply the frequency to adjust for the count. Or if the whole sequence doesn't fit in memory, you can mark out a part of it and divide the frequency to adjust. If the sequence fits in memory but not on screen, you can scroll by tapping the shaded area below the waveform display in OsciPrime.
You may need to get creative with operating the flashlight, light detector and app. For instance, you might have a helper start and pause the app. Or you might start and stop the app with your nose while using your hands for the flashlight and light detector.
Step 4: Reflective rotating object
What if you have a rotating object with no holes? There are two possibilities. Either the object is metallic and reflects enough light for the sensor to detect or it's not.
Suppose first the target is reflective, like the chuck of my benchtop Harbor Freight drill press. Then just stick a piece of masking tape on it to block reflection for part of the rotation. Make sure it won't come loose on rotation and make sure it doesn't cover the whole of the rotating target--we want to generate flashes of light.
Put on safety glasses. Start the rotation. (You may need a vise to hold a trigger in place, etc.)
Activate the oscilloscope app. Hold both the flashlight and the light detector close to the target, in such a way that light from the flashlight will reflect from the target into the detector. You can play around with various angles until you get a periodic signal. You may need the detector very close to the target, but mind your safety--you don't want to bump a quickly rotating object.
Once you have the signal (it may be faint), pause the oscilloscope app and measure the rotational frequency like in the previous step. I found it possible to hold both the flashlight and the light detector in one hand and use the other hand to start and stop the phone.
Step 5: Non-reflective rotating object
Suppose now we have a rotating non-reflective target, say the chuck of a Harbor Freight Li-Ion drill.
The just use masking tape to stick a piece of aluminum foil, shiny side out, on the target. Make sure you don't cover the whole target, but just put on enough to generate a periodic signal.