Needing help determining why this circuit did not work

crutschow

Joined Mar 14, 2008
34,452
Since I already had this circuit on the breadboard, I tried adding the 10k as you suggested (even if the lm741 is not ideal for me) but I'm still getting an analog voltage signal, no square wave and no triangle wave ... it is now just half of Vcc like you said. Why isn't it generating any square or triangle wave signals?
Below is a sim of your original circuit (with 741's and the added 10k) which looks ok.
Double check that the (+) and (-) inputs of both op amps are properly connected. Note that one op amp shows the (+) input on top and one shows the (+) input on the bottom of your schematic.

Sawtooth.gif
 
Last edited:

Thread Starter

gte

Joined Sep 18, 2009
357
Thanks MrChips.

I found this, I believe this is exactly what I need


Unfortunately, there is no schematic posted. Basically he is somehow driving pin5 of the 555 timer (modulation input) with another 555 timer to use analog voltage or current to vary the output pulse width.

Go to 8:55 in part 2


and you can see how frequency is kept the same, but pulsewidth is control with a potentiometer or analog voltage.
 
Last edited:

MrAl

Joined Jun 17, 2014
11,486
Hi,

Actually you dont need a perfect triangle to do PWM with. You can use a humpty back wave like the voltage across a capacitor being charged and discharged. It doesnt even have to be 50 percent duty cycle if you discharge the cap every cycle. So you could use a 555 that charges and discharge a cap through a resistor for example. The wave formed in this way looks like a curved triangle but the transfer function is still very similar to that when using a straight sided triangle. There's a small temporary phase shift involved but it doesnt bother anything because it works in the same direction as the control signal so the transient response doesnt change by that much.
 

crutschow

Joined Mar 14, 2008
34,452
Below is the sim of the circuit with 741's showing the varying PWM output with variation of the pot voltage.
V2 simulates a 4v to 8V output voltage from the pot.

Sawtooth.gif
 

Thread Starter

gte

Joined Sep 18, 2009
357
Thank you, I was able to get it working from that diagram ... I'm not sure why it failed before hand.

So I noticed that pulse width on time gets longer as the voltage goes higher, and I need the opposite of that. I also need it to work from 5v to 0v, can the 741 go to 0v? I think I can add one more inverter to the project to reverse the pulse width vs analog voltage direction.

What do you think? I'm playing with resistor values, but that is not working?

Below is the sim of the circuit with 741's showing the varying PWM output with variation of the pot voltage.
V2 simulates a 4v to 8V output voltage from the pot.

View attachment 72783
 

Thread Starter

gte

Joined Sep 18, 2009
357
Thanks, I remember this now trying to use the lm358 in another project, it would only go down to around 1.7v.

Is there an op amp that can go rail to rail that you can recommend? I ordered the older version of this one below, but it would be nice to be able to get something locally.

http://www.adafruit.com/products/808


Most certainly NO, as already noted by crutschow in #13. An LM358 can get close the lower rail. A 741 can go to "zero", but only if supplied a voltage below zero.
 

crutschow

Joined Mar 14, 2008
34,452
Below is the sim of the original circuit using a single supply LM324 op amp (similar to an LM358) operating from 5V. It's output goes from 0V to 4V. If you need 0V to 5V with a 5V supply then you need a rail-rail type op amp.

The virtual ground voltage from R1 and R2 is set at 2V to be halfway between the maximum and minimum output from the LM324.

I reversed the connections to the output comparator so the duty-cycle now increases with increase in the control voltage. Note that the input control voltage range is equal to the triangle-wave output voltage or about 1.1V to 2.9V.

PWM.gif
 

Thread Starter

gte

Joined Sep 18, 2009
357
Ok, using the lm324, I was able to get everything almost working. Since voltage values were lower, I had to go back to the way you had u3 before and then use that to drive an NPN transistor so that I could get 0 to 12v.

The only problem I'm running into now (as you predicted) is that when I turn the POT (V2) below 1.1 v, everything flatlines and it will not work below 1.1v?



Below is the sim of the original circuit using a single supply LM324 op amp (similar to an LM358) operating from 5V. It's output goes from 0V to 4V. If you need 0V to 5V with a 5V supply then you need a rail-rail type op amp.

The virtual ground voltage from R1 and R2 is set at 2V to be halfway between the maximum and minimum output from the LM324.

I reversed the connections to the output comparator so the duty-cycle now increases with increase in the control voltage. Note that the input control voltage range is equal to the triangle-wave output voltage or about 1.1V to 2.9V.

View attachment 72794
 
Last edited:

Thread Starter

gte

Joined Sep 18, 2009
357
I used the same circuit you provided but with the TS922 (2 of them) which I had, that will go true rail to rail. It is working but I cannot measure how many volts are coming out of my 10k pot and into the 3rd op amp? The voltage is bouncing all around and I cannot figure out why? Everything else is wired up the same except with the TS922's instead of the lm324. With the 324 the voltage from the pot was steady and when I disconnect the pot output from the TS922, voltage is of course steady as well? Any ideas on this one?

My broadband is down so I am posting from my phone, but I can post the schematic and video from my computer once it is back up if you would like? Let me know.

Thank you.


TS922 datasheet
pdf1.alldatasheet.com/datasheet-pdf/view/170806/STMICROELECTRONICS/TS922.html
 

crutschow

Joined Mar 14, 2008
34,452
Ok, using the lm324, I was able to get everything almost working. Since voltage values were lower, I had to go back to the way you had u3 before and then use that to drive an NPN transistor so that I could get 0 to 12v.

The only problem I'm running into now (as you predicted) is that when I turn the POT (V2) below 1.1 v, everything flatlines and it will not work below 1.1v?
I'm a little confused about what voltages you want. The circuit I simulated can operate from 12V if that's prefereable.

The input voltage has to go between the pk-pk values of the output triangle-wave which is about 1.1v to 2.9v for a 5V supply, as I previously noted.
 

crutschow

Joined Mar 14, 2008
34,452
I used the same circuit you provided but with the TS922 (2 of them) which I had, that will go true rail to rail. It is working but I cannot measure how many volts are coming out of my 10k pot and into the 3rd op amp? The voltage is bouncing all around and I cannot figure out why? Everything else is wired up the same except with the TS922's instead of the lm324. With the 324 the voltage from the pot was steady and when I disconnect the pot output from the TS922, voltage is of course steady as well? Any ideas on this one?
............................
Some op amps have back-to-back diodes between the inputs for overload protection. They are normally invisible when the op amp is being used in the linear mode with negative feedback but can allow crosstalk between the inputs when one input is overdriven as compared to the other, as occurs with the 3rd amp. This could allow part of the triangle-wave to appear at the input with the pot, which is likely what you are measuring. A scope would show that, if you have access to one.
 

pwdixon

Joined Oct 11, 2012
488
It doesn't oscillate because the input of the 12V that you have substituted for the original 5V. In the original the 5V was simply to bias the input to something in the middle of the supply rails even though the original diagram didn't show it from what I could see I would have expected the power rails on the amplifiers to be something like 0V and 10V perhaps. Position your 12V input voltage to about 1/2 the supply voltage fro the amps and it'll oscillate.
 

Thread Starter

gte

Joined Sep 18, 2009
357
Here is the scope and the way it is laid out, although I won't be sure if I need the transistor yet until I get this oscillation straightened out.




This scope is the output of U2 vs U3


You are exactly right, part of the triangle is showing up with the upper and lower points being clipped. How do I get rid of this cross talk?

This scope is the output of U3 vs the inverting input of U3 (connected to the output of the potentiometer)


Some op amps have back-to-back diodes between the inputs for overload protection. They are normally invisible when the op amp is being used in the linear mode with negative feedback but can allow crosstalk between the inputs when one input is overdriven as compared to the other, as occurs with the 3rd amp. This could allow part of the triangle-wave to appear at the input with the pot, which is likely what you are measuring. A scope would show that, if you have access to one.
 

Thread Starter

gte

Joined Sep 18, 2009
357
In trying to figure out this cross talk issue, I was looking at the datasheet. It says:

2. Differential voltages are the non-inverting input terminal with respect to the inverting input terminal. If
Vid > ±1 V, the maximum input current must not exceed ±1 mA. In this case (Vid > ±1 V), an input series
resistor must be added to limit the input current.
Does this mean that if there is greater than a 1v difference between the inverting and non inverting inputs, that there has to be less than 1mA of current going to them? If that is the case, I would need a 15k resistor between the output of U2 and the input of U3? Am I understanding/reading this correctly?
 

#12

Joined Nov 30, 2010
18,224
These amplifiers are running, "closed loop". They successfully match their input voltages because it is the nature of an op-amp to do this. There will be no significant voltage between the inputs as long as there are no errors in building the circuit.

Sorry, I missed with this answer. Crutschow corrected me.
 
Last edited:

Thread Starter

gte

Joined Sep 18, 2009
357
Ok, do you see any errors based on the schematic? I've double checked my "wiring" but will check it again if that is the only possible cause. What crutschow said makes sense with the diodes and cross talk, researching online there seems to be other examples of unexpected current through inputs due to the over driving protection of the back to back diodes.

I can't seem to find a solution though.


These amplifiers are running, "closed loop". They successfully match their input voltages because it is the nature of an op-amp to do this. There will be no significant voltage between the inputs as long as there are no errors in building the circuit.
 

crutschow

Joined Mar 14, 2008
34,452
...............................
Does this mean that if there is greater than a 1v difference between the inverting and non inverting inputs, that there has to be less than 1mA of current going to them? If that is the case, I would need a 15k resistor between the output of U2 and the input of U3? Am I understanding/reading this correctly?
That is correct. The comparator amp is running open loop so there is more than 1V across its inputs during most of the cycle. Adding a 15k ohm resistor in series with one of the inputs (either one, you don't need both).

Note that the crosstalk has no effect on circuit operation since the voltage difference is only a few mV when the comparator changes states.

You need to add a base resistor (about 10 times the collector resistor) to the transistor to limit its base current. As shown the only current limit is the op amp output stage.
 

Thread Starter

gte

Joined Sep 18, 2009
357
I will add those 2 resistors in a few hours and report back that hopefully all cross talk will be gone :)

I did not see much variation on the U3 output square wave, which I believe is what you are saying, but the voltage value on the U3 inverting input varied dramatically (around 5v of oscillation) which can be seen with the clipped triangle wave from the second scope screen capture.
 

crutschow

Joined Mar 14, 2008
34,452
I will add those 2 resistors in a few hours and report back that hopefully all cross talk will be gone :)
.....................................
You can get by with just one resistor, if you like, but that will just reduce the cross talk not eliminate it, since there are still the diodes internally across the inputs. The resistors are mainly to protect the inputs from excess current.

As I previously noted, that crosstalk has no effect on the comparator operation.
 
Top