Jump to content
Electronics-Lab.com Community

PWM


Kevin Weddle
 Share

Recommended Posts

I am trying to develop the simplest Pulse Width Modulator. It seems you can use an AND gate with the amplifed signal at the input and a reference clock on the other input. Can somebody back me up on the logic here. It seems the only problem is that the frequency can't be too far from the reference oscillator else you will get an erroneous output. But this is indeed a way of pulse width modulating by shear means of logic. You must of course amplify the signal to digital logic levels.

Link to comment
Share on other sites

Kevin,
You can't use two unrelated signals for pulse-width-modulation. They must have exactly the same frequency and you create the modulation by producing a phase difference between them. Ordinary lamp dimmers and DC motor speed controllers work like that.

In your circuit the AND gate is simply acting like a comparator.

For the simplest Pulse Width Modulator why not just use an IC that was developed to do the job extremely well and has been used for many years like this one:
http://www-s.ti.com/sc/ds/tl494.pdf

Link to comment
Share on other sites

Why won't it work specifically. The logic is there. The clock gets it's pulse chopped off with respect to the frequency of the other input. The clock can be the lowest frequency of the input and it will have a bandwidth. The signal cannot be arbitrary though in order to work. It must have a time to it that the voltage will trigger the input. But we all know that the arbitrary waveform can preclude us from obtaing the results.

Link to comment
Share on other sites

Kevin,
If your inputs are not at the same frequency, you can't vary the phase difference between them and therefore can't produce pulse-width-modulation. If it is for a lamp dimmer or DC motor speed controller, if the input frequencies aren't the same then the lamp will flicker and the motor will jerk at the rate of the difference in frequency.

Pulse-width-modulation works by changing the duty-cycle of the pulses that feed the power to the load. For full power, each pulse is on most of its time and off for a very short time. For low power, each pulse is on for a very short time and off for most of its time.

Your circuit has high frequency pulses that are probably a 50-50 square wave which would give 50 percent power to the load whenever they are gated on by the low frequency pulses. Your circuit doesn't change the duty-cycle and therefore doesn't change the power to the load. Your circuit is a tone burst generator not a pulse-width-modulator.

You talk of amplifying a "signal" up to logic levels. What is the signal (audio?) and what do you want PWM to do with it (change the brightness of a lamp by the volume of the audio?)?
If you amplify it up to logic levels then you destroy its volume changes.

Link to comment
Share on other sites

PWM can be done with a couple of op-amps.

In the circuit below A is a comparator osilator, it generates a triangle / sawtooth waform on C. B a comparator it compares this output to a voltage set by the POT, it is set up to go low when the oscilator output is greater than the setting one the POT when it's wiper is at the highset setting it never triggers so it's on all the time, when it's on the lowest it's triggered all the time so it's always off. In the intermediate setting the cycle will be 50 50.

post-0-14279142170692_thumb.gif

Link to comment
Share on other sites

Yes I remember that circuit form the dome lamp dimmer thread. ;D

It works very well with motors and incandescent lamps but it's not good enough for LEDs. It doesn't go fully on or off like the comparator and triangle wave oscillator PWM circuit shown here.

Link to comment
Share on other sites

This circuit will go from 0 to 100% because the comparator's threshold can be set both above and bellow sawtooth waveform's maximum and minimum voltage swing.

I've built a similar circuit at work, so I used a astable 555 (I'd already tried the above circuit) and a comparator to compare the voltage on the timing capacitor to a referance set by a pot. I viewed the output waveform on a highspeed oscilosope and it went from 0 to 100%.

Link to comment
Share on other sites

  • 2 weeks later...

Whitch circuit Ante, mine or yours? ???

With your cicuit the signal is taken from the output, and it could be taken from pin 3, it works by altering the charge and discharge time constant of the timeing capacitor.

With mine the waveform in pin 3 is always 50% duty cycle, the output is formed by compareing the voltage on the capacitor with the voltage on the potential divider. This is similar to the project for the Dome Lamp Dimmer  on this site. The only difference between the first and second circuit I posted on this thread is the first uses a smitt trigger oscillator formed by op-amp A, and the second uses a 555 timer.

I would recommend the first circuit over the second because it uses less components and thus less power - I only used it because I'd already built a circuit similar to yours and it wasn't any good for the application I was using it for. It's fine for incandesant lamps and motors but not for LEDs, you also can't alter the power level by using an exteral controlvoltage. I would recomend your circuit if you want to save power and I would replace the 10K pull-up resistor on pin 7 to save even more power with a higher value like 47K and connect it to a MOSFET to drive the load.

So both the 2 comapator circuit and your 7555 timer circuit are good but for different things. Your 7555 timer circuit saves power and my dual op-amp allows full ON/OFF switching and controll via an external controll voltage.

Link to comment
Share on other sites

audioguru,  you can get a fully off and fully on with this circuit.

I know you know this but other people might not, so  I hope some people find this information useful. ;D

I've done a simulation, look at the graphs.

The comarator on the output will turn off only when the inverting input is higher than the non-inverting input.

The 1st one is fully on, the voltage on the non-inverting pin is greater than the peek value of the triangle waveform on the capacitor.

The 2nd is nearly fully on, the voltage on the pot is about 6.4V so it turns off only when the wave form on the inverting pin is >6.4V, but it is    below this value most of the time so the output is on more than off.

The 3rd circuit is nearly on becaus the voltage on the pot is 6V this makes it on for half the waveform and off the the other half.

The 4th circuit is nearly fully off because the voltage on the pot is 4.7V and the voltage on the capacitor is normally above this value so the circuit doesn't turn on very often.

The 5th ciruit is off as the voltage on the pot is less than the mininum part of the waveform so the op-amp will never turn on. ;D

post-0-14279142182339_thumb.gif

Link to comment
Share on other sites

Hi Alun,

Things seem to be more complicated here than it has to. My point regarding the 555 circuit that I posted was that it’s not complete (it doesn’t have any power stage yet) and the way you complete it decides the outcome. There is no reason why the power stage cannot switch completely on and off.
And another thing, I don’t really see why the LEDs should be more sensitive to this phenomenon than other kinds of loads.

Link to comment
Share on other sites

Hi Ante,
An incandescent light bulb is dimmed to off with maybe 10:1 PWM of its bright operating current. A loaded motor might stop with 20:1 of PWM.

But my ultra-bright LEDs are still very visible with only a few microamps of current.
In my chaser I dim with PWM to about 1047K/1K where the 1K is the output resistance of the Cmos inverter. The LED was very visible with the resulting 1047:1 PWM so I had to add C7 to squash the very narrow pulses.  ;D

I recently missed a very good deal. My son bought a very bright key-chain white LED flashlight c/w a 3V lithium battery for $1.00, and a very good quality stainless-steel pen c/w built-in laser pointer for about $6.00 at a dollar store. I went there the next day and they were completely sold out!  :'(

post-1706-14279142182928_thumb.jpg

Link to comment
Share on other sites

Things seem to be more complicated here than it has to.


Sorry for making it sound complicated, I was just trying to explain things.  :)

My point regarding the 555 circuit that I posted was that it’s not complete (it doesn’t have any power stage yet) and the way you complete it decides the outcome.


I did finish it for you.  ;D

http://www.electronics-lab.com/forum/index.php?topic=2373.14

These pulses are too short to warm the filament of a bulb or turn a motor, but they will make a high brightness LED glow. Some LEDs are so good the even glow when I hold one of the legs and connect the other to a grounded object like a tap or radiator, the LED glows beaus I'm acting as an aerial and picking mains hum and RF.

Perhaps I should contact Mixos and get it published on this site.

audioguru, doesn't your circuit work on a similar principle as Ante's?
Link to comment
Share on other sites

Hi Ante,
My PWM oscillator is at 3.9KHz so when it is fully dimmed, the off pulse width is 256us and the on pulse width is probably only 245ns! A totem pole (push-pull?) output would probably speed the turning off somewhat and help dim the LED, but maybe it wouldn't be enough.
The dimming occurs on my 'scope trace too and before it completed dims away the pulse looks like an extremly narrow triangle wave, it slowly slews down then doesn't even reach very low before it slowly slews back up (when I say slowly I am talking about tens of ns). The cap I added from base to emitter of the LED driver transistor reduces the narrow pulse pretty well.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
  • Create New...