Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Count sine wave frequency

Status
Not open for further replies.

Ald

New Member
I need to design a circuit that will count the frequency of a sine wave only, from 0 to 900 Hz. I do not need a display, I will have to take the count and scale it and convert it to 5vdc max for output to a micro processor. Right now my concern is the counter. The input signal is from a tachometer.
 
For the counting part, seems like all you need is a squaring circuit (sine wave--> square wave) connected to the input of a counter. Well, plus a 1-second timebase. How accurate does your count need to be?
 
You just need a zero-crossing detector circuit. What is the peak-to-peak voltage of the signal? A simple ZCD would be a resistor to limit the current to the microcontroller pin and then clamping diodes to handle out of range voltages.

By the way, Microchip has an application note that shows connecting mains voltage to a PIC pin and compute the frequency.
 
If you want to convert frequency to voltage then you could use a converter such as the LM331.
 
Hi,

Some good ideas here.

One of the nice things about using the zero crossing idea is that if you use both zero cross points you automatically increase the resolution of the measurement at least a little. For example, with a 500Hz signal you'll actually get 1000 counts, which means when you reconvert back to frequency you'll get a resolution of 0.5 Hz instead of just 1Hz (for a 50 percent duty cycle wave).
In the past i have used counters like 7490 and a one second gate pulse (not one Hertz) to measure frequency, but also went as high as a 10 second gate pulse to increase resolution to 0.1Hz. Better counters work better for higher frequencies like the synchronous clock type counters.
Using a PIC should be quite simple as you can generate all the timing right in that single chip. Just a little external signal conditioning and that's about it. Accuracy will depend on what you use to clock the PIC chip.
 
Last edited:
An option could be to use an A/D input of the microprocessor (if it has one) and count the frequency directly. Saves hardware.
 
A lot of good ideas, the peak-to-peak amplitude is 36.3 Vpp, the problem is the amplitude of the signal of the tachometer also varies with the speed the tachometer is measuring, 0-36.3 Vpp.
 
My original plan was to take the 36.3 Vpp divide it down then rectify and scale it to produce 5vdc full scale that would go to the ADC of the processor. Depending on the rpm of the motor I'm measuring the output would be 0-5vdc, corresponding 0-900rpm. The problem with this is I have to figure out the transfer function math so I can apply the inverse of it to the analog-to-digital converter in the processor so I can recalculate the motor rpm's on a LED display from the 0-5vdc input.
 
The processor, MC68HC12, does have an A/D, but it is my understanding is that it requires 0-5Vdc, that's why I have to do some signal conditioning to convert either frequency or Vpp from the tachometer to match the A/D channel. If there is an easier way I'm all for it.
 
So what's the smallest non-zero output of the tachometer? So long as it's at the minimum signal level required for processing, you can simply clip any higher-level signals (you don't care about the wave shape, only the wave transitions), then use a squarer as I suggested (or a zero-crossing detector, basically the same thing) and count pulses. If the output goes to near zero, you'll lose something at the lower end of the scale (0-X rpm), but hopefully not too much.
 
You could use an op-amp run from a 5V supply as a ZCD, with the tacho output clamped to +_ 0.6V with respect to, say, 2.5V by a series resistor and diodes and feeding one op-amp input, the other input being at 2.5V. That way, any tacho signal of magnitude above a few mV will drive the amp output rail to rail to provide a squared pulse signal to the micro, which just measures the intervals between pulse edges.
 
I'm just a dumb hobbyist (not an EE), but I second carbonzit's and alec_t's approach -- I've used it and it works; it's not terribly sensitive to crappy layouts on a prototyping board. If you have the processor bandwidth to do the counting of transitions, that's probably the minimal hardware way to go. Otherwise, you could use a frequency to voltage converter and put that into the A to D port.
 
I need to design a circuit that will count the frequency of a sine wave only, from 0 to 900 Hz. I do not need a display, I will have to take the count and scale it and convert it to 5vdc max for output to a micro processor. Right now my concern is the counter. The input signal is from a tachometer.

Initially when I read the first post in the thread I assumed a tachometer signal of frequency being 0 to 900 Hz proportional to some RPM. At that point and wanting to send the signal to a processor as an analog voltage my first thoughts were what was posted by crutschow. Use a F/V converter like the LM331 and scale it for 0 to 1,000 Hz = 0 to 5 Volts.

Then along comes this:

A lot of good ideas, the peak-to-peak amplitude is 36.3 Vpp, the problem is the amplitude of the signal of the tachometer also varies with the speed the tachometer is measuring, 0-36.3 Vpp.

So now I see it as a peak to peak voltage between 0 and 36.3 volts (with a changing frequency of 0 to 900 Hz.) = some engine RPM? While I have seen older tach signal transmitters send an analog DC signal proportional to engine speed and seen tach signal transmitters send a frequency proportional to engine speed I have never seen both at the same time? You have an analog signal of both changing frequency and amplitude proportional to engine speed?

I guess I would run it to an op-amp as mentioned just for wave shaping to get at least a frequency that is a constant amplitude. Then run it to a F/V converter.

Even with that, if we scale 0 to 5 volts = 0 to 1,000 RPM the processor in this case using A/D is an 8 bit A/D converter so the best case resolution would be 0 to 5 volts = 0 to 255 bits = 19.60 mV. Since 5 volts would = 1,000 RPM that works out to 5 mV / RPM. Best case is +/- about 4 RPM. Not that is bad but am I the only one confused with the tach signal amplitude and frequency changing?

Ron
 
tach signal amplitude and frequency changing?
If you were using, say, a permanent magnet brushless DC motor, or a stepper, as a tachometer you would get such an output.
 
If you were using, say, a permanent magnet brushless DC motor, or a stepper, as a tachometer you would get such an output.

If I were using a PM DC tachometer I would get a DC level out sans any frequency wouldn't I? The ones I use provide a DC level proportional to the speed. If I spin a DC motor backwards and use it as a tach generator I get DC? I never thought of using a stepper motor as a tachometer.

Ron
 
Last edited:
I guess there are several ways to skin this particular cat. However, it seems to me to be a waste not to use the inherently most accurate aspect of the input here: the fact that the O.P. has a source of pulses that are, more or less, exactly equal to the speed (rpm = frequency). Therefore, as suggested by alec_t, why not just count those pulses? All that's needed is a minimal amount of signal conditioning (squaring). The only real problem I see is the fact that since the tach output voltage is also (more or less) proportional to speed, some measurement at the bottom end will be lost as the voltage approaches zero. (This would presumably also be a problem with F-V conversion.)
 
I guess there are several ways to skin this particular cat. However, it seems to me to be a waste not to use the inherently most accurate aspect of the input here: the fact that the O.P. has a source of pulses that are, more or less, exactly equal to the speed (rpm = frequency). Therefore, as suggested by alec_t, why not just count those pulses? All that's needed is a minimal amount of signal conditioning (squaring). The only real problem I see is the fact that since the tach output voltage is also (more or less) proportional to speed, some measurement at the bottom end will be lost as the voltage approaches zero. (This would presumably also be a problem with F-V conversion.)

I agree, I just don't quite get what sort of tachometer transmitter would send that type of signal? I mean for want of a better word it seems weird to my simple way of thinking. I have seen "A" and I have seen "B" but never a composite of A&B I guess.

Ron
 
If I were using a PM DC tachometer I would get a DC level out sans any frequency wouldn't I?
IMHO, no. As the motor magnets move towards and away from the field winding poles you'd get AC superimposed on a DC level. Depending on the motor construction the DC might well dominate, but the magnitude of both the AC and DC would be proportional to rotation rate.
 
IMHO, no. As the motor magnets move towards and away from the field winding poles you'd get AC superimposed on a DC level. Depending on the motor construction the DC might well dominate, but the magnitude of both the AC and DC would be proportional to rotation rate.

Channel Check, :)

When I talk about a DC Tach Generator I am talking about units like these which I use quite a bit. Units like this I am familiar with are strictly DC and generally a .1 uF cap is placed across them to clean up the brush noise. The AC units I am familiar with do put out a sine wave but rather than Permanent Magnet using brushes they use slip rings and amount to an AC generator. I have two little DC PM brush type motors sitting here so I used one to drive the other and looked at it on a scope. DC is all I see with brush noise. . Now the link does show exactly what you are talking about in the waveforms but the AC component is not really enough to do anything with. I see the AC frequency for what it's worth as a function of rotational speed but the magnitude isn't anything that can easily be used. The idea in a good DC tach generator is to eliminate it. You want a low to no ripple voltage. That is how I see it. Using brushes eliminates the magnet movement towards and away from the field winding poles as covered in the link and how we get DC out of a DC tach generator.

Anyway since the OP has not been back I have no idea how his signal is generated. I am merely saying that what the OP describes sounds strange to me. My main use for DC type tach generators is not really to measure rotational speed as much as the rotational acceleration of a motor getting up to speed under various loads. While AC tach generators using slip rings work great the DC units also do a very good job.


Just My Take
Ron
 
I totally agree a 'proper' tacho is the thing to use, but I was merely suggesting something which, at a push, could be used as a tacho and which might have the weird output the OP described.:)
 
Status
Not open for further replies.

Latest threads

Back
Top