Inverter oscillator radically changes speed on SMD PCB vs on breadboard, why? - Page 1
Forum section: electronics / beginners

author: Infraviolet
author_rank: Super Contributor
timestamp: August 30, 2023, 02:30:35 pm
content: I've set up a not gate (74HCU04D) based relaxation RC oscillator, tuned for 3.2MHz, it worked perfectly on breaboard with a 100pF cap and a 3K3 resistor with a 390 ohm in series of adjustment (Please ignore the slightly different resistor values shown in the upper part of the schematic, it was made before I'd selected 3.2MHz as the desired freq for the design. Ignore also the inverter's part number in the schematic, it is in reality a 74HCU04, the unbuffered more analogue version, in both breadboard DIP and PCB SOIC.). The pair of 2K7's are a voltage divider on the advice of the Horowitz and Hill book to prevent high capacitor voltage spikes entering gates, they say they are strictly necessary if the overvoltage curent was limited by resistors, but adding them seemed a sensible move.But I ordered a PCB, soldered all the parts on (SMD 0603 res and cap, SOIC inverter) and now this version is oscillating at 4.55MHz. My cap is <5% tolerance, my resistors 1% tolerant, so the difference in frequency is well outside tolerance. My power rail voltage is the same, but even if it wasn't earlier tests I did showed that varying this didn't vary the frequency this much. I know breadboard gives you extra capacitance between the rails, so would act like an extra cap parallel to the 100pF, slowing things down there, but rail-rail capacitance on breaboard is <10pF I hear.What has made the osc so much faster on PCB? I'm going to change the SMD resistors to get it down to the speed I want, but then also build another copy of it and see if it is a dodgy component in terms of the the particular cap and particular inverter IC on my initial SMD board, or if it is the design.P.S. no components smaller than 0603 sized, traces are short and 0.2mm width. Rise times of the square wave after the buffering inverter gate are fairly steep, some rounding at the tops and bottoms, time of the steep middle part is <10ns I think, but I'm not at my scope bench right now to double check my memory of that.Thank you

author: RoGeorge
author_rank: Super Contributor
timestamp: August 30, 2023, 02:46:12 pm
content: Some types of flux residues are quite conductive.Was the PCB cleaned after soldering?If not, that would be the first test to do.

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 30, 2023, 02:51:51 pm
content: Just because... You should never design a RF tuned circuit in a breadboard.I guess you took the empirical method.The breadboard adds capacitance everywhere because of the strips.You removed all that stray capacitances so now your RC runs faster.Anyways the proper way would be to make a quartz oscillator with a 16 or 32MHz xtal, then divide it by 5 or 10 with more TTL circuits, it will be a lot more stable and precise.The RC oscillator you're using will drift a lot with temperature changes.

author: Terry Bites
author_rank: Super Contributor
timestamp: August 30, 2023, 03:14:40 pm
content: Waifs and strays on your track.

author: tggzzz
author_rank: Super Contributor
timestamp: August 30, 2023, 03:38:37 pm
content: Yet another example why solderless breadboards are the work of the devil that cause you to spend more time debugging the breadboard than your design.FFI about alternatives, seehttps://entertaininghacks.wordpress.com/2020/07/22/prototyping-circuits-easy-cheap-fast-reliable-techniques/

author: Infraviolet
author_rank: Super Contributor
timestamp: August 30, 2023, 05:55:01 pm
content: Solder was Leaded 60/40 with a Rosin flux, branded as a "no clean" type, but I had cleaned with IPA spray and a small brush before testing the board. I do wonder if the point where that trace runs straight under the middle of the adjustment resistor could be adding an extra capaictance? It's a truly tiny area, but the trace will be vertically very close to the resistor.P.S. I'd be very satisfied with anything that keeps frequency to within +/- 150KHz of 3.2MHz, I doubt I need the extremely tight parts-per-million tolerances of quartz for this?

author: Kim Christensen
author_rank: Super Contributor
timestamp: August 30, 2023, 06:22:18 pm
content: Quote from: Infraviolet on August 30, 2023, 02:30:35 pmQuote from: Infraviolet on August 30, 2023, 05:55:01 pmSince the circuit now oscillates at a higher frequency (4.55MHz) than before on the breadboard (3.2MHz), this means you havelesscapacitance on the PCB. As others have said, plugin type breadboards add a lot of capacitance between "traces"... Have a look at how a breadboard is constructed, and you'll see how the contacts make "nice" capacitor plates:

author: JustMeHere
author_rank: Frequent Contributor
timestamp: August 30, 2023, 06:40:19 pm
content: Breadboards are full of stray capacitance. Also inductance. I quit using them and willing to wait for my $5 prototype board to show up from China.

author: JustMeHere
author_rank: Frequent Contributor
timestamp: August 30, 2023, 06:44:00 pm
content: Quote from: tggzzz on August 30, 2023, 03:38:37 pmI spent a week learning this lesson. I'd ❤️ if this was FB

author: tggzzz
author_rank: Super Contributor
timestamp: August 30, 2023, 07:24:39 pm
content: Quote from: JustMeHere on August 30, 2023, 06:44:00 pmCompared to many people, you're a fast learnerSome other people persistently retain their happy delusionsFortunately this isn't farcebook, but I appreciate the sentiment!

author: tggzzz
author_rank: Super Contributor
timestamp: August 30, 2023, 07:25:59 pm
content: Quote from: edavid on August 30, 2023, 07:22:23 pmOccam's Razor rulez. Solderless breadbords: just say no.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 30, 2023, 08:01:49 pm
content: Shrug, I don't have a problem with solderless breadboards. They're certainly handy. Just be aware of their characteristics and limitations.Typical adjacent-column capacitance is 4pF or so. Inductance can be managed with short jumpers and responsible layout. Switching supplies up to a couple 10W and 100s kHz are perfectly feasible, for example (just don't expect to get low CM noise in the area).It's not clear what will be slowing things down so much here; possibly Miller effect, since the capacitance is between output and input of each gate. This increases the propagation delay of the three-gate oscillator chain, which might be important. This should be easy enough to confirm with the oscilloscope.Tim

author: tggzzz
author_rank: Super Contributor
timestamp: August 30, 2023, 08:45:08 pm
content: Quote from: T3sl4co1l on August 30, 2023, 08:01:49 pmThe people most likely to resort to solderless breadboards are beginners, and they won't be aware of their limitations. They are spending all their intellectual energy on understanding their idealised circuit, and don't have the capacity to spare to understand their limitations.Hence it is beneficial (for both "them" and "us") to encourage them to avoid situations where they are more likely to run into "inexplicable" behaviour.QuoteWho knows what his solderless breadboard constructions parasitics might be. With modern digital circuits inductance likely to be more of an issue than (strayordecoupling) capacitance.

author: EggertEnjoyer123
author_rank: Frequent Contributor
timestamp: August 30, 2023, 10:05:58 pm
content: Quote from: tggzzz on August 30, 2023, 03:38:37 pmI use copper tape, an xacto knife, and a 1 sided PCB. Looks like my method isnt on there.

author: Benta
author_rank: Super Contributor
timestamp: August 30, 2023, 10:43:25 pm
content: Horowitz and Hill also point out that this oscillator needs compensation caps to operate properly. But let that lie.A relaxation oscillator would probably be my last choice for MHz frequencies.If you don't like crystals, a phase-shift oscillator (using your 74HCU04s) would be a better option.Generally: lots of parasitics at 3 MHz. A PCB strip board is a much better option compared to the "solderless breadboard"

author: Infraviolet
author_rank: Super Contributor
timestamp: August 30, 2023, 11:29:30 pm
content: I changed the resistors and got it working, a second board built with the same values of components had a pretty similar frequency, so it wasn't deviation of the components responsible for the difernce between breadboard and PCB.The values I had to swap to in the end were not exactly what I would have expected by dividing the present resistance by the ratio of desired frequency to present frequency, swapping in the predicted values (4K7+510) took the frequency rather lower than ideal (2.3MHz). It took some trial and error, but in the end 3K9+470 did it. I also tried separately swapping the cap to 140pF while keeping the 3K3+390 resistance, again swapping to what would be predicted from frequency ratios didn't work, it made the frequency lower than ideal (2.3MHz).Obviously the f= k/(RC) relationship doesn't keep a truly constant k for these frequencies.With corrected values in place the frequency seems stable, and doesn't seem to vary much with temperature either.I know breadboard has a lot of limitations, but it is really useful for quick testing of circuits before you've made enough decisions, about topology let alone exact values, to produce a PCB design. Guess I've learnt not to trust exact values transferring across from breadboard to PCB, can't really see another way round thse sort of things in future short of the same trial-and-erroring on the PCB as I did this time.Regarding the phase shift oscillator suggestion, don't those become very dependent on device characteristics, whereas this relaxation type is controleld by the values of external components?

author: DavidAlfa
author_rank: Super Contributor
timestamp: August 30, 2023, 11:38:10 pm
content: Now heat the capacitor to 50c and watch how your hard work tweaking it goes to the trash!Unless you use a really stable capacitor type.The 74xx will also vary its characteristics.Thats why rc oscillator using this methods are used for KHz frequencies at most in non critical frequency-dependant applications.A xtal oscillator doesn't take much more!Use a common 16MHZ quartz, and a 74hc90 to divide by 5.The 16MHz clock goes to CKB, QD outputs 3.2MHz.It's that simple.

author: Benta
author_rank: Super Contributor
timestamp: August 31, 2023, 12:03:16 am
content: Quote from: Infraviolet on August 30, 2023, 11:29:30 pmIt's the other way around. The relaxation type is very dependent on the IC, the phase shift is not. Both are susceptible to I/O (stray) capacitance at high frequencies.

author: Kim Christensen
author_rank: Super Contributor
timestamp: August 31, 2023, 12:21:32 am
content: Quote from: Infraviolet on August 30, 2023, 05:55:01 pmJust curious. What are you clocking with this?

author: Infraviolet
author_rank: Super Contributor
timestamp: August 31, 2023, 12:59:11 am
content: Turns out my cap is a 1% tolerant, with a C0G/NP0 dieclectric. Any hope or stability with temperature and anything else that commonly varies? My test so far was to let the spare board with just the extra oscillator on it sit in a freezer for a few hours then take it out,apply power and measure the oscillation frequency immediately, and then monitor that freq as it warms to room temp. Looked like it varied only 0.7% when doing this. Unless ofcourse it heated almost instantly the moment it was powered on.What I'm driving? The transmitting coil of a resolver, where the coil has a cap in parallel to let it achieve resonance (at 3.2MHz), when it is in resonance the returned signal is stronger and easier to measure. As it is a ratio of recieved signals used to determine the angle I can cope with being not perfectly at resonance, but if I'm too far away then the returned signals get weak enough that noise effects give greater errors on the angle readings.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 31, 2023, 02:51:42 am
content: How about an oscillator self-tuned to the load?The problem with an RC oscillator is it depends on the input voltage threshold, which can vary with temperature. Generally the thresholds will be matched between gates on the chip, but you don't know in general where the chip will land, or how it will vary with temp.Accurate RC oscillators use comparators (much higher gain, stable threshold), which can get to the... 100ppm range probably, without too much esoterica (just some careful precision). Beyond that, noise floor tends to be the problem I think.Tim

author: tooki
author_rank: Super Contributor
timestamp: August 31, 2023, 10:37:40 am
content: Quote from: JustMeHere on August 30, 2023, 06:44:00 pm(tggzzz and I vehemently disagree on the breadboard issue.)Except that it wasn’t a week entirely wasted. You’ve learned a (very useful) lesson about parasitics, which affect every component and every construction method in some way or another to some degree or another. Had you made a PCB right away, and it worked right away, you wouldn’t have learned this. Especially with RF and other high frequency circuits, parasitics become very important. (By the time one is dealing with frequencies well into the GHz, even things like the weave of the fiberglass in the PCB start to affect your circuit, since the parasitic capacitance varies.) So this is a great introduction into thinking about parasitics in your work.And it’s a great reminder that any tool, no matter how bad or good, has its strengths and limitations, and that it’s important to learn what those limitations are.

author: Infraviolet
author_rank: Super Contributor
timestamp: August 31, 2023, 10:48:31 am
content: "How about an oscillator self-tuned to the load?"That would be nice, I didn't know it was "a thing". That's why I was using this oscillator to drive a transistor which then drives the LC tank load, the oscillator's peak voltage is a bit too high to let near the 5V logic gate. Can you give me some links to some example schematics for self-tuning an oscillator to a load, thanks.

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 31, 2023, 11:00:29 am
content: Assuming the load is two terminals and parallel resonant, simply wire it up in a Colpitts oscillator, and you should be pretty well on your way. Component values of course depend on the resonant network (L, C, R, power level).At worst, the "enterprise grade" solution is a VCO + PLL. This is less annoying than it sounds, as a... well not CD4046, but 74HC4046 might be fine at this frequency, and, it's pretty much everything you need already, just need a power output / inverter (if current isn't much, a gate drive IC alone might be enough, else a bootstrap half-bridge driver and a pair of MOSFETs will do), and some means to sense load current (perhaps a current transformer; a dozen turns on a ferrite core will suffice here). Locking and compensation aren't the potential nightmare they are for full free-running PLLs, as the driven and locked frequencies are identical -- all that varies is the phase shift. I've used such schemes before, at industrial power levels for induction heating power supplies. This is just a high-level overview of course, but if you're familiar with the concepts (AC steady state analysis, voltage and current and phase shift, phasors / complex impedance, etc.), and the general function of a VCO and a PLL, this can be an good introduction to their combined use, I think, or you can look up these items if not.Tim

author: T3sl4co1l
author_rank: Super Contributor
timestamp: August 31, 2023, 11:07:59 am
content: Quote from: tooki on August 31, 2023, 10:37:40 amNot necessarily. Have you seen some newbies' PCBs?On the upside, there's a modest number of people regularly asking on e.g. EE.SE to review their board, and there's a chance that a few of them will have "GROUND PLANE GROUND PLANE" hammered into their heads in the process.I would maintain there's one value of breadboards: if you make a shitty layout, good luck fixing it in hardware (you'd do what, "pour" the whole thing with foil tape?), but you can always re-plug jumpers.The biggest challenge towards which, is probably those damn pre-made jumpers with the pin ends, not even encouraging butenforcinglong arching routes over and between boards. Pushing hand-cut solid-core wire -- to be in the habit of always making jumpers of appropriate length, as needed -- would be a good antidote to that. And, always, always moving things around and trying different things, and measuring to verify what's actually going on, build a mental model.Shrug. I mean, it always comes back to "git gud" in the end. There exists no end of routes to it. Even those containing "Arduino".Tim

author: tggzzz
author_rank: Super Contributor
timestamp: August 31, 2023, 06:36:13 pm
content: Quote from: T3sl4co1l on August 31, 2023, 11:07:59 amOr some "professional" PCBsClassic failure is to have only one GND for a parallel bus going off-board, or if there are several GNDs, they are concentrated at one end of the connector and nowhere near the signals.QuoteBreadboards are good, unless they are solderless. Even rat's nest can be better than solderless breadboards.This is one case where "additive" manufacturing is worse than "subtractive" manufacturing. Best to start with a "complete pour", i.e. an unetched PCB, then either stick on islands where you need to make contact or use a dremel with spherical dental bur to surround an island with a "moat"Manhattan rulez

author: Infraviolet
author_rank: Super Contributor
timestamp: September 01, 2023, 01:30:52 pm
content: T3sl4co1l, any links to examples of which colpitts topology is most appropriate for driving an LC tank where the L and C are parallelto each other and driving is done from the ends (not from centre tapping)? Also, most of the times I've made a colpitss oscillator it relied on an op amp, but what I'm doing here is a bit too fast for the op amps I keep to hand, also at resonance I get about 10V on the end of the LC tank at the peaks of the sine(ish) wave, so I can't be connecting it directly to any 5V parts. My present setup has the oscillator I describe here controlling the base of an NPN low side driver transistor "below" the LC tank's "lower" terminal, which means only the transistor (tolerant to 45V or thereabouts) is exposed to the high voltages. Any examples also of the VCO and PLL self-tuning method? Seeing a diagram of either, tuned for any frequency, would be fine, from that I can work out what I'd actually need in either case for mine. ThanksAlso some posts back, Benta mentioned:"Horowitz and Hill also point out that this oscillator needs compensation caps to operate properly"Just to reply to that, I saw the small cap in the H and H diagram, but in early testing found it caused serious spikes in the waveform on the rise and fall, omitting it meant a much smoother square wave came out. My asumption was that the tiny compensation cap shown in H and H was only applicabe if you were using this oscillator with a much larger main capacitor to give rather lower frequencies than I am after?

author: Infraviolet
author_rank: Super Contributor
timestamp: September 03, 2023, 06:22:15 pm
content: Ok, so I think that somehow the existing oscillator seems fairly stable. I left it in a freezer with a small lump of ice right around the caps,and measured the freqency powering it on seconds after taking it out, and I left it sitting on a 70 celsius (probably more like 55 in reality due to bed material) printer bed, and tested it moments after taking it off. The frequency was very similar in both cases, though varied a lot when the ice began to melt and the damp would have acted as extra resistors parallel to everything. If I touch near the resistors or caps the frequency also varies a lot, my body acting as both a paralleled resistor and some capaitance. But in the abscence of contact with objects it seems stable, perhaps due to the cap being C0G?I think it is probably good enough for the present application? But I really like the idea of being able to drive an inductive coil at resonant frequency in a self-tuning manner, rather than having to set up an oscillator circuit with an R and C to control its frequency to match the coil's and resonant cap's L and C. I've seen some examples of colpitts oscilators using L and C for setting the frequency, but it looks like the voltages and currents actually present in the LC area of these circuits is pretty small, the circuits being designed to deliver large signals just as an output to be fed to other circuit elements. What sort of method can use my existing coil's L and its paralleled cap as an LC tank to both control frequency and create large swing voltages specificlly across that same coil. Using a separate LC to tune an oscillator to then power the coil I want resonance in looks like it would have all the same disadvantages as using an RC tuning in the present manner does.Thanks

author: T3sl4co1l
author_rank: Super Contributor
timestamp: September 03, 2023, 06:57:00 pm
content: Sounds about right. Yes, leakage could have that effect, not to mention dielectric constant of the condensation.I don't have any references handy. Finding references for rudimentary electronics can be tricky, or annoying, especially with Google Search as it is these days. If you search particularly for older references, handbooks, databooks, textbooks, you may find some interesting material. Some classic GE or RCA Transistor Databooks might prove helpful here. There are archives, fortunately:http://www.tubebooks.org/technical_books_online.htmfor example, and archive.org of course.Another thought occurred to me, you may need/want balanced drive. This isn't unnatural or anything, but it will require some design work. Normally, the Colpitts is set on a ratio so that output and feedback voltages (or current as the case may be) are appropriate; to have equal voltages, there might be a matching network from the feedback end of the coil, back to the oscillator; or we might skip that and use a common mode filter to equalize the voltages, which can be completely passive (CMC acting against coil's self capacitance, that is, its capacitance to surroundings, not just what's between terminals), or done with arbitrary "force" so to speak (e.g. using a 1:1 transformer to make a low-Z center point, and CMC-ing to that; or using a wholly isolated transformer; etc.).This requires some design work, so my best advice would be, play around in a simulator, checking node voltages and making adjustments, until it's where it needs to be. Don't forget to "fuzz" against component value variation and temperature ("ambient temperature" can be changed in simulation settings).Power is only a matter of scale. "Oscillator-amplifier" was a common type/test back in the day, and for example a 12AU7 (basically the 2N2222 of its day) is good for a watt or two in class C operation.Notice you don't actually know (or haven't stated) how muchpoweryou need. Presumably there's a load resistor somewhere (far side of the resolver), and if nothing else there is core loss and wire resistance in the circuit. If all you need is voltage and the current is approximately zero, a transformer or even LC matching network can do the job. (Matching networks will skew the resonant frequency (which might not matter by itself), and can introduce more resonances, so have to be used carefully, and probably sparingly. Not that an elaborate network would be needed for this, anyway.) Whether it's convenient (or possible) to also supply the coil more-or-less directly from the supply (i.e., peak or average voltage equal to supply), I don't know, but obviously that depends on the supply as well.You might also find the common "ZVS" circuit (actually a Baxandall oscillator; often erroneously called "Royer" too) attractive. You will need a CT winding (a 1:1 transformer with the windings wired in series), and a large-value choke in series with the supply (large relative to load inductor, that is). The same basic circuit can be made with BJTs (power MOSFETs obviously(?) would be too brute-force here), using a feedback winding instead of the diodes and gate pull-up resistors.Tim