# Circuit that can convert current pulses to voltage

I have an anemometer which outputs current pulses. I can't take it apart but I know there is a phototransistor and LED in parallel shining through holes to it. I was told that with 30m/s wind there will be 3uS long current pulses over the normal current (through the LED).

My problem is to transfer these pulses to an Arduino or convert these pulses to voltage 0/1. Arduino is no problem for me, but I am inexperienced in circuit design.

• Do you have a link to the anemometer so the spec can be analyzed? Do the pulses remain constant width but the pulse rate increases with wind speed? Apr 4, 2013 at 11:51
• Current -> voltage translation can be done crudely with a resistor, or if the current is very small done properly with a "transimpedance amplifier". Apr 4, 2013 at 12:05
• Andy aka: Unfortunately no, its some proprietary old piece Apr 4, 2013 at 12:27
• Question cannot be answered without details of the "pulses" - what is the amplitude? Apr 4, 2013 at 13:18
• @Leon Heller: I have no equipment to meassure pulses - but like i said, it works like this yoctopuce.com/pubarchive/2013-01/impulse_counter_1.jpg (phototransistor is parallel to led and resistor, so its connected with one pair wire) Apr 4, 2013 at 15:29

You don't want a "frequency to voltage" conversion. That tends to be tricky, error prone, and generally a hack of a solution.

What you really want is to run the pulses directly into the MCU and measure the frequency directly.

Here is an app note on exactly how to do that with the AtMega MCU's. How you actually do it with the Arduino software is something I can't answer.

AVR205: Frequency Measurement Made Easy with Atmel tinyAVR and Atmel megaAVR

• Apparently, I stand corrected. Apr 4, 2013 at 18:21
• @angelatlarge <grin> :)
– user3624
Apr 4, 2013 at 19:25

Without specs, we don't know if there's a one-shot making 3us(?) pulses twice per revolution (based on the mechanical diagram) or the pulse entirely controlled by disk cutouts. But what you can count on is two pulses per revolution.

It's unlikely that the pulse frequency would overwhelm an Arduino (if it does, you've got bigger problems than electronics!) so you could count pulses in a simple loop. Take a f'rinstace: a 1KHz pulse train means 1ms interval between pulses. Remember, we're just counting them, not measuring them, so a grossly inefficient loop could certainly keep up with it. 1000 Hz would imply an anemometer speed of 500 RPS = 30000 RPM! Your anemometer would disintegrate before then.

So pulse counting won't be a problem. You can decide whether you only need the Arduino to count pulses or to do some heavier processing with the result.

In the latter case, read the the data sheet about counter-timers (chapters 15-17 for the ATmega328p, f/ex). By using a counter timer, the hardware will count for you while your program only has to read the counter value every so often to find the speed, and its entire processing power is available for whatever else you want to do with the data.

There is some confusion here so I looked at the picture linked to by the OP(below)

If the duty period of "something" is 3us then it just can't be caused by the gaps in the spinning wheel - it has to be that the led is pulsing as a means of providing a counter-measure to normal sunlight getting in. That's the only explanation I can think of.

Given also the assumption that the LED is driven with an asymmetrical duty cycle up to possibly 100 times the mark period, it might be feasible to construct a circuit that converts the pulse trains into a positive voltage and when the opto is "shut" it returns 0V. Maybe something like this: -

Therefore I would (given all the assumptions and reading between the lines) propose that the photodiode in the opto-coupler is buffered with a transimpedance amp and then its output feeds a conventional AM detector built around a diode, resistor and capacitor. This output then feeds a comparator/data slicer and is then suitable for an Arduino input

To make things less hardware intensive on the analogue side the pulse train from the transimpedance amp could directly feed an Arduino input and the software can "construct" a demodulated version which can be counted.

The counter would be two pulses per rev (assuming the picture is representative) and this should translate to wind-speed. I say "should" because there is likely to be a non-linear relationship between wind-speed and rotational speed. Good luck with this project.

• At hurricane-force winds, assuming the wheel to spin at windspeed, a 1mm slit will take 0.008uS to pass, according to my back of the envelope calculations Apr 4, 2013 at 20:26
• @angelatlarge - they don't look like 1mm slits to me - i think the opto is positioned over the long slots. Hey it's a 2D versus 3D thing!!! Apr 4, 2013 at 20:49
• Sure, but that means a 35cm slit will give you 3uS pulses in a hurricane, assuming my math is correct. Just sayin' that 3uS doesn't seem insane without the LED pulsing. Apr 4, 2013 at 20:53
• If the slit/slot is 1mm wide and it is at a radial distance of (say) 10cm, the circumference at this distance will be about 630mm and this means, using 0.008us per mm, 360 degrees converted to time = 5.04us or 200,000 revs per second. I'll give ya ten minutes to figure out where ya went wrong LOL Apr 4, 2013 at 21:02