# How can I convert the current from a fan to the microphone headset input on an iphone?

I am working on creating an anemometer (or wind meter) for the iPhone. I am a programmer and know exactly how I could do this on the software side of things, but I am a complete noob when it comes to electronics. I have seen many other posts about putting voltage or an audio line to the microphone, but I'm trying to convert the current generated by a small spinning fan into a microphone input that I can measure on the iPhone. How can I make sure that the volts generated by the fan will appropriately scale to the input of the iPhone microphone?

"Best": The "best" solution is to use a low cost microcontroller to measure the data and to output a signal that is suited to what the iPhone can handle. This could eg be a tone sequence or frequency or about anything else measureable. All up parts cost could be under \$1. This takes some microcontroller hardware experience - but may be an acceptable approach.

"Simpler": As long as extra hardware is acceptable, a reasonably level independent way is to convert voltage to frequency and then to measure the frequency in software. If in-device measurement is too hard the sound could eg be saved to a file, sent to a remote point, measured and returned. Or it could be relayed live. But hopefully you have enough access to processing power to do it directly. The frequency can be as low or high as you wish - and if you can measure time periods you could gate the tone on and off for a period related to voltage. Achievable reolution may not be large but it should be able to meet the ned. Averaging over many samples would be possible.

DIY with an LM555 - cheap and may be good enough.
EDN - NE555 timer sparks low-cost voltage-to-frequency converter
Related circuit from here shown below. Opamp can be common and low cost LM358 or LM324 BUT a virtual ground at about half supply would be needed as opamp output must swing negative relative to ground to operate integrator. Supply voltage can be 5V or more with LM358 or LM324.

LM331 dedicated precision voltage to frequency converter

Analog Devices MT028 - V-to-F tutorial - 7 pages. Good and has links.

Linear technology AN14 Designing high performance V to F converters - overkill for what you want but gives ideas.

Microchip says ...

Many many idea starters and some complete circuits

• What is it that corresponds to loudness? Is it frequency? On the iphone, it is really easy in software to measure relative loudness. Will voltage to frequency help me to accomplish this? Jul 28, 2012 at 2:03

Instead of trying to input analog levels, you may have more luck if you use your input to control the frequency of an audio oscillator. You would then measure the frequency in software on the phone.

But you might not even need to do that - if not equipped with filter capacitors, your generator already may have an audio-frequency variation proportionate to speed in its output due to the poles and brushes. If you had a brushless device which output A/C, this would work even better, but you might be able to do something by A/C coupling the output of your current device with a series capacitor chosen to pass only the brush noise.

You may also want to think about a protection circuit for the phone, such as some back to back diodes.