Function generator - signal quality opinions? - Page 1
Forum section: electronics / projects

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 12:14:34 am
content: I'm still working on my analog function generator. (My goal eventually is to put it together as a PCB + BOM + manual with full, instructional "theory" sections as a beginners' "lesson kit").Currently, this is what I'm getting out of the VCO. I could possibly completely scrap the design and start over and get something a bit better, but this is the best signal I'm able to get with the current design. The top traces are my oscillator, and the bottom traces are, for comparison, the output of my old Simpson function generator at a similar frequency. Clearly, the Simpson is no better than mine, but I'm still not 100% happy with it.I may be able to get it alittlebetter - part of the distortion is adjusted with a trimmer capacitor, and my "trimmer" is currently a couple twisted wires that I move with my hands.... so I make no claim of having used the proper tongue angle.What do you all think? Should I expect a "perfect" triangle wave at upwards of a megahertz, or is that acceptable?Apologies for the shitty photos...

author: sub
author_rank: Regular Contributor
timestamp: September 22, 2013, 01:17:44 am
content: They look suspiciously like reflections---does the time between the two peaks vary with frequency?Edit: Actually, time between them is a touch too long, unless you have 5m of coax connecting your generator to the oscilloscope.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 01:30:32 am
content: Nope, just a P6137 clipped onto the buffered output.The time between the two peaks is pretty constant. Theamplitudeof the glitch is inversely proportional to the size of the integrating capacitor, so my guess is that there is some constant-charge nastiness from the control signal being coupled onto the integrating cap two different ways, and the propagation delays of the two paths are slightly different.On the next frequency range down (470pF / 200kHz) it's almost invisible on the CRO and quite small on the DSO (fades into the noise without significant averaging).I can try playing with the FET buffer stage a bit, in case some of it is from the non-constant load at the comparator input.I'll probably follow the triangle-sine converter with a steep low-pass filter set just above the top frequency to at least nip it out of the sine.I will attach a schematic in a bit.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 01:39:36 am
content: Here's a schematic. It's a bit rough, this is the version I made the quick prototype board from (I did update it to include my various bodges, though...)

author: dannyf
author_rank: Super Contributor
timestamp: September 22, 2013, 02:43:07 am
content: QuoteThat would be a function of your design.QuoteThat would be a function of your intended application.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 02:52:28 am
content: Well obviously... but sometimes when a single person is working on a project, designs get revised. I was just wondering whether people thought it was worth the trouble to try to clean it up more. It's clearly acceptable to some people, since the performance roughly matches that of a commercial function generator, and I wasn't sure whether I wanted to put in the extra work to go beyond that.I'm sure with lots of time and hard work, one could generate a 50 MHz clean triangle wave. But if 99% of people agree that 99% of the time they'd have no use for such a thing, I won't bother.My suspicion is that above 100 kHz or so, nobody really uses triangles and I just need to make sure sine and square are clean. But I wanted to check with people before I went ahead with this.

author: w2aew
author_rank: Super Contributor
timestamp: September 22, 2013, 03:37:39 pm
content: Quote from: c4757p on September 22, 2013, 01:39:36 amI didnt do a full analysis of your design, but I do have a question after a cursory look. What are you doing with Q4 and Q5 at the bottom of your integrating cap? Why aren't you simply leaving it at a fixed bias (GND, etc.)? Seems like that might mess around with your peaks and valleys, since it looks like it messes with the reference side of the integrating cap each time the comparator toggles the current source/sink diode bridge/switch.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 03:43:01 pm
content: Without that block, the comparator output couples through the diode bridge a bit and distorts the signal, shifting each half-period up and down with the square wave output. Those invert the square wave and add that in an equal amount to offset it. (An ideastolen frominspired by the 3312A.)You can see the distortion I'm talking about in the output from the Simpson, which does nothing to fix this.I had the same suspicion (figuring that the inverted square wave would have a slight phase offset), but I completely disconnected that block (removing CV1 and R28) and the double peak didn't go away. (It does do its intended job quite well, though)Another thing I investigated was whether there was some problem caused by coupling noise into the power supply (as you can see, the integrating cap goes to -15V, not ground). Nope, connecting it straight to ground doesn't fix it either. (The reason it goes to -15V is to allow polarized caps to be used for the very slow ranges)

author: sync
author_rank: Frequent Contributor
timestamp: September 22, 2013, 04:07:16 pm
content: For comparison I make some photos from an enertec schlumberger 4433 analog 20MHz function generator.When I build my dummy load with a darlington transistor I found that it's working better with a base resistor. It's basically the same circuit as your current sources.Are the TL071 fast enough? Or it doesn't matter?

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 04:17:23 pm
content: Well, that is definitely much better than mine! Hmm...The TL072 shouldn't have to be fast, as long as it is slow enough!The current from the transistors is a function of the base voltage, so as long as that stays reasonably fixed, the current should as well. There's always current flowing through both sources, so as long as the feedback capacitors are there and the op amps don't try to follow every tiny little glitch, they should be able to keep up with anything within the frequency response of the transistors.All the various function generators I looked at also used slow op amps for the current sources, except the aforementioned 3312A which uses a somewhat more complicated circuit with a bunch of discrete transistors.

author: w2aew
author_rank: Super Contributor
timestamp: September 22, 2013, 04:19:46 pm
content: Quote from: c4757p on September 22, 2013, 03:43:01 pmOk, got it. I wonder if it has something to do with charge storage in the switching diodes. Hmmm. Also, be careful with large polarized caps for the slow ranges - dielectric soakage in aluminium electrolytics will distort the waveform.For what it's worth, I've never had a need for a triangle waveform faster than a few MHz. Sines, squares and pulses - yes. But not really triangles. Although, sawtooths are a different story, and might also 'hide, the double peak.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 04:28:19 pm
content: Quote from: w2aew on September 22, 2013, 04:19:46 pmYep, I saw that. The larger, the worse.The current is pretty low, so the capacitors don't need to be huge for even very slow frequencies - in the final version, I may move that back to ground and use film caps for the high ranges, since they don't need to be ridiculously large (and expensive).Quote from: w2aew on September 22, 2013, 04:19:46 pmThe sweep generator will have a pretty versatile sawtooth oscillator, a bit easier to work with for typical sawtooth applications because of the different controls (precision thresholds which are independently variable). I may investigate the possibility of increasing its frequency up to the same frequency as the rest of the function generator, then give an option to bypass the main VCO and feed the sawtooth to the output amplifier instead.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 04:33:08 pm
content: Hmm.... possibly a simple fix:What if I just increase the current and the integrating capacitor, both roughly tenfold? I did say that with a 10x higher capacitor, the distortion was lower!I think I investigated that earlier and found that the current source transistors got undesirably hot. I may have to just answer that with a good, solid "screw it" - it's an analog circuit with lots of discrete parts, of course it's not efficient!(That LM7171 gets quite warm anyway, so efficiency was gone a long time ago...)

author: w2aew
author_rank: Super Contributor
timestamp: September 22, 2013, 04:35:12 pm
content: The smaller your charging/discharging currents are, the more effects you'll get with charge injection from the switching diodes, no?

author: sync
author_rank: Frequent Contributor
timestamp: September 22, 2013, 04:36:07 pm
content: Quote from: c4757p on September 22, 2013, 04:17:23 pmIs the current reallyonlya function of the base voltage? There is a VCEjump when switching. Have you look at the voltage drop of R18, R19 + R29? Are they constant or are there transitions while switching?

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 04:39:10 pm
content: That was close to next on my list of things to check, after I'm done drudging through my homework... The behavior was pretty good in SPICE, but, as we all know...(Maybe I shouldn't be posting about this while I've got homework...)

author: dannyf
author_rank: Super Contributor
timestamp: September 22, 2013, 04:52:41 pm
content: QuoteOutside of power engineers (pwm generation), that's probably true.What you may want to check is if there are other issues at work that contribute to the weird triangle waveform - it is too unclean to stop looking into it now.

author: sync
author_rank: Frequent Contributor
timestamp: September 22, 2013, 05:18:40 pm
content: Quote from: c4757p on September 22, 2013, 02:52:28 amDo you want to use a sine shaper? Then the fidelity of the triangle should matter, right?

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 07:32:43 pm
content: Yes, and that's what I'll look at next. Those peaks are very quick, I'm hoping that a bit of filtering on the output of the shaper could smooth them out.But now I am leaning towards redesigning the VCO.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 10:07:00 pm
content: Quote from: sync on September 22, 2013, 04:36:07 pmBingo!This is just a quick measurement I took for now, I have to leave the house and don't have time to really try to fix it. (But it gives me time to consider how I want to do that!)The top trace is (inverted) -513uA/div charging current. Yep, that's a huge spike. I think I'll confirm this is the source of the problem by replacing the current sources with simple resistors and seeing if the behavior changes to match a resistive profile.I wonder if a small choke could help smooth it... or if that would cause back EMF issues... I can't try it in SPICE, because every time I try to add anything inductive to this circuit, LTspice bitches about singular matrices... so I'll have to wait until I get home

author: dannyf
author_rank: Super Contributor
timestamp: September 22, 2013, 10:11:49 pm
content: QuoteWhenever you put capacitance / inductance on the output, you are asking for trouble.

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 10:15:40 pm
content: That's what I figured.Bob Pease's lying computer thinks it's found a solution (or rather, thinks it agrees with HP's solution in the 3312A), so I'll get out the soldering iron tonight when I get back home... (Larger feedback capacitor - 220pF, 1k base resistor, and 10nF to ground from the base)

author: c4757p
author_rank: Super Contributor
timestamp: September 22, 2013, 11:36:39 pm
content: Got home quicker than I thought, so I tried it. It worked... kinda. I think I just need to tweak the values. More on that later.The HP schematic also shows small capacitors on the current sourceoutputs, which I thought was stupid, but I tried it anyway, and I wasn't disappointed by the stupidity. Even 10pF completely lopped off the tops of the triangles. I have no idea why they have those.I tried increasing the current and capacitance like I suggested and it actually gotworse, as well as making the comparator uncomfortably toasty, and reducing the maximum operating frequency.

author: sync
author_rank: Frequent Contributor
timestamp: September 23, 2013, 12:15:22 am
content: I open the Enertec 4433. I looks like it uses two current mirrors connected to the diode switch. Unfortunately I have no documentation. Maybe I will reverse engineer it.

author: w2aew
author_rank: Super Contributor
timestamp: September 23, 2013, 12:29:20 am
content: I wonder if it is due to the collector-base capacitance (miller capacitance) of the current source transistors. If so, then maybe try using a cascode stage for the current sources, if you have the voltage headroom.

author: c4757p
author_rank: Super Contributor
timestamp: September 23, 2013, 12:44:42 am
content: That's a good idea. I don't have the headroom, but I can make it - I have more than enough G-BW in the output amplifier to reduce the signal level in the VCO and boost it back up at output.I think it's time to spin a new PCB. God, I hate doing that.I might play around with replacing the comparator, too. LM7171's not a comparator, it's an op amp, and it won't give a very clean output above 1.5 MHz or so. I used it because it was all I had on hand that would even go that fast. The 3312A uses a discrete-transistor comparator that should work fine, I might do that too.And there's nothing I love more than etching PCBs, other than matching transistor pairs...

author: ElectroIrradiator
author_rank: Frequent Contributor
timestamp: September 23, 2013, 03:49:11 pm
content: Also try using JFETs for Q1 and Q2. The single BJT CCS isn't that great, as you have found out, due to the influence of the base current contribution to the emitter current. A JFET would help with the CCS performance, even when you go cascode. Depending on the emitter/source voltage, you may have to use JFETs with a low pinch-off voltage, though.

author: ElectroIrradiator
author_rank: Frequent Contributor
timestamp: September 23, 2013, 03:55:26 pm
content: Maybe this is Captain Obvious, but remember not to use random junkbox ceramic caps for the low values. A low voltage cap with Y5V dielectric could ruin your waveform, even when run within specs. Use C0G/NP0 dielectric caps for anything tuning/integrating.

author: sync
author_rank: Frequent Contributor
timestamp: September 23, 2013, 04:21:37 pm
content: FYI: This is the Enertec 4433 VCO current source. The 280R emitter resistors are for the highest frequency range (20MHz). The 2.49k for all other ranges. The op amps are LF356. It uses 1N4244 "ultra fast switching diodes" (trr<750ps, C<0.8pF).

author: c4757p
author_rank: Super Contributor
timestamp: September 23, 2013, 05:12:30 pm
content: Thanks for the ideas. Yep, I am using good caps.I tried JFETs in the current source. An N FET in the sink improved the performance. Unfortunately, an N FET in the source predictably degraded the performance, and P FETs are quite hard to come by these days... I'd rather not use parts that are a few months away from unobtainium.Thanks for the schematic! I'll have a look later.Unfortunately, it might be a couple days before I can resume serious work on this - heaps of schoolwork...