MAX038 Function Generator Design

Thread Starter

adam555

Joined Aug 17, 2013
858
Thanks Richard. I only need help with this last issue, and I think I'm ready to go.

I found the reason for the oscillation in the middle; it's also caused by the active switching transistor, and it depends on the base current. For example:

With a 50k base resistor I get only the top and bottom discontinuities...

WP_20141119_001.jpg

Down to about 12k I still get some discontinuity, plus the oscillation in the center starts to appear...

WP_20141119_003.jpg

And down to 1k the discontinuities are almost gone, but the oscillation gets bigger...

WP_20141119_004.jpg

I have no idea how I'm going to solve it, so any suggestions would be really appreciated.

I also found that there's a relation between the Iin voltage and the discontinuity; the discontinuity only appears when the potentiometer is around the middle position onwards. I'm currently using a 1 M pot with a 10k limiting resistor in series. The pictures above were taken with the potentiometer at maximum (towards the highest frequency of the range).

By the way, I fixed the x10 problem; it was the magnification gain potentiometer that was set incorrectly. Probably my fault for trying to calibrate the oscilloscope when I bought it.
 

RichardO

Joined May 4, 2013
2,270
I still think the oscillation is caused by the power supply voltages sagging at high frequencies and/or changes in loading. A picture of each power supply voltage when the oscillation near ground occurs would be helpful. Also, can you post a complete schematic of your power supply? Make sure that you show how and where the bypassing is done.
 

Thread Starter

adam555

Joined Aug 17, 2013
858
You're right again; thanks. I couldn't see an almost imperceptible voltage drop on both rails exactly at the same point where the middle oscillation appears. I had decoupling capacitors for all the individual components, but none for the power supply itself; so adding a 10uF on each rail solved the problem.

I also lowered the base resistors to 2.2k, as you recommended, and the top and bottom discontinuity is barely visible.

I'm about to order the THS4222D op amp, but since I'm going to build it all in a predrilled board I guess I'll have to use some sort of SOIC to DIP adapter. Any tips or suggestions?
 

RichardO

Joined May 4, 2013
2,270
You're right again; thanks. I couldn't see an almost imperceptible voltage drop on both rails exactly at the same point where the middle oscillation appears. I had decoupling capacitors for all the individual components, but none for the power supply itself; so adding a 10uF on each rail solved the problem.

I also lowered the base resistors to 2.2k, as you recommended, and the top and bottom discontinuity is barely visible.

I'm about to order the THS4222D op amp, but since I'm going to build it all in a predrilled board I guess I'll have to use some sort of SOIC to DIP adapter. Any tips or suggestions?
Good to hear that you found the problem. I was running out of ideas. ;)

A "barely visible" discontinuity may not be good enough. Even a 10 mV step will likely add noticeable sine wave distortion. I would guess that if you put the sine wave into an audio amp and listen to it you will be able to hear a slight difference in the sound between sine waves with and without the glitch.

You can either buy and adapter board or make one yourself. I think that a narrow SOIC footprint will fit inside a DIP footprint so making one yourself should be a trivial circuit layout. Do a bunch of them on one panel and you will have a lifetime supply. I would not bother drilling holes in a homemade adapter. Instead, I would trim the PCB with the edges through the center of the DIP pads. A wire that goes through the pre-drilled board just has to have a slight bend to solder to the adapter pad.

I would recommend a prototyping board that has a ground plane on one side. Alternately, a copper clad perf board could be used. With the copper clad board you use a 1/8" diameter drill bit to isolate holes from the ground plane. You do this by countersinking holes (that are not ground) to allow wires to go through the hole without shorting to ground.
 

RichardO

Joined May 4, 2013
2,270
I said:
"I would recommend a prototyping board that has a ground plane on one side. Alternately, a copper clad perf board could be used. With the copper clad board you use a 1/8" diameter drill bit to isolate holes from the ground plane. You do this by countersinking holes (that are not ground) to allow wires to go through the hole without shorting to ground"

Vector number 4066-4 is an example of a perf board that has a ground plane.

http://www.digikey.com/product-search/en?vendor=0&keywords=4066-4

The ground plane must _not_ have solder mask covering it because the ground leads of the bypass caps and other parts are soldered directly to the ground plane.
I once bought a prototyping board from Radio Shack that had solder mask over the ground plane. A complete waste of my money.

Attached is a picture of an oscilloscope time base calibrator that I built on copper clad perf board.
Note that the components are mounted on the ground plane side.


TB_50.JPG
 

atferrari

Joined Jan 6, 2004
5,012
Hola adam555,

I hate to come maybe (and most probably) too late. Some time ago I built the amplifier shown here. I built it Manhattan (also ugly) style and seemed to work OK. Keep an eye on the -V needed.

And, no surprise, the chip was an 8038.

I was about to build a function generator with one of those AD chips but, with money in hand and hurried, I bought a Siglent which works well. The difficulty of designing the (output) eliptic filter helped in that direction.

Dick Cappels is a helpful person (and has fine and interesting projects).

Hope it could be of interest.
 

atferrari

Joined Jan 6, 2004
5,012
I reread your tests. Started to recall having very similar problems. The less noticeable was that anomaly at 50% but in the peaks it was the same.

Still wondering why I left this uncomplete. (?) :(
 

Thread Starter

adam555

Joined Aug 17, 2013
858
I said:
"I would recommend a prototyping board that has a ground plane on one side. Alternately, a copper clad perf board could be used. With the copper clad board you use a 1/8" diameter drill bit to isolate holes from the ground plane. You do this by countersinking holes (that are not ground) to allow wires to go through the hole without shorting to ground"

Vector number 4066-4 is an example of a perf board that has a ground plane.

http://www.digikey.com/product-search/en?vendor=0&keywords=4066-4

The ground plane must _not_ have solder mask covering it because the ground leads of the bypass caps and other parts are soldered directly to the ground plane.
I once bought a prototyping board from Radio Shack that had solder mask over the ground plane. A complete waste of my money.

Attached is a picture of an oscilloscope time base calibrator that I built on copper clad perf board.
Note that the components are mounted on the ground plane side.

View attachment 76175
I was thinking that if need a ground plane, maybe it would be worth it doing it on a 2 layer board, which I already have at home. I don't have the tools to do it by photo-transfer, and also don't have a laser printer to do it by toner-transfer; so at the moment I have no choice but to print circuits by hand with a marker, or use a predrilled prototyping board. I didn't think I would be able to do a 2 layer board by hand, but if I only need to do one side and leave the other as ground that makes things much easier. I also wouldn't need the SOIC to DIP adapter anymore.

Hola adam555,

I hate to come maybe (and most probably) too late. Some time ago I built the amplifier shown here. I built it Manhattan (also ugly) style and seemed to work OK. Keep an eye on the -V needed.

And, no surprise, the chip was an 8038.

I was about to build a function generator with one of those AD chips but, with money in hand and hurried, I bought a Siglent which works well. The difficulty of designing the (output) eliptic filter helped in that direction.

Dick Cappels is a helpful person (and has fine and interesting projects).

Hope it could be of interest.
Gracias Agustín.

I'm still ordering components, so it's not too late. I'll probably end up using the THS4222D -I found it quite cheap and I would probably have no space to fit the circuit you suggested- but if I have time I'll give it a try anyway while I wait for the op amp to arrive.

I reread your tests. Started to recall having very similar problems. The less noticeable was that anomaly at 50% but in the peaks it was the same.

Still wondering why I left this uncomplete. (?) :(
I'm not sure to what extent those anomalies are related to the use of a breadboard; so I'm looking forward to trying it all in the final PCB.
 

Dr.killjoy

Joined Apr 28, 2013
1,196
I am not sure where you are located at but I have laser I would be willing to print what ever you need within reason just to help you along or maybe someone closer to your locations will donate there printer and time for you .. I can't wait for the final product...



Jay Sr
 
Last edited:

bance

Joined Aug 11, 2012
315
I'm not sure to what extent those anomalies are related to the use of a breadboard; so I'm looking forward to trying it all in the final PCB.
I tend to think of a breadboard layout as more of a proof of concept, the first/second pcb as fine tuning, leading towards a final working solution! don't be afraid to release the genie.

Steve
 

Thread Starter

adam555

Joined Aug 17, 2013
858
I am not sure where you are located at but I have laser I would be willing to print what ever you need within reason just to help you along or maybe someone closer to your locations will donate there printer and time for you .. I can't wait for the final product...

Jay Sr
Thanks for the offer. I tried to print another circuit in my cyber-cafe, and none of the 3 trials I did went too well; so I'm also planning on making a UV exposure box next.

I think I can manage this one with the marker, as it doesn't need small tracks; but the main problem is going to be fitting all the tracks in just one side while trying to use as few jumpers as possible. I already did a 2 layer design a few weeks back, and it was a nightmare.

Anyway, I have around a month to do it while the components arrive.

I tend to think of a breadboard layout as more of a proof of concept, the first/second pcb as fine tuning, leading towards a final working solution! don't be afraid to release the genie.

Steve
I was counting on changing some components in the final board (e.g. the switching transistors, their base resistors, or even the range capacitors) but I hope I only need one PCB; as making them is the part I like the least, and what often slows me down -if I can be any slower than this. :D
 

tindel

Joined Sep 16, 2012
939
Have you considered https://oshpark.com/? They have reasonably priced pwb manufacturing... $5 a square inch. perfect for hobby jobs and first runnings.

I agree with someone's comments... I use the breadboard for proof of concept (which I think you now have)... and the first pwb to fine tune. After fine tuning, the second pwb is usually ready for production.

Good work so far... keep it up! RichardO is a great resource that has done a lot of good high speed design work... I know him personally and he's a sharp guy... I'm glad to see he's helped you along this far...
 

Thread Starter

adam555

Joined Aug 17, 2013
858
Have you considered https://oshpark.com/? They have reasonably priced pwb manufacturing... $5 a square inch. perfect for hobby jobs and first runnings.

I agree with someone's comments... I use the breadboard for proof of concept (which I think you now have)... and the first pwb to fine tune. After fine tuning, the second pwb is usually ready for production.
Thank you for the suggestion. I already looked at PCB manufacturers, and found some quite cheap (e.g. 10 boards 100x100mm for as little as $9.99). However, if I add the P&P to Spain, there's no one that comes under $30. Also, you and bance are probably right when you say I'll need more than one PCB design; and of course, making it myself is probably the best approach in terms of learning; which is the main purpose of this project.

Good work so far... keep it up! RichardO is a great resource that has done a lot of good high speed design work... I know him personally and he's a sharp guy... I'm glad to see he's helped you along this far...
There's no way I would be this far without RichardO. He's not only a great resource and asset for this forum, but he is also as patient as he is kind. I wont forget sending him a cheque when I commercialize it; and another one to Agustin for the switching circuit. :D

Back to the design: I have another doubt...

As I said before, I was planning on adding a digital output (a +5V square wave) on top of the main one. I was counting on using the TTL compatible SYNC output of the MAX038, but besides having to share it with the PIC -which uses it to monitor the frequency- just realized that it's not 0 to +5V, but 160mV to +4V; so I was wondering if it would be good enough, or if I should pass it through another op-amp -which I have on the THS4222D-. If so, which circuit would be better suited to make the output 5V CMOS compatible?
 

Thread Starter

adam555

Joined Aug 17, 2013
858
Last year I used this circuit on the other function generator for the digital output:

Untitled-2.jpg

I tried to adapt it to this design, but I found three problems: I can't reach the +5V due to the transistor, I'm not sure the transistor will work at 20Mhz, and I would need to use the main output instead of the SYNC -it's designed to transform a triangular wave into a square wave but if I use the main output it will have to work with all three output waveforms.

I simplified it to this next circuit, and got rid of the two first issues, but I'm not sure how well it will work; specially since it needs to transform all three waveforms.

Untitled-1.jpg

If anyone has any suggestions or knows any other circuit that I could use -preferably with the SYNC output (TTL 0 to 4V square wave only)- please post it.
 
Last edited:

RichardO

Joined May 4, 2013
2,270
As I said before, I was planning on adding a digital output (a +5V square wave) on top of the main one. I was counting on using the TTL compatible SYNC output of the MAX038, but besides having to share it with the PIC -which uses it to monitor the frequency- just realized that it's not 0 to +5V, but 160mV to +4V; so I was wondering if it would be good enough, or if I should pass it through another op-amp -which I have on the THS4222D-. If so, which circuit would be better suited to make the output 5V CMOS compatible?
An op-amp will be too slow and won't swing to the proper CMOS levels...

What I have used is a CMOS MOS-FET driver like one of these:

http://www.digikey.com/product-detail/en/TC4426CPA/TC4426CPA-ND/115307
http://www.digikey.com/product-detail/en/TC4426COA/TC4426COA-ND/260077

They will run on a 5 volt power supply and, although they are a little slow, can easily drive a 100 ohm load -- 50 ohms internal series terminator and 50 ohm external load.
 

Thread Starter

adam555

Joined Aug 17, 2013
858
An op-amp will be too slow and won't swing to the proper CMOS levels...

What I have used is a CMOS MOS-FET driver like one of these:

http://www.digikey.com/product-detail/en/TC4426CPA/TC4426CPA-ND/115307
http://www.digikey.com/product-detail/en/TC4426COA/TC4426COA-ND/260077

They will run on a 5 volt power supply and, although they are a little slow, can easily drive a 100 ohm load -- 50 ohms internal series terminator and 50 ohm external load.
That sounds good: it isn't expensive, and won't take much space.
 

Thread Starter

adam555

Joined Aug 17, 2013
858
Just remembered that the first circuit posted above was designed with a comparator, not an op-amp.
 
Last edited:

Thread Starter

adam555

Joined Aug 17, 2013
858
Just received most of the components yesterday, and finished designing the layout. I kept the whole top surface for the ground, and used the bottom for all other tracks. I couldn't fit them all, so I'll be using wires for the PIC/LCD data and Control pins, plus another one for the SYNC, which is used by the PIC to keep track of the frequency to be displayed. To all these I added a via next to each pin to solder the wires. I didn't like the SYNC going through a wire, since it's also meant to be high frequency, but I couldn't find an alternative route. I also added a jumper for the op-amp's negative supply. By the way, how do you add these wires in EAGLE; not jumpers only, but jumpers with external wires -like the ones I need-?

Please let me know if there's anyone wrong with the design before I etch and drill the board; I'm sure there's plenty. :p

This is the bottom with all the tracks (PIC on the top left, power bottom left, MAX top right, switching transistors and range caps right under the MAX, control pots bottom right, op-amp in the middle -has to go on the bottom unlike the rest of components so I don't need vias for its tracks-, and that row of pins under it is the LCD):

Untitled-1.jpg

This is the top side with the ground plane...

Untitled-3.jpg

And this is how it should look once finished. The pots are far smaller than what I expected, but at the end I wouldn't have been able to fit it all with bigger ones. I also don't think I'll be able to add that extra digital output that we discussed; I could barely fit all that as it is.

WP_20141128_002.jpg
Kind of looks like a real kit, doesn't it? :)
 
Last edited:

bance

Joined Aug 11, 2012
315
Have I missed it? or have you not posted a full schematic?
It would be useful to compare against the layout.....
 
Top