Amplified Sinewave to Block

Discussion in 'Analog & Mixed-Signal Design' started by hoefnageltom, Oct 7, 2016.

  1. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Hello Guys,

    I've joined the forum because of a question..
    I am designing a ultrasonic beaconsystem and after a few transistors and mosfets I get a great signal (see picture)

    [​IMG]

    Now is my question is it possible to convert the sine wave from my blue channel to a square wave like the red one? So when the sinewave starts the signal rises and when the sine is stopped the signal has to fall to zero.

    I thought about a Schmidt trigger but that doesn't work with a sine wave of course because it's not continue.

    I hope that some of you guys got a solution for me :)

    Thanks
    Tom
     
  2. AlbertHall

    Well-Known Member

    Jun 4, 2014
    1,935
    383
    The schmitt trigger will convert the sine wave to a square wave at the same frequency, then you can use that to trigger a retriggerable monostable set to a time slightly longer than the period of the sine wave. Each cycle of the input will keep the monostable triggered until the end of the series of pulses.
     
  3. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,535
    1,251
    What you want is called a boxcar, or missing pulse detector, or retriggerable monostable multivibrator. <gasp for air> Start with a schmitt trigger circuit or component (like one section of a CD40106 or CD4093). In front of that put a series diode, and from there have a resistor and capacitor to GND.

    signal source > 1N4148 > R and C to GND > schmitt trigger input

    The schmitt trigger output will change state when the input is large enough to overcome the diode Vf and the schmitt trigger input threshold. If the time constant of the R-C is greater than one cycle of the sinewave, the output will not change back until the sine wave has been gone long enough for the cap to discharge below the schmitt threshold.

    That is the basic plan. There are many ways to implement it. It looks like your sinewave is only about 0.2 V peak, so you will need some gain. An alternative is to use an opamp for the schmitt trigger, where you can set the threshold levels with feedback resistors. Or use an opamp as a comparator to turn your low amplitude sinewave into a 5 V squarewave, then missing-pulse detect that.

    signal source > comparator > diode and R-C > schmitt trigger

    ak
     
    hoefnageltom likes this.
  4. crutschow

    Expert

    Mar 14, 2008
    13,006
    3,232
    Is there a particular limit that you need on the minimum time between the end of the sinewave and the end of the generated pulse?
    What is the frequency of the sinewave?
     
  5. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Thanks for all your replies! I'll to try a few things, I'll let you know! btw never heard of a retriggerable monostable multivibrator before.. What a name:eek:

    @crutschow The two pulses used to be exact the same, only shifted because of the speed of sound. So there is not something like a limit I guess. The sinewave is 40KHz.

    Ohh and I've tried to make a Schmidt trigger with a opamp and I got so much extra noise but I guess it was the kind of opamp (741)
     
  6. crutschow

    Expert

    Mar 14, 2008
    13,006
    3,232
    Below is the LTspice simulation of a sensitive, retriggerable one-shot (monostable multivibrator) using an LM339 or LM393 comparator chip (basically AK's suggested second approach minus the diode).
    The input trigger point is set by the relative value of R5 and R6 (here set to about +100mV peak) which is also the input hysteresis value.
    The one-shot time is set by the RC time-constant value of R4 and C1 (here set to 20μs) which must be longer than one half the sinewave period.

    upload_2016-10-7_9-52-31.png
     
    Last edited: Oct 7, 2016
  7. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Thanks @crutschow ! I'll experiement with this after the weekend, when I got my chips!

    I'll let you know. But looking at the simulation I guess it will work :)
     
  8. crutschow

    Expert

    Mar 14, 2008
    13,006
    3,232
    Well, simulations are always somewhat idealized but it should work, with perhaps some tweaking of values.

    Don't forget to add a 0.1μF ceramic decoupling cap between the chip power and ground pins (not shown).
     
  9. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,535
    1,251
    I am without schematic software these days. Thanks to Wally for the drawing. I didn't get into subtleties like using an open collector output as a rectifier, but that is the winner.

    ak
     
  10. shteii01

    AAC Fanatic!

    Feb 19, 2010
    3,388
    497
    The first thing they tell you on these forums is: DO NOT USE 741.
     
    hoefnageltom likes this.
  11. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,535
    1,251
    Look at the 741 datasheet for either a gain-bandwidth spec or an open-loop gain plot. At 40 khz, a 741 does not have much gain. Also, it does not have a very fast output (risetime and falltime). These combine for poor performance at your frequency.

    ak
     
  12. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Hmm @AnalogKid True story.. never looked it up my bad. On school they've learned me you can use a 741 for almost every application.

    But back to the topic..
    I've made the circuit of @crutschow and there are strange things happening, I think there is something with the grounding.
    This is my signal when 2 probes are connected (red input, blue output after 1st comperator, speaker is on):
    2016-10-10 15_23_56-PicoScope 6.png
    This is my signal when the too probes connected the same way but with the speaker off now:

    2016-10-10 15_29_28-PicoScope 6.png

    So that looks okay, only some modifying will make it work... But when I disconnect one probe my whole output is gone, only zero volts...

    Picture of the circuit is also in the attachments

    Thanks
     
  13. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Sorry already fixed, just a extra 1MΩ pull down resistor made it work :oops::oops:
     
  14. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Yeah this is my signal after the first comperator now with a 2 nF cap to GND and a 10k resistor :)
    2016-10-10 17_25_47-PicoScope 6.png
    The signal after the 2nd comperator is the next problem. This signal is always 4 volt. And when the speaker is on the the following ac signal is added to this dc voltage.:
    2016-10-10 17_24_47-PicoScope 6.png

    This ac voltage is only there when the speaker is on. I guess it has something to do with the cap after the first comperator. The cap is decreasing the gain from -200mV to -15 mV pp. So maby I have to build an extra amplifier after the first comperator?

    Thanks
     
  15. crutschow

    Expert

    Mar 14, 2008
    13,006
    3,232
    Looks like you have a grounding problem.
    The signal at the comparator outputs should have no noticeable noise.
    How do you have the grounds connected between the signal source and the circuit?
     
  16. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    @crutschow Yes,
    On the first - input I have 15k pull down. And on the output of the 2nd comperator I also added a 15k pull down resistor the rest is following your schema
     
  17. crutschow

    Expert

    Mar 14, 2008
    13,006
    3,232
    I mean how is the circuit ground connected to the source ground?

    If the circuit is properly built it will not need any pulldown resistors.
    Those can actually mess up the circuit operation.
     
  18. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Ahh, the source is a battery pack total of 8 AA batteries with a step down to 5v. All the grounds are connected to each other with the blue rail on the breadboard and there is a cap of 10uF between 5v en ground (+.1uF parallel). The amplifier before the circuit is based on the following schema (3 times + changing the values)
    Schermafbeelding 2016-10-11 om 18.58.34.png

    Thanks
     
  19. crutschow

    Expert

    Mar 14, 2008
    13,006
    3,232
    Okay, then I don't understand where all the noise is coming from because it looks like a bad ground. :confused:
     
  20. hoefnageltom

    Thread Starter New Member

    Oct 7, 2016
    11
    0
    Okay, Thanks for your advice! I'll try some things and build the circuit on pcb. Maby that will fix the problem. A breadboard is always a kind of noise buffer ;) I'll let you know
     
Loading...