"Data Slicer" - opamp too slow, or ... what else? - Page 1
Forum section: electronics / projects

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: June 08, 2014, 02:13:07 am
content: This is another case of the real world disagreeing with LTspice ;-)I'm playing with en-/decoding manchester code and related.The circuit above uses the RC lowpass at the inverting input of the opamp to have a running average of the signal (red curve), to roughly have a center point (moving "zero") to compare the sinusoidal signal swinging around it (green curve) to.The source signal is a wave file, recorded from a cassette tape recorder (ancient technology alert!) via soundcard, previously the soundcard stored this waveform on the tape.(it's software generated. Generally what I've done so far seems to work, e.g. using FSK modulation with 9k6 / 4k8 Hz I repeatedly successfully read a well known message about bushy tailed animals leaping over rather lethargic ones on a MCU board using timer inputs)The opamp produces a nice enough trigger signal here in spice, and the transistor afterwards makes the edges steeper (output not shown)In the real world, though, some of the pulses are too short for the opamp output to even reach 4V, some are below 1V or so, for the voltage just rises too slowly.The opamp used in the real circuit is an LM358 (the only single supply / GND rail thing I have laying around, next to 324 *cough*).Is that already the problem, is the opamp just too slow for this? (clock rates of up to 9600 Hz are currently used).Or is it badly chosen component values... I'm not very experienced with this.

author: Odysseus
author_rank: Regular Contributor
timestamp: June 08, 2014, 04:16:43 am
content: Yes, the LM358 (or any opamp) is a poor substitute for a comparator when switching speed is important. Once an opamp's output saturates at the supply rails, it requires a significant amount of time to recover. This behavior, known as saturation recovery, is sometimes referred to "sticking" and it's severity varies between parts.Use the correct spice model (obtained from TI and zipped with a symbol for your convenience) and you'll see similarly poor behavior. Simply extract the files into the same directory as your schematic, and the part should appear in the component browser under a different "Top Directory".

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: June 08, 2014, 12:20:25 pm
content: Thanks! I'll try.Comparators. I know I ordered some last week (also ancient LM339).I'm afraid it said something of "spain" on the eb*y page, though, so it'll be a few weekends in the future... *sigh*

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: June 08, 2014, 06:48:56 pm
content: Btw, would this thread be better placed in "for beginners" ?I wasn't sure where to draw the line, what's a beginner, what sort of beginner... "what is a resistor" ... "traps of using opamps / comparators"? ^^Anyway.For the case that some other semi-noob gets here one day, sitting at home on a weekend, decked in op-amps but not a single comparator in da house:I've cobbled something together with transistors which works faster. (you always got transistors, right?)The schmitt trigger circuits found on the net usually aren't designed to take a reference voltage, like my moving average here... So I tried to add that and it works at least in spice ;-)Gonna update when built & tested.UPDATE:Some corrections to the schematic in the attachment:+ from the opamp output to the two 47k resistors, do not couple directly, but instead with a 10n cap.+ add another 47k resistor to the net where the others two 47k Rs meet, with the other end going to "VccHalf" (which is actually more like 1.8V since I, as visible, removed one of the originally 4 diodes, compensating output swing of the LM358 compared to the LT part I was using in spice before)+ C5 should be 47n instead 2n2+ R14 should be 10k instead 470k+ ditch R18 (the 470k on Q1 base)With the old values the DC offset and too small R14 prevented proper hysteresis working and a too, eh, "hysterical" output ^^This circuit now works nicely (as in, I built & tried it) to transform a manchester encoded signal of ~ 9600 Hz into a proper square wave "bit stream".The not-quite-square signal (due to frequency response of the medium) coming from a source which has a falloff at 10kHz of -3 dB, and then goes about 24 dB/octave downward (like my damn old magnetic tape recorder).

author: Fank1
author_rank: Regular Contributor
timestamp: June 08, 2014, 07:38:16 pm
content: Look at NE592 data sheet, it just might be what you are looking for and it's cheap.

author: TinkeringSteve
author_rank: Frequent Contributor
timestamp: June 09, 2014, 01:39:08 pm
content: Hi Frank, for this here I'm not going to need that - but good to know that part anyway, it's quite fast, nice!Btw., I updated my previous post.