Sine/Square/Triangle Wave - Signal Function Frequency Generator 0.1Hz - 200kHz - Page 1
Forum section: electronics / projects

author: doctormord
author_rank: Regular Contributor
timestamp: April 15, 2015, 09:03:59 pm
content: I made a writeup for an easy to build (fully analog/oldschool) signal/frequency/function generator on my website.http://www.360customs.de/en/2015/04/signal-frequenzgenerator-1hz-200khz-sinus-rechteck-dreieck/If you like it, please feel free to help me with the translation.

author: moffy
author_rank: Super Contributor
timestamp: April 16, 2015, 12:01:39 am
content: For Q3 and Q4 you might want to use the matched dual BCM847, the sine shaping distortion figures are very match dependent.

author: richard.cs
author_rank: Super Contributor
timestamp: April 16, 2015, 08:29:10 am
content: Looks good, I might build one.Are you planning to provide the PCB artwork?

author: bktemp
author_rank: Super Contributor
timestamp: April 16, 2015, 08:34:51 am
content: What software did you use for rendering the PCB images? They look almost like photos but are bit too smooth.

author: doctormord
author_rank: Regular Contributor
timestamp: April 16, 2015, 09:58:48 am
content: Quote from: moffy on April 16, 2015, 12:01:39 amWell, the sine shaper implementation is "invented" in 1979, where they got k<=0.5% @1kHz. Several later patens rely on that work (with some advancements) But might be worth to see if a BCM847 will improve the distortion figures, thanks.Quote from: richard.cs on April 16, 2015, 08:29:10 amYeah, no problem. It is done in Eagle 5.1, haven't had the motivation to redo it in KiCAD yet. (As i'm still a bit unhappy with the charge pump inverter, which is supposed to work as expected but never tested on the bench yet. Dual supply works well of course.)The limiting factor is the used opamp at the moment, please see the attached plots. The LMH6644 seems not to be fast enough to handle 200kHz+. I might be a good idea to change the square wave part for a real comparator or flip-flop. But for <=200kHz it works ok. There measurements were done with the first version, so perhaps the new board layout is doing better by design.For the attached plots, please note that they were done AC-coupled, thats why the square wave signal looks "wrong" at low frequencies.Quote from: bktemp on April 16, 2015, 08:34:51 amThis is done in POVRay via modified "Eagle3D" scripts. As this project is no longer maintained, there is only a thread left on mikrocontroller.net (German). I made my scripts available there.Link:http://www.mikrocontroller.net/topic/114555?page=3Regards,doc

author: atferrari
author_rank: Frequent Contributor
timestamp: April 16, 2015, 10:05:45 am
content: Hola DrWRT the picture in the OP, the sine signal appears jagged. Is it actually like that or it is an artifact created by your digital scope? Hope it is the last.While composing this, I've seen the fresh pictures in your second post. With more reason my question stands. And there is a blip at the top peak, isn't it?

author: dom0
author_rank: Super Contributor
timestamp: April 16, 2015, 10:42:15 am
content: That's just feedthrough of the unclean triangle wave, the op amp doesn't seem to be particularly fond of saturated operation.

author: paulie
author_rank: Frequent Contributor
timestamp: April 16, 2015, 12:58:03 pm
content: I'm guessing that 1m resistor on the output of the LM386 charge pump was an April Fools day joke.

author: doctormord
author_rank: Regular Contributor
timestamp: April 16, 2015, 01:43:33 pm
content: It's in there for simulation and current measurement (only in LTSpice).

author: richard.cs
author_rank: Super Contributor
timestamp: April 16, 2015, 03:42:45 pm
content: Quote from: doctormord on April 16, 2015, 01:43:33 pmIn case you're not aware you can use voltage sources set to zero for current measurements in place of a resistor. Though there's nothing wrong with a suitably chosen resistor either.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 16, 2015, 04:46:11 pm
content: The circuit looks very much like a bad implementation of an old school generator. There are a few obvious problems:The output should have a termination resistor (e.g. 50 Ohm), just at the output. Having the Feedback from behind the resistor makes the resistor a bad idea instead of a good one. The resistors directly at the output of the other OPs are similar bad ideas. At least the fast feedback should come directly from the output.The sine shaper would like to have an amplitude proportional to temperature. So distortion depends on temperature.The lower current mirror in the sine shaper should use emitter resistors as well.

author: atferrari
author_rank: Frequent Contributor
timestamp: April 16, 2015, 06:00:37 pm
content: Quote from: atferrari on April 16, 2015, 10:05:45 amHola Dr again,Would yyou mind replying to my question?

author: doctormord
author_rank: Regular Contributor
timestamp: April 16, 2015, 06:28:19 pm
content: Quote from: Kleinstein on April 16, 2015, 04:46:11 pmPlease excuse my ignorance but what makes it "really" bad at all. The sine shaper is refered in some/many patents as shown, (with its minor drawbacks) and not an invention of me.QuoteAre your sure?Regards,Christian

author: doctormord
author_rank: Regular Contributor
timestamp: April 16, 2015, 06:29:27 pm
content: Quote from: atferrari on April 16, 2015, 10:05:45 amYeah, there are some artifacts from the scope, the "blip" seems to come from saturation, i guess.

author: Kleinstein
author_rank: Super Contributor
timestamp: April 16, 2015, 08:19:35 pm
content: The Description of the sine shaper give an optimum Amplitude of 3,25 * U_t. The voltage U_t is proportional to absolute temperature. This temperature dependence is typical of circuits using the nonlinear diode curve. If the temperature is reasonable stable one may live with that. Beside distortion the output amplitude will also depend on temperature a little. An improved sine shaper may use a regulated temperature for that part, or temperature dependent resistors (e.g. R24 and R19 as PT100 and PT1000 (or similar)). A current mirror with discrete transistors should use emitter resistors for more accuracy. Well coupled and matched transistors may work, but two extra resistors are easier.One particular bad point is the output amplifier. At least this is easy to fix: feedback has to be on the other side of R30. One could replace R30 with a short and have 50 Ohms directly at the output connector.With the measured curves, it is not clear weather the distortion is from the generator, or just from the way how the scope is connected. A poor ground connection and the poor output amplifier without termination - may produce such ringing, especially if 1:1 probes or similar are used. Such ringing also depends on layout and power supply decoupling.The low frequency signals just show the effects of AC coupling of the scope, and the ringing is lost by the DSO - it's very likely still there, just not visible. So the bigger trouble may be due to the Scope, though not a DSO artefact, but more likely a ground problem.

author: moffy
author_rank: Super Contributor
timestamp: April 16, 2015, 11:43:48 pm
content: Quote from: doctormord on April 16, 2015, 09:58:48 amIt is very important to have good Vbe matching for Q3 and Q4 otherwise you end up with asymmetry in your sine wave (The offset causes the top half to be different to the bottom half). Jim Williams in his 10Hz to 1MHz oscillator with triangle to sine shaper used LM394 matched pair which have a max Vbe mismatch of 300uv. Hope that helps.

author: doctormord
author_rank: Regular Contributor
timestamp: April 17, 2015, 11:51:35 am
content: Thanks for the input.

author: doctormord
author_rank: Regular Contributor
timestamp: April 17, 2015, 09:47:43 pm
content: @Kleinstein,i must say, that R30 is there do dampen ringing at the output and to limit current for the feedback as it is capacitor loaded. The same is for R33. R34 needs to be sized empirical as i had problems at the first build when not having this resistor in place. It highly depends on the attached wiring and layout. R31 were not a problem for the first build. (square wave is fine)Any suggestions on the emitter r's value?Regards,doc

author: Kleinstein
author_rank: Super Contributor
timestamp: April 17, 2015, 10:23:12 pm
content: R30 looks like it is meant to dampen output ringing, however its just at the wrong place. At least there needs to be an extra resistor at the output to set it to something like 50 Ohms output impedance.At least most OP-Amps don't need the resistor directly at the output like R31 or R33. It may be that they help, if power supply decoupling is poor.Emitter resistors for Q5 / Q6 could be something like 1 K. The value is not that critical, it's just to get a more stable current.Ps. : The photo of the PCB does not even show R30. The output goes directly to the connector.The ceramic capacitors for the low frequency ranges are not that good - expect these ranges to be rather nonlinear.

author: doctormord
author_rank: Regular Contributor
timestamp: April 19, 2015, 09:11:22 pm
content: Nonlinearity would be function of amplitude, AVX/Murata got some fine X7R ceramics with rather low DC-bias-coefficient.