Creating a square wave pulse at the peak of a sin wave

AI Thread Summary
To create a square wave pulse corresponding to the peak of a sine wave, using a comparator for level detection is recommended. This method generates a pulse when the sine wave exceeds a set reference level, allowing for pulse width adjustments through hysteresis or one-shot triggers. Digital solutions, such as microcontrollers or CPLD circuits, can also be effective, particularly by counting zero crossings to time the pulse accurately. Integration of the sine wave can help reduce noise and improve peak detection, while ensuring the output triggers only on the positive peaks. Experimenting with operational amplifier circuits can further refine the desired output.
jmjsilvester
Messages
4
Reaction score
0
Hi all,

I am trying to create a square wave pulse that lasts for a relatively small amnount of time which corresponds (as close as possible) to the peak of a sin wave input of period about 1 second.

The only way that I can think of doing this is via a programmable device such as an arduino to create the signal. I am sure that there would be a clever electronic way that this can be done but I do not know enough about the subject.

I hope that that is clear enough. Can someone point me in a good direction?

Thanks in advanced
 
Engineering news on Phys.org
You can use a comparator for level detection. The output will be a pulse that is only high for as long as the sine wave is larger than the reference level you set on the comparator. You can stretch this pulse out or do other things by adding hysteresis or driving a one-shot with the comparator, but the basic idea is to use a comparator. You just need to be careful how you define your pulse width, level detection, and the problem of noise causing false triggers.

http://en.wikipedia.org/wiki/Comparator
 
Last edited:
jmjsilvester said:
Hi all,

I am trying to create a square wave pulse that lasts for a relatively small amnount of time which corresponds (as close as possible) to the peak of a sin wave input of period about 1 second.

The only way that I can think of doing this is via a programmable device such as an arduino to create the signal. I am sure that there would be a clever electronic way that this can be done but I do not know enough about the subject.

I hope that that is clear enough. Can someone point me in a good direction?

Thanks in advanced

Welcome to the PF.

To reliably get as close to the peak as possible, yes, the best solution will be digital. You can either use a uC as you suggest, or you could make a CPLD circuit to do it. In both cases, you would be counting the time between zero crossings, and using half of that (plus knowing the polarity +/- of the sine wave signal) to trigger your square pulse.

EDIT -- if the sine wave were not so slow (like if it were more like 1kHz), you could do an analog differentiation with an opamp to get a cosine function, and use its zero crossing as your trigger...
 
From an old obsolete analog guy -



if you integrate a sinewave two things happen
1. you shift it 90 degrees so the zero crossing of your new signal coincides with the peak of your original signal .
As Berkeman suggested, and wisely, that is a more friendly condition to detect necause it's pretty independent of variations in amplitude of original signal.
2.You attenuate the high frequency 'noise' that is so troublesome to fast analog comparators.

I'd hand integrated sinewave to a zero crossing comparator and trigger a monostable from result.

A differentiated sinewave will have more noise than it did as un-differentiated. Differentiation amplifies noise. It's basically highpass filtering.
Integrated sinewave will have less noise than un-integrated. Integration attenuates noise. It's basically lowpass filtering.
Only difficulty with pure integrators is keeping them zeroed but a R-C with long time constant relative to sinewave's period does an admirable job of approximate integration...

old jim
 
Last edited:
Thank you all very much for the replies.
I'd hand integrated sinewave to a zero crossing comparator and trigger a monostable from result.

That is a very clever idea and defenitely something that I will look into.

However, I would like to trigger only on the peak of the sin wave, not twice per period. Unless I am mistaken this will trigger every time the integrated signal crosses zero.
 
Try this circuit. It is designed to work on positive peaks only and is adjustable by the pot.
The values of the shunt cap and collector resistor may need tweaking.
The output will require squaring up to the desired length of pulse.
 

Attachments

  • peakdetect1.jpg
    peakdetect1.jpg
    7.5 KB · Views: 767
Last edited:
You said a period of about 1 second. Is this a fixed, known frequency, or will it vary? If variable, what percentage variation from 1 second?

It may be feasible to generate an additional pulse, one of, say, 0.6 seconds, and use this to block that unwanted pulse at 0.5 secs. Otherwise a "divide-by-two" counter could be used to eliminate one out of every pair of pulses.
 
"Edge Triggering" is another option.

When driven from point A this will trigger on falling edge of comparator output and ignore rising edge. You'd choose a simple DC level comparator then, comparing integrated sinewave to zero.

Sooo many circuits, so little time !

http://www.allaboutcircuits.com/vol_6/chpt_8/4.html
45011.png
 
Ah that seems perfect! Thanks a lot jim really helpfull.

(I just found this and was having a little play with it
http://www.falstad.com/circuit/e-555monostable.html)

Must say the whole process does seem quite complicated but it does look like it will do the trick. Now just to have a little play around.
 
  • #10
Build an operational amplifier adder circuit. (sometimes called summing amplifier)
Apply a sine wave from a function generator to input of adder circuit.
Apply pulse from a function generator to different input of adder circuit.
View output of adder circuit on oscilloscope.
Adjust sine wave and pulse to get whatever you want.
 
Back
Top