# Measuring AC frequency (48-58V), will this work?

Hi!

I have a question about measuring the frequency of the output of a synchronous generator (3-phase, wind turbine).
The generator is not running yet but I think the voltage will vary between 0-58V (I have a charge controller that regulates the voltage, ~48V when charging batteries and 58V when dump load is active )

My idé is to use one diode as a rectifier and a zener diode to get a regulated voltage. To isolate the MCU I thought a optocoupler would work.
I have never used a optocoupler before and don't know the minimum current to get it working.

I have tried to read the datasheet (http://www.vishay.com/docs/81181/4n35.pdf) but is not sure what to look for.
Where can I see the minimum voltage requered, is it picture i4n25_06? Then 0,5mA is not enough?

Is the zener diode in my circuit unnecessary? (se attached picture)

Properly you know a much better way to measure the AC frequency!

/Olof

You don't need to regulate the voltage for the opto input, just rate the resistor so that you don't exceed the current limit at peak.

I think that these

are a better all-around deal.

I think I have some H1AA1.
So I just use one H1AA1 and a resistor :), much easier.

I will use a 10K 0,5W resistor and see how low voltage I can measure the frequency of.

olof_n:

I think I have some H1AA1.
So I just use one H1AA1 and a resistor :), much easier.

OK, I'm going to be a real stickler for accuracy [a/k/a "a pain in the neck sometimes"]: It is an H11AA1.
There is an H11A1, only one 'A', but that's something else.
If there's a H1AA1, that's probably different, too.

Which shows once again why you should be very careful about spelling and case in electronics.

Stickle away.

The minimum voltage, is what it takes to make the led inside work, which should be the same as any other led, around 2 to 3 volts.

Actually, most optocouplers use infrared LEDs, and so only drop about 1.5V across the input LED.

Thanks for the warning.
I just misspelled the component, checked my "component trays" and found ten H11AA1.

What about minimum current to drive the IR-led? More current on IR-led = more current on the transistor base?

Looking at picture ih11aa1_06 in the datasheet.
Say I wanted to pull 20mA on the transistor side, should I then (looking at the picture) power the led with 30mA if the temperature is 25 degree?
Do I interpret the datasheet correct?

Sigh... wrote a few paragraphs about the 4N35, then remembered you are switching to the other chip.

The transfer ration is guaranteed minimum of 20% (page 2 near the bottom). But also specified for saturation at 10mA LED current, 0.5mA transistor current.

So 10k with 5V is right. 58V AC, 10k works, but so would 6.8k. The maximum current in the LEDs is +-60mA, but you should not go to close to this rating.

Since the H11AA1 has antiparallel input LEDs, you don't need any kind of reverse protection diode.

So if I wan't to measure the frequency of a variable voltage between 10-58V then I need a 4K resistor.

58V / 4 = 14,5mA (0.841W) * 0,2 = 2,9mA
10V / 4 = 2,5mA * 0,2 = 0,5mA

Or use less current when measuring. Maybe a 20K resistor will work fine without getting interferences.

I really appreciate the help, thanks.

With the output connected a "common emitter" (i.e. the collector pulled up, let's say 10K), the output itself will be a pulse High when AC is at on near zero - on the zero-cross. If it's always High then there is no vac.
Assuming that you're connecting the opto output to an Arduino pin, it shouldn't be sucking so much current as to make the "design" here CTR critical/dependent.
With a 5K resistor (appropriately rated) and 10-60vac, the input current will be 2-12 ma. I really think that that should do it.

Hastening to add that since there is a pulse per alternation, the output will click at twice the line frequency: 50 Hz in, 100 Hz out.

As soon as I get some time off I will test the circuit.
I think I will add a Atmega8, MAX7219 and a 7-seg display to build a very cheap frequency counter.

I think the frequency should be the same as the wind turbine rpm. Guess I should not assume things like that when I have no training in electronics

olof_n:
The AC frequency should be the same as the wind turbine RPM I think.

Huh?? frequency = pole-pairs * rpm / 60

Not really any advantage by using the H11AA1 as zero-crossing detection is not required. Note that the 4N35 circuit would produce a pulse with a little less than 50% duty. Measuring the timing from pulse edge to edge would be just as accurate and it would easier to detect the rising or falling edge.

The H11AA1 zero-crossing impulses with very short duration and 2 impulses/cycle would probably require the use of interrupts in your frequency measurement code.

8.33ms instead of 16.67ms hardly seems like it would require a change to interrupts. I would average a number of readings to take care of variable latency, and ignore pulses wildly out of bounds, timewise.

8.33ms instead of 16.67ms hardly seems like it would require a change to interrupts. I would average a number of readings to take care of variable latency, and ignore pulses wildly out of bounds, timewise.

Either chip would work, but the "impulse" duration from the H11AA1 would be much less than 8.33ms. I don't mean the impulse interval of 8.33ms, I mean that its duty cycle would be very low. If its 0.1%, there would only be 8.33 µs time to catch the pulse. Without interrupts, pulses could easily be missed (depending on the user's code).

Good point.

I already have good code to count frequency. I made the code for my function generator.
Basically I use interrupts and timer1 to count the time between pulses.

If the frequency exceeds 800Hz I change method to "pulses over time" because it works better for higher frequencies.

Back to the topic. Diode + 4N35 or H11AA1. It doesn't matter both work but the diode + 4N35 generate fewer interrupts.

dlloyd:
Not really any advantage by using the H11AA1 as zero-crossing detection is not required.

You're right, it's not. So what?