VC PWM (Voltage Controlled Pulse Width Modulation)

Discussion in 'General Electronics Chat' started by Tonyr1084, Sep 15, 2016.

  1. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    Been looking all over the place to get an idea on how to accomplish this. I've seen Op-Amps configured as oscillators and PWM's but the one thing I can't tolerate is off time when I want "Full On". The last circuit I sim'd did everything I wanted except it had off times during the period I wanted full on.

    Not sure how to describe what I want but I want a PWM to control a laser diode (simulate brightness). Using a PWM circuit and a potentiometer I can control the duty cycle from (practically) zero to 100%. I want to figure out how to use voltage to control the duty cycle of a PWM circuit. I have a PWM circuit on my breadboard right now and it works as described (with the POT). I can't figure out how to simulate the changes in current to control the duty cycle. I need some suggestions that will send me in the right direction.

    I have LTSpice (learning how to use that too). That's how I know the circuits I've been trying using Op-Amps fails to fill in the final blank spaces. In other words, the Op-Amp circuit varies duty cycle from zero to 50% on. Not acceptable.

    Here's the last variation I tried:

    Instead of using a photo resistor I aim to use an audio source. The laser diode I intend to use will be of a moving beam. ALL "Off" periods in the duty cycle WILL be visible. The brightness will be varying by virtue of the amplitude of the signal while the frequency will dictate "On" and "Off" periods. A strobe effect so to say.
     
    Last edited: Sep 15, 2016
  2. shortbus

    AAC Fanatic!

    Sep 30, 2009
    4,010
    1,530
  3. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    I'll sim it up and see. Meanwhile I've made some arbitrary adjustments to some of the resistor values and came up with something that is closer. But it still has periods of off time that may not be acceptable to me. Here's my LTSpice file:

    Meanwhile, wifey wants to go to the store. Be back in HOURS (if I know her - she'll have to explore every isle again).
     
  4. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    Corrected LTSpice model. Missed one wire. Still, same results.
     
  5. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,046
    Can you walk me through that? I don't get what you're doing.
     
  6. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    I want PWM to control the brightness of a laser diode. I want to control the PWM from the voltage of a pre-amp output audio signal. The greater the amplitude the brighter the laser. The higher the frequency the more often the laser flashes on and off. The lower the frequency the lesser it flashes on and off. With the low frequencies the light needs to be on steady for a longer period of time over that of the higher frequencies.

    Try this as an experiment: Grab an old LED and connect it directly to the output of some music. In the dark, wave the diode in a circular motion. Notice how the low frequencies produce dashes with the LED while the high frequencies produce dots. Also notice how the led brightens and dims with the changing amplitude of the signal.

    No, I don't want to sit in the dark waving LED's around. The plan is to use a laser shown upon a rotating mirror that is slightly off angle. The resulting dot on the wall will flash to the amplitude and strobe to the frequency. I'm not even sure PWM is the way to go. I may just have to drive the laser from an audio amplifier and a good MOSFET. That may be the easiest way but I'm looking for a more sure fire way to control the intensity. So VC PWM is an experiment I want to see if it works the way I hope it will.

    Oh, and shopping was fun. Explored Costco AND Winco. Guess what! They have groceries in both places.
     
  7. SLK001

    Well-Known Member

    Nov 29, 2011
    817
    227
    Here's a circuit that will do what you want. I have used it to control an incandescent light for a microscope. It will range from full on to full off.

    PWM.jpg
     
  8. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,046
    I should have been more specific. I was looking at your simulation file and couldn't understand it all.
     
  9. ronv

    AAC Fanatic!

    Nov 12, 2008
    3,290
    1,255
    Lets do it like your LED example and just make a voltage to current driver.
     
  10. Threeneurons

    New Member

    Jul 12, 2016
    19
    10
    A redo of Wendy's circuit:
    [​IMG]
    Got rid of the 555, and used the spare LM393 stage, instead. Also used a power FET in place of the bipolar. The OP wanted full power to the load when cranked to max, without any pulsing. Reducing R1, from 10K, to 8.2K should keep that stage of the LM393 ON continously. If the tolerance of the pot is really bad, then drop R1 to 6.8K or smaller.
     
  11. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    A lot to experiment with. Thanks everyone.

    WayneH: Sorry I'm not able to be more clear. I'm after a dancing LED. Only instead of swinging an LED about on a platter I want to substitute a Laser LED and keep it stationary. The resulting dot on the wall will be moved around by changing the angle of a mirror mounted on a motor shaft.

    The problem I experienced with my sim is that when the LED is supposedly full on is that it's only on half the time. The on time (logic 1 side of the square wave) is equaled with the off time (period of time when the square wave is at logic zero). That's what I'm trying to get away from. I'm not even sure PWM is going to yield the result I want but I'll give it a swing.
     
  12. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    @Threeneurons Thanks, but this doesn't seem to work. At least not in the sim.

    I don't understand why you have two voltage dividers on the first Op-Amp. Nevertheless, thanks for the effort. All I get is a square wave that doesn't vary with amplitude.
     
  13. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,670
    804
    Recently i used ltc6992 voltage to pwm chip to easily control motor bridge etc.
     
  14. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,046
    I get that. It's the sim I don't fully follow. The bit on top is making a triangle wave. Why? To drive the PWM switching at a comparator. You're using a sine wave generator to simulate music and you want the PWM to hit 100% at peaks in wave. I get all that.
     
  15. Alec_t

    AAC Fanatic!

    Sep 17, 2013
    5,797
    1,103
    Try this :-
    SimplestPWM.PNG
    But at audio frequencies the flash rate will be too high for the eye to follow. The light will appear continuous.
     
  16. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    Here's an LTspice simulation of a variation of your circuit that gives 0% to 100% PWM duty-cycle.

    upload_2016-9-16_11-45-8.png
     
  17. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    I'm confident the eye can fill in the missing detail as you say. However, the dot on the wall is constantly moving; sort of like a circular Z axis Oscilloscope. The dot is moving at around 40 RPS (per second), so a continuous signal will look like a complete circle. However, audio frequencies on the high end (10KHZ to 20KHZ) will appear as dots. The higher the frequency the more dots - distinct and individual - will appear. Hence, my concern that having extra "Off" times will show up.

    Thanks for the sim. I'm learning a lot about how to use LT. Would you explain your .tran statement and the .IC statement as well? That one is completely foreign to me.

    For all, yes, I'm using a sign wave to simulate the audio frequency - but that's because I know so little about LTSpice and setting up the programming. There've been days where I just plug in different numbers for the supply, the delay, the rise time and fall time of the waves (square and such). Please understand I'm a novice at this stuff. I'm good enough with DC and with logic (sort of) but a lot of things have changed since I last dabbled with electronics. BPJ was my strongest (weak) point. FETs? I'm REALLY trying to get a handle on all of that. Capacitors? Inductors? AC theory? Radio? WAY over my head. (beyond the basics)

    Nevertheless, thanks to all who are endeavoring to help me out. If something doesn't make sense - it's probably for good reason.
     
    Last edited: Sep 17, 2016
  18. shortbus

    AAC Fanatic!

    Sep 30, 2009
    4,010
    1,530
    Isn't that pretty fast? Comes out to 2400 RPM. Can the eye keep up with that?
     
  19. Tonyr1084

    Thread Starter Active Member

    Sep 24, 2015
    535
    86
    No. That's why it's moving that fast. Fast enough that it may appear to be one single solid circle if the light is always on. Any slower than 30 RPS and the eye can begin to see the moving dot. You WANT the dot moving so fast that it appears to be a solid circle. That way when it's modulated and responding to the frequency you'll see dots that may appear to move in one direction or the other. They can even appear to be moving both directions at the same time. At harmonic frequencies the dots will appear stationary. Lower frequencies will appear as dashes while high frequencies will appear as dots. And all elements will be constantly moving one way or the other. Too high a sweep rate and the high frequencies will appear as dashes and low frequencies may present a solid circle - washing out any would be dots.

    When I build it I'll shoot a video and post it. Or like I mentioned, grab an LED and connect it to the speaker output of a radio (stereo) and move it around very fast by hand and you'll see the strobe of the frequency in the audio signal.

    [edit] I stated: "That's why it's moving that fast. Fast enough that it may appear to be one single solid circle if the light is always on." Hence, PWM MAY snow up on that sweep rate. The sweep rate is based on camera "Frames Per Second". 30 is a good smooth film, whereas 27 FPS may appear jumpy and a bit flashy. As for my motor speed I'll be controlling that via PWM. That much I have built and is working as planned.

    Sitting here thinking about suggesting to you to rig up an LED to an audio output - I can do that with my laser LED. So I should be able to make a video showing exactly what I'm after. I'll give that a go this evening. Right now I'm setting up to paint the house. Done all the prep work and now is the day I get to spray the house sky blue.
     
    Last edited: Sep 17, 2016
  20. crutschow

    Expert

    Mar 14, 2008
    13,009
    3,233
    Sometimes I use the Start external DC supply at 0V or Skip Initial operating point solution to help with convergence errors.
    The also help start oscillator circuits.
    I also sometimes use the Time to Start Saving Data to avoid the startup transient showing in the plots.

    The .ic command sets the designated node to the given voltage at the start of the simulation.
    In this simulation it avoids long time-constant for Pgnd to get to it's final value after the simulation start due to the long time constant of C4 .and R5||R6.
     
Loading...