Voltage controlled PWM

Thread Starter

Chazmon3

Joined Apr 5, 2013
12
Hi everyone,
New on this site and hope you can help me with this.
I found this circuit and tried to make it on a breadboard but it doesn't do anything but switch a LED on and off according to where I set the POT. Note I did replace the Light controlled resistor with a pot (tried several different ones). I have also tried several types of Voltage Controlled PWM circuits that are similar but have had no luck in making them do anything other then switch the LED on and off. Can anyone tell me what I am doing wrong? Maybe my expectations are not correct. Was thinking this would dim a LED as the pwm changed.

http://www.stephenhobley.com/blog/wp-content/uploads/2010/09/pwm_circuit_web.gif

Bill Bowden also has one that is similar:
http://www.bowdenshobbycircuits.info/page8.htm#func.gif

I am new here and hope to hear back. Just want to be able to control the brightness of LED's with out using a 555.

Charles
http://www.stephenhobley.com/blog/wp-content/uploads/2010/09/pwm_circuit_web.gif
 

WBahn

Joined Mar 31, 2012
30,082
How are you hooking up your LED? Is there a current limiting resistor in series with it? To which supply is it going?

If I understand you correctly, as change the pot (which is in place of PH1 in the schematic) the LED comes on and stays on at some point while, as you change the pot back, it goes off and stays off. It's not flashing or anything like that? Is that a correct description?

Do you have an oscilloscope with which you can look at the signal on pin 10?
 

Thread Starter

Chazmon3

Joined Apr 5, 2013
12
Thanks for your answer.
Yes you are right on with what is happening. Its just on and off. I have been putting a single LED with resistor to pin 8. I have also connected a transistor to base and resistor to pin 8 the led but still similar result. No dimming just on and off. I am sure its my error but can't figure it out since I have tried many different flavors of this type circuit.

It would be great if I had a scope!
 

Thread Starter

Chazmon3

Joined Apr 5, 2013
12
I am also sure that the pot/trimmer on the right side of the circuit is just to modify or center the waveform so have tried all aspects of adjustment there too. I have double checked all parts and values.

It is my understanding that this circuit should be able to dim a LED.

The LED is going to Vcc through a resistor. I have also tried to ground the other end of the LED and use the output to power it from the other direction. No luck either way.
 

WBahn

Joined Mar 31, 2012
30,082
Okay, so let's focus on the oscillator. At ]pin 10 you want, ideally, a triangle wave although a sine wave would work, at least qualitatively. What you do NOT want is a square wave.

It's been a really long time since I've even looked as op-amp circuits like this and I don't have a simulator available, so I'll walk through my reasoning but I might miss something important along the way. Others can pick up on what I am saying and extend it or correct it.

First off, let's may a simple change of reference. What you have as GND I am going to call Vee and I'm going to declare the output of the pot on the left as GND. This just makes it so that the reference signal for both opamps is 0V. It doesn't change the circuit behavior.

So this is going to set some limits on the range that your right hand pot has to be within. What are the values of the pot and the resistor (R5) you are using?

The left-hand circuit, composed of IC1A, R3, and R4, is a Schmitt trigger comparator with two thresholds, Vh and Vl. Assuming rail-to-rail capability (let's come back to this) and our oV reference right inbetween the rails, the trigger points should be roughly at the 1/3 and 2/3 points between the supplies.

The right-hand circuit, composed of IC1B, R2, and C1, is an inverting integerator with a gain of about -1V/ms per V.

Before we go further, let's come back to that rail-to-rail assumption. You are using an LM324. It is NOT a rail-to-rail opamp and has common-mode input restrictions. What is your Vdd voltage?
 

spark8217

Joined Aug 29, 2011
64
Hi
I have simulated the circuit and it does work in multisim after making a slight adjustment, have you drawn the schematic ? have you followed the schematic with your build if so ,where is pin 8 connected to on the LM324N on the far right of the schematic?

cheers
spark8217
 

tracecom

Joined Apr 16, 2010
3,944
I breadboarded the circuit as designed and it works quite well on a 5V supply.

R1 is used to adjust the oscillation to produce a triangle wave at pin 7. Properly adjusted, the triangle wave is about 2Vpp and has a very nice shape as seen on my scope. Without a scope, I suggest you adjust the voltage at pin 2 to be 1.8V (assuming Vdd of 5V.)

At pin 8, there is a good square wave of about 3.5Vpp. I connected a resistor and an LED with the anode to pin 8 and the cathode to ground. With only ambient room light on the LDR, the LED is essentially full on. Shining a flashlight on the LDR causes the LED to dim as the flashlight is held closer and closer, and finally the LED goes dark. On the scope, the PWM effect is quite observable.

A photo of my breadboard is attached. The red wires are 5V and the black wires are ground.

I hope this helps.
 

Attachments

Last edited:

Thread Starter

Chazmon3

Joined Apr 5, 2013
12
Ok everyone, thanks again! I actually went back through the circuit this morning and checked all resistors and rechecked everything else I could, and now think that the culprit was my breadboard because everything checked out fine but used a different board and now it works. Well I think it works because the LED will dim with the 5K pot I used in place of the photo resistor. The photo below shows exactly what I did on the circuit except the photo resistor is now a 5k pot. In reference to the 10k pot on the left side, isn't that for symmetry for the wave form? The circuit only seems to work if that 10k pot is somewhere in the middle of the range and will dim the LED somewhat.

On the simulated circuit, that looks great but the frequency counter blocks view of part of it. I would make that circuit but not sure that I can provide the +18v and -18v to power the LM324. What is the advantage of the higher voltage for that part of it? I would try it though.

I have made several different kinds of PWM's and have one that is made of two Schmitt triggers and another with one Schmitt trigger and its nice to know that these op amps are configured into a Schmitt trigger.

My main object is to get a pwm or any good circuit that is very effiecient to power LED's from a battery. Most all of what I have looked at like the Joule Thief type circuits claim to be above 90% effiicient but that is only in part of the curve and most of the time they are about 60% efficient.

Well off to Fry's to look at a new bread board. :)

Charles
 

Attachments

GopherT

Joined Nov 23, 2012
8,009
Your PNP transistor is connected backwards. Also, PNPs are usually put on the positive rail. In either case, the LM324 is not rail-to-rail output so you may not be able to raise the output voltage high enough to turn a PNP off if it connected to the positive rail. Likewise, does this chip go within 0.5 volts of ground to turn off an NPN?
 

tracecom

Joined Apr 16, 2010
3,944
Your PNP transistor is connected backwards. Also, PNPs are usually put on the positive rail. In either case, the LM324 is not rail-to-rail output so you may not be able to raise the output voltage high enough to turn a PNP off if it connected to the positive rail. Likewise, does this chip go within 0.5 volts of ground to turn off an NPN?
When the LDR is strongly illuminated, pin 8 of the LM324 is driven all the way to 0V. Thus when pin 8 is connected through a 1k resistor to the base of a 2N3904 that has its emitter grounded, the collector is at 3.7V, and an LED with its cathode toward the collector and its anode to ground is completely off.

However, for a single 20 mA LED, no transistor driver is needed. Pin 8 can be connected directly.
 

WBahn

Joined Mar 31, 2012
30,082
Your earlier descriptions of your LED was that it was just an LED and a series resistor from pin 8 to either GND or Vdd. But that isn't what you were actually using and it appears that THAT is where your problem has been. We had no reason to suspect that you were even using a transistor, let along that you were using it incorrectly. When you are seeing the LED light up, the current is going through the collector-base junction and through both resistors.

That's why we are always asking people to post schematics of what they are actually building!
 

Ron H

Joined Apr 14, 2005
7,063
I think we need to clear up something. If the transistor is a PNP, then what WBahn says regarding the LED current is true.
If the transistor is drawn incorrectly, and is actually an NPN, as tracecom suggested, then it should work, assuming the resistor values are reasonable. Which brings up another point. Schematics are sometimes impossible to debug over the internet unless ALL component values are shown!
 

tracecom

Joined Apr 16, 2010
3,944
I think we need to clear up something. If the transistor is a PNP, then what WBahn says regarding the LED current is true.
If the transistor is drawn incorrectly, and is actually an NPN, as tracecom suggested, then it should work, assuming the resistor values are reasonable. Which brings up another point. Schematics are sometimes impossible to debug over the internet unless ALL component values are shown!
I agree, and I was trying to agree that a NPN would be a better choice for the OP, but I could have been clearer.

At any rate, attached is my rendition of the circuit originally posted; it includes the 2N3904 as I tried to describe.
 

Attachments

Ron H

Joined Apr 14, 2005
7,063
I agree, and I was trying to agree that a NPN would be a better choice for the OP, but I could have been clearer.

At any rate, attached is my rendition of the circuit originally posted; it includes the 2N3904 as I tried to describe.
The LED is going to be pretty dim, even at 100%. If R1 were changed to 150Ω, 100% duty cycle would yield ≈20mA LED current, assuming Vfwd≈2volts.

Also, I see no need for the pot (VR1). The pot controls oscillator symmetry. A voltage divider with 10k to GND and 18K to +5V will yield a threshold that is roughly halfway between the high and low output levels of the Schmitt trigger. This will give about 50% oscillator duty cycle, and oscillator duty cycle for this sort of PWM generator is unimportant anyway.
 
Last edited:

tracecom

Joined Apr 16, 2010
3,944
The LED is going to be pretty dim, even at 100%. If R1 were changed to 150Ω, 100% duty cycle would yield ≈20mA LED current, assuming Vfwd≈2volts.

Also, I see no need for the pot (VR1). The pot controls oscillator symmetry. A voltage divider with 10k to GND and 18K to +5V will yield a threshold that is roughly halfway between the high and low output levels of the Schmitt trigger. This will give about 50% oscillator duty cycle, and oscillator duty cycle for this sort of PWM generator is unimportant anyway.
Yes, I have a bunch of LEDs with 1k resistors soldered to them; I use them on the solderless breadboard. I just put 1k on the schematic because that's what I actually used. A 150 would have been brighter, but the LEDs are visible enough for breadboarding on 5V, and still usable up to 12V.

As to VR1, I looked at the triangle wave on the scope as I adjusted it, and found that it produced the most symmetrical waveform set at 1.8V, which is essentially what your 10k-18k voltage divider would produce. I wish I had the engineering background to have known that, but I don't.

Thanks.
 

Ron H

Joined Apr 14, 2005
7,063
Here is a revised schematic with the pot eliminated and a more appropriate current limiting resistor for the LED. It also accounts for the unused op-amp.
You don't need the extra voltage divider for the unused op amp. Connect it to R7-R8.
 

Thread Starter

Chazmon3

Joined Apr 5, 2013
12
Hi again everyone, Whoops! I put the arrow in the wrong direction on my drawing. It is a NPN transistor not a PNP. This circuit does work very well. Also on this circuit I have since replaced that NPN with an N Channel MOSFET. On the LED I used a 10 ohm resistor with 8 higher power LED's in parallel. It is drawing about 1.5 watts. Even with my shot in the dark changes, found that it is 90.6% efficient with that MOSFET. Because of all your comments on the 10k pot I am going to change it to the 2 ea 10k fixed resistors and retest for efficiency ....... retested and found it to be the exact same since it was mentioned that it wouldn't make a lot of difference.

Is it that important to do anything with the unused part of the quad IC? or is it just a good measure for an IC like this? You guys are very thorough.

Also I have found another circuit that is more efficient. I found enough parts laying around to build it. It uses 2 Schmitt triggers and is tested at 93% using the same mosfet and 10 ohm resistor as I used with the LM324 circuit.

If anyone can think of a way or suggest a circuit to get the efficiency higher yet that would be great!

Even though I appear to be a bit sloppy I admit, but my logic is usually pretty good and do a lot of trials and errors but usually get a good end result. That is the fun of it all for me anyway.

Once I find the best and most efficient circuit I will take it to a new level to drive the LED's.

Ta ta! :)
 
Top