Kevin Weddle Posted March 28, 2005 Report Share Posted March 28, 2005 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted March 28, 2005 Report Share Posted March 28, 2005 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 Quote Link to comment Share on other sites More sharing options...
Kevin Weddle Posted March 29, 2005 Author Report Share Posted March 29, 2005 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted March 29, 2005 Report Share Posted March 29, 2005 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. Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted March 29, 2005 Report Share Posted March 29, 2005 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted March 30, 2005 Report Share Posted March 30, 2005 You can PWM the brightness of a lamp by audio loudness if you rectfy and filter the audio and use the resulting changing voltage to replace the pot in Alun's circuit. Quote Link to comment Share on other sites More sharing options...
ante Posted March 30, 2005 Report Share Posted March 30, 2005 An even simpler PWM generator based on a very famous old friend of ours! ;D ;D Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted March 30, 2005 Report Share Posted March 30, 2005 Yes I remember that circuit form the dome lamp dimmer thread. ;DIt 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted March 30, 2005 Report Share Posted March 30, 2005 The PWM in my Plants Watering Watcher-2 and chaser projects has a range in the thousands. Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted March 30, 2005 Report Share Posted March 30, 2005 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%. Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted March 30, 2005 Report Share Posted March 30, 2005 Yes I know I could've use the comparator oscilator but I'd already built the astable 555 so it was quicker just to add a comparator. Quote Link to comment Share on other sites More sharing options...
ante Posted April 10, 2005 Report Share Posted April 10, 2005 Hi Alun,Even if the circuit in it self don’t go “fully on or off” the result of the output is partially in the power stage driven by this 555 circuit. 8) Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted April 10, 2005 Report Share Posted April 10, 2005 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted April 10, 2005 Report Share Posted April 10, 2005 I used an "audio taper" logarithmic brightness control in my Chaser projects for smoother control of the approx 1000:1 of their dimming. Even with 1000:1, the LEDs weren't completely dimmed and I had to add a capacitor to squash the remaining extremely narrow pulses. ;D Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted April 10, 2005 Report Share Posted April 10, 2005 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. ;DI'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 Quote Link to comment Share on other sites More sharing options...
ante Posted April 10, 2005 Report Share Posted April 10, 2005 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted April 10, 2005 Report Share Posted April 10, 2005 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. ;DI 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! :'( Quote Link to comment Share on other sites More sharing options...
ante Posted April 10, 2005 Report Share Posted April 10, 2005 Hi Audioguru,How about a totempole output that should cut the load completely off between pulses? What’s your opinion on this? Quote Link to comment Share on other sites More sharing options...
Guest Alun Posted April 10, 2005 Report Share Posted April 10, 2005 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. ;Dhttp://www.electronics-lab.com/forum/index.php?topic=2373.14These 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? Quote Link to comment Share on other sites More sharing options...
audioguru Posted April 10, 2005 Report Share Posted April 10, 2005 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. Quote Link to comment Share on other sites More sharing options...
audioguru Posted April 10, 2005 Report Share Posted April 10, 2005 Hi Alun,Yeah, my circuit is very similar to Ante's. ;D Quote Link to comment Share on other sites More sharing options...
ante Posted April 11, 2005 Report Share Posted April 11, 2005 Hi Guys,Well, what can I say? The length of the pulses is also decided in the construction. The values of the components can be changed to suite the pulse characteristics you need.Audioguru,Thanks for your input on the "pole"! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.