Author Topic: Basic Function Generator help  (Read 3991 times)

0 Members and 1 Guest are viewing this topic.

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Basic Function Generator help
« on: August 04, 2019, 01:23:31 am »
To preface this, yes. I know this isn't a great function generator.  I'm using it just to learn.

In the circuit below. (image 1)  Right now I'm just trying to learn (re use) the first part that creates the square wave. (image 2)





I've set this up on my breadboard, but it does not create a square wave. It sits at a constant voltage.   If the pot is turned all the way to the right, it sits at 25mv.  If I turn it a maybe 25%  of a turn, the op amp comes on and the output sits at 2v.

Now, I've never read anything on how this is supposed to work.  I was figuring that the pot would determine how quickly the 1uF cap charged and once it was charged, the amp would turn off and the cap would discharge and voltage would drop triggering the amp to come back up and recharge the cap thereby creating a sqaure wave.

Well, in my recreation of the circuit.  That isn't happening. 

Question 1.  Am I mistaken that just trying to use the first part of the circuit will create a square wave?

Question 2:  If my assessment is incorrect.  A) how is it supposed to work, and B) do I actually need more of the circuit to get a square wave to function?
« Last Edit: August 06, 2019, 08:47:23 pm by dcbrown73 »
Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: Help me understand...
« Reply #1 on: August 04, 2019, 01:49:26 am »
I'm no Op-amp guru - but the answer to Q1 is: No, you are not mistaken.

What I will ask, however, is what is your power supply setup...?
 

Offline Jwillis

  • Super Contributor
  • ***
  • Posts: 1716
  • Country: ca
Re: Help me understand...
« Reply #2 on: August 04, 2019, 02:20:38 am »
Do you have a dual rail supply?I think It needs to oscillate between the positive and negative to work properly.I could be wrong to.Not an expert either. 
 

Offline Dabbot

  • Regular Contributor
  • *
  • Posts: 192
  • Country: au
Re: Help me understand...
« Reply #3 on: August 04, 2019, 02:46:46 am »
I just built the first stage up. Works for me. ~20Hz square wave.

9.6V supply. Using another LM324 to provide the ground.

Can you supply pics of what you've built?
« Last Edit: August 04, 2019, 02:49:55 am by Dabbot »
 

Offline Brumby

  • Supporter
  • ****
  • Posts: 12298
  • Country: au
Re: Help me understand...
« Reply #4 on: August 04, 2019, 07:50:02 am »
Do you have a dual rail supply?I think It needs to oscillate between the positive and negative to work properly.I could be wrong to.Not an expert either.
Exactly.  Which is why I asked the Op.
 

Online MrAl

  • Super Contributor
  • ***
  • Posts: 1444
Re: Help me understand...
« Reply #5 on: August 04, 2019, 12:19:34 pm »
Hi,

The circuit works roughly as follows.

Say we have a +12.2v and -12.2v power supply and say the op amp is ideal.

When the output goes high, we see +2.2v across the 22k resistor.
The cap then starts to charge higher and higher until it reaches just over +2.2v, then the inverting terminal has a higher voltage than the non inverting terminal so the output goes low.
When the output goes low, we see -2.2v across the 22k resistor.
Now the cap starts to discharge lower and lower until it reaches just under -2.2v, then the inverting terminal becomes lower than the non inverting terminal so the output goes high again.
Now just reread this paragraph.  The cycle keeps repeating.

 
The following users thanked this post: vk6zgo

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Help me understand...
« Reply #6 on: August 06, 2019, 12:52:49 pm »
Sorry for the long delay.  Life interjected itself.

Well on my first test where I posted here.  I was actually using a UA741 rather than the LM324 by accident. 

I've switched that out.  I was also just using a positive rail and ground.   

I've switched out to the LM324 and I'm now using +9v and -9v rails.



I still do not get the oscillation in the circuit.  Actually sometimes I'm getting inconsistent results (very low volages) and I have to kill the power turn it back on to start seeing close to 9v on the pins.  (the PSU is always supplying the full 9/-9v)

Here is an image of the breadboard.

Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline kulky64

  • Regular Contributor
  • *
  • Posts: 61
  • Country: sk
Re: Help me understand...
« Reply #7 on: August 06, 2019, 02:06:09 pm »
I think you have your pot wired wrong. It looks like you go from pin 1 of the op-amp to the wiper of the pot, then from upper end of the pot back to pin 2 of the op-amp. So far good. But it looks like the lower end of the pot is connected through black wire to ground. You only need two connections to the pot, leave one end unconnected. Also you used electrolytic cap between pin 2 and ground. This cap should be non-polarized type, because it sees both positive and negative voltages across it.
« Last Edit: August 06, 2019, 02:09:29 pm by kulky64 »
 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Help me understand...
« Reply #8 on: August 06, 2019, 02:22:11 pm »
I think you have your pot wired wrong. It looks like you go from pin 1 of the op-amp to the wiper of the pot, then from upper end of the pot back to pin 2 of the op-amp. So far good. But it looks like the lower end of the pot is connected through black wire to ground. You only need two connections to the pot, leave one end unconnected. Also you used electrolytic cap between pin 2 and ground. This cap should be non-polarized type, because it sees both positive and negative voltages across it.

Thank you I will take a look when I get home.   Although, I don't think I have any caps of 1uF that are not electrolytic caps.  I have only purchased an electrolytic cap kit and a ceramic cap kit.

What type of cap would be best to use here? 
Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline kulky64

  • Regular Contributor
  • *
  • Posts: 61
  • Country: sk
Re: Help me understand...
« Reply #9 on: August 06, 2019, 02:27:57 pm »
Ceramic or film should work fine.
 
The following users thanked this post: dcbrown73

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Help me understand...
« Reply #10 on: August 06, 2019, 02:45:26 pm »
It's probably just the way the photo is cropped but I don't see where pin 11 (Vee) connects to anything other than the blue rail which, apparently, goes nowhere.  Are the PS connections out of the photo?

I would prefer to connect the two binding posts that create the midpoint together at the PS.  I want only 3 wires leaving the supply, not 4.

I don't know anything about your breadboards but on many of the longer boards, the power rails aren't continuous from end to end.  There is a gap in the middle.  That fact has caught up a lot of new users.


« Last Edit: August 06, 2019, 02:52:23 pm by rstofer »
 

Offline Audioguru again

  • Regular Contributor
  • *
  • Posts: 115
  • Country: ca
Re: Help me understand...
« Reply #11 on: August 06, 2019, 04:57:58 pm »
Photos of solderless breadboard circuits are always a tangled mess of wires all over the place.
In your schematic, the slider of your pot is not shown where it connects to.
 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Help me understand...
« Reply #12 on: August 06, 2019, 06:57:31 pm »
It's probably just the way the photo is cropped but I don't see where pin 11 (Vee) connects to anything other than the blue rail which, apparently, goes nowhere.  Are the PS connections out of the photo?

I would prefer to connect the two binding posts that create the midpoint together at the PS.  I want only 3 wires leaving the supply, not 4.

I don't know anything about your breadboards but on many of the longer boards, the power rails aren't continuous from end to end.  There is a gap in the middle.  That fact has caught up a lot of new users.

I'm not home, but this a picture of the the breadboard I'm using.  I have the red (+9v) / black (-9v) banana plugs jumpered to all the red / blue rails on the board.   



The + and - pins entering the opamp were tested and are at sitting at -9v (blue) and +9v. (red)

Photos of solderless breadboard circuits are always a tangled mess of wires all over the place.
In your schematic, the slider of your pot is not shown where it connects to.

In this picture, the pot's wiper is connected to the output pin while other is connected to the -input.  I've flipped it before too.  I figured since it's a non-polarized variable resister.  It probably didn't matter.

As suggested above.  I will remove the 3rd pin from being connected to the gnd rail (which is sitting at -9v)
Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline Gyro

  • Super Contributor
  • ***
  • Posts: 9508
  • Country: gb
Re: Help me understand...
« Reply #13 on: August 06, 2019, 07:23:21 pm »
@dcbrown73:

A small request. Can you please change your thread title to something more related to the topic, eg. 'Basic function generator'? It's easy to do by editing the title in your original post and might just help somebody in the future.  :)
Best Regards, Chris
 

Offline kulky64

  • Regular Contributor
  • *
  • Posts: 61
  • Country: sk
Re: Help me understand...
« Reply #14 on: August 06, 2019, 08:00:59 pm »
Can you post a picture of the whole setup (power supply, all leads and breadboard) all in one frame at the same time when you get home? So we don't have to guess where things not in frame are connected.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Help me understand...
« Reply #15 on: August 06, 2019, 09:10:31 pm »
As suggested above.  I will remove the 3rd pin from being connected to the gnd rail (which is sitting at -9v)

I missed what you said.

There are 3 wires to deal with: +9, -9 and Gnd.  If you are talking about using one of the 'blue' rails for Gnd, well, that's pretty much what you have to do.  You need 3 rails running down the side; 2 on one side of the board and 1 on the other.  It makes sense to have the + and - on the same strip with Gnd on another strip.
 

Online rstofer

  • Super Contributor
  • ***
  • Posts: 9890
  • Country: us
Re: Basic Function Generator help
« Reply #16 on: August 06, 2019, 09:22:43 pm »
It may not be obvious on the schematic that the output pin of the first op amp is connected to one end of the pot and one end of the 100k resistor.  The 'dot' is a little small.  I didn't try to trace the wiring...

Also, the wiper on the pot is not shown as connecting to one end of the pot.  It is shown just dangling in space.  I think this was discussed above.

 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Basic Function Generator help
« Reply #17 on: August 10, 2019, 02:35:50 pm »
Okay, I rewired the board with short 22 gauge wire, a smaller pot, and I obtained a film cap.  Hopefully it's more clear how it's connected now.

The cap I've had both connected to -9v and not connected (as you see in the picture)



Here is how the power supply is wired.



Now, I actually got it to produce a square wave (once) at close to the supplied voltage, but it was operating at 1hz.  I was expecting much higher.

Most of the time, I'm just seeing a terrible looking sine wave in the mV range sitting right around 60hz which I'm guessing is just AC ripple.

What is weird is I had the square wave.  I turned the output off on the power supply and when I turned it back on.  I started getting the 60hz, mV sine wave.  Without changing anything. 

A majority of the time, I'm just getting the sine wave. (you can see the counter)  I generally have to turn the PSU completely off and come back later before I see the square wave again. 

Clearly something is wrong.  :(
Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline bjbb

  • Contributor
  • Posts: 44
  • Country: us
Re: Basic Function Generator help
« Reply #18 on: August 10, 2019, 02:55:59 pm »
Missing a 'ground' equipotential that would be the return reference.
 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Basic Function Generator help
« Reply #19 on: August 10, 2019, 03:03:56 pm »
Missing a 'ground' equipotential that would be the return reference.

Are you referencing the cap not being connected to ground in the first picture?   

The second picture shows I did connected, it just wasn't connected in the first image.

That begs the next question.  Since the rails are +9v / -9v.  Do I actually require a GND (0v) potential also?

For instance, when I measure the waveform with my scope.  Do I connect the gnd connection to the -9v rail?

It's a bit maddening.  Earlier someone said you need to ensure my rails are +9v / -9v for this to work, but I saw a video of someone powering the entire thing with a 9v battery which didn't produce a -9v rail.
« Last Edit: August 10, 2019, 03:06:01 pm by dcbrown73 »
Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Basic Function Generator help
« Reply #20 on: August 10, 2019, 03:08:44 pm »
It looks like your power is NOT connected properly.
The LM324 pin 4 connected to +9V (red wire in picture) and pin 11 connected to -9V (yellow wire in picture).
The GND (black wire in picture) connected to the capacitor and 22K resistor.  The GND appears to be missing (See 2nd picture).



« Last Edit: August 10, 2019, 03:11:04 pm by MarkF »
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Basic Function Generator help
« Reply #21 on: August 10, 2019, 03:24:54 pm »
Missing a 'ground' equipotential that would be the return reference.

Are you referencing the cap not being connected to ground in the first picture?   

The second picture shows I did connected, it just wasn't connected in the first image.

That begs the next question.  Since the rails are +9v / -9v.  Do I actually require a GND (0v) potential also?

For instance, when I measure the waveform with my scope.  Do I connect the gnd connection to the -9v rail?

It's a bit maddening.  Earlier someone said you need to ensure my rails are +9v / -9v for this to work, but I saw a video of someone powering the entire thing with a 9v battery which didn't produce a -9v rail.

Connect the +/-9V rails to the op-amp only.
Connect the GND of power supply to capacitor, 22K resistor and scope GND.
You need all three connections from the power supply.
« Last Edit: August 10, 2019, 03:26:40 pm by MarkF »
 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Basic Function Generator help
« Reply #22 on: August 10, 2019, 05:11:35 pm »
I've been an IT engineer for well over 20 years (servers, storage, networks, and software development) and I have never had anything that stumped me the way this little simple circuit is while trying to get it to function.  I feel like throwing the entire thing into the fireplace!  I don't have this issue with other circuits I've tried to replicate as a learning experience.

Given I'm not an electrical engineer I'm going to create a legend that will properly explain my terms since I could be naming one incorrectly and I want to eliminate confusion.

If I say positive rail.  I'm talking about +9v rail. (DMM tested to show +9v)
If I say negative rail.  I'm talking about the -9v rail (DMM tested to show -9v)
If I compare the positive rail to the negative rail, I show a 18v potential difference. (DMM tested)
If I say gnd.  I'm talking about 0v rail.  By 0v rail, I mean if tested, it shows +9v compared to the positive rail, and -9v compared to the negative rail. (DMM tested)

The 1uF film capacitor is connected to the 100k pot and the gnd rail.
The normally gnd pin of the 100k pot is left unconnected.
The the negative side of the 22k resistor connected to the voltage divider is connected to the gnd rail. (not the negative rail)

Those are the only two connections to gnd.  I can connect the pot's ground pin to gnd, but someone said not to.

Tested pins of the op-amp as measured against gnd.
  • Vcc: +9v
  • Vee: -9v
  • +input: 11.5mV
  • -input: -18.6mV
  • output: 15.5mV

It seems to me the op amp just isn't turning on and I haven't the slightest idea why.  If I test on everycircuit, if I lower the inverting input below the non-inverting input.  The opamp comes on.   It seems based on the measurement above, the inverting input is at a -29mV potential difference, yet the opamp remains off.

Do I need a pull up/down resistor?

In the picture below.  The PSU jumpers as are follows:
  • Red Banana Plug: +9v
  • Black Banana Plug: -9v
  • Yellow Banana Plug: GND



Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline Audioguru again

  • Regular Contributor
  • *
  • Posts: 115
  • Country: ca
Re: Basic Function Generator help
« Reply #23 on: August 10, 2019, 05:54:21 pm »
A "volume control" has a ground terminal. The pot in your circuit is a variable resistor, not a volume control.
Your circuit is not oscillating maybe because your variable resistor is set to be a resistance that is much too low.
 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Basic Function Generator help
« Reply #24 on: August 10, 2019, 06:14:20 pm »
I was poking around the circuit and measured the resistances way above expected on the voltage divider, so I moved the voltage divider away from the op amp and reconnected everything.  Now I get an (almost) perfect square wave and the pot controls the duty cycle.

Something was off about it, but it seems to be functioning perfectly now.   At least  I know I'm not crazy now...



Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 

Offline kulky64

  • Regular Contributor
  • *
  • Posts: 61
  • Country: sk
Re: Basic Function Generator help
« Reply #25 on: August 10, 2019, 06:23:01 pm »
Try to adhere to regular color coding convention and use black color only for ground connections and nothing else. Now you have mix of black, blue, yellow and red colors in your ground node and your -9V node is all black. Sooner or later you probably blow something up when you will try to measure your signals with scope or frequency counter because you subconsciously connect ground lead to first black wire you spot on your breadboard.
 

Offline MarkF

  • Super Contributor
  • ***
  • Posts: 2550
  • Country: us
Re: Basic Function Generator help
« Reply #26 on: August 10, 2019, 07:06:06 pm »
I was poking around the circuit and measured the resistances way above expected on the voltage divider, so I moved the voltage divider away from the op amp and reconnected everything.  Now I get an (almost) perfect square wave and the pot controls the duty cycle.

Something was off about it, but it seems to be functioning perfectly now.   At least  I know I'm not crazy now...

The trim pot should adjust the frequency.  Not the duty cycle.

https://www.instructables.com/id/THE-SIMPLEST-FUNCTION-GENERATOR-BUILT-ON-A-BREADBO/
« Last Edit: August 10, 2019, 07:07:37 pm by MarkF »
 

Offline dcbrown73Topic starter

  • Regular Contributor
  • *
  • Posts: 111
  • Country: us
Re: Basic Function Generator help
« Reply #27 on: August 10, 2019, 07:23:06 pm »
I was poking around the circuit and measured the resistances way above expected on the voltage divider, so I moved the voltage divider away from the op amp and reconnected everything.  Now I get an (almost) perfect square wave and the pot controls the duty cycle.

Something was off about it, but it seems to be functioning perfectly now.   At least  I know I'm not crazy now...

The trim pot should adjust the frequency.  Not the duty cycle.

https://www.instructables.com/id/THE-SIMPLEST-FUNCTION-GENERATOR-BUILT-ON-A-BREADBO/

Correct, what I was thinking and what I typed were two different things.
Why exactly do people feel I should have read their post before I responded?  As if that was necessary for me to get my point across.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf