Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Help with LM311 comparator and pulse-width circuit

Status
Not open for further replies.

IdahoEv

New Member
My girlfriend and I have this crazy project to provide a stuffed animal with creepy pulsing LED eyes. Being a geek, I decided it had to be done with pulse width modulation and an adjustable frequency sinewave. Unfortunately, I'm almost 15 years out of practice from my EE classes in another lifetime.

I've attached a PDF of the circuit, as it stands so far. Short version: The two functional blocks outlined in green work great, until they are connected to the comparator and then everything goes to hell.

It needs to be done off a single supply so we can run it on a 9v battery when it's finished. I'm using a wien bridge oscillator to provide the sinusoidal control signal, and feeding that output along with a much faster triangle wave into a comparator.

I'm using a voltage divider on a 12v power supply to provide a reference voltage / substitute ground.

The good news: both oscillators work great. I've even got the sine oscillator with adjustable frequency via a dual gang pot. It's spiffy, with an output range of 1/3 Hz to about 4 Hz, perfect for creepy glowing/pulsing eyes.

The bad news: when I try to hook up the comparator, everything fails. Both oscillators even stop oscillating, and *all* the outputs go to ground. I don't understand why.

Sometimes this even happens when I simply plug the comparator into the power supply - i haven't even connected the two oscillators to its inputs!

One of my confusions is this: the datasheet for the LM311N has three power connections, labeled Vcc, Vee, and GND. I assume that these should be connected to +12, 0, and 0 respectively, though I have also tried +12, 0, and Vref, as well as +12, Vref, and 0 (where Vref is the 6v reference provided by my voltage divider). I have added the requisite pullup resistor between the comparator's output and the positive voltage.

Many thanks for any input!
 

Attachments

  • Sinusoidal PWM.pdf
    27.6 KB · Views: 349
Last edited:
Just a quick note: we noticed that the voltage divider providing the 6v virtual ground reference is going wonky when we plug in the comparator. (It starts generating a voltage only 1v above the minimum, not 6v, so clearly the comparator in parallel with it is a bad thing).

Should I just try making the voltage divider stiffer with smaller resistors, or isolate it with a follower or something? Any advice appreciated, thanks.
 
Near as I can tell it is pin 1 and 4 to ground, although there are 2 packages an 8 pin and a 14 pin.
 
One of my confusions is this: the datasheet for the LM311N has three power connections, labeled Vcc, Vee, and GND. I assume that these should be connected to +12, 0, and 0 respectively, though I have also tried +12, 0, and Vref, as well as +12, Vref, and 0 (where Vref is the 6v reference provided by my voltage divider). I have added the requisite pullup resistor between the comparator's output and the positive voltage.
The data sheet says
The device is also designed to operate from dual
or single supply voltage.
For single supply Vcc is positive power and Vee is the return. ]
However, when the input signal is a voltage ramp or a slow
sine wave, or if the signal source impedance is high (1 kΩ to
100 kΩ), the comparator may burst into oscillation near the
crossing-point. This is due to the high gain and wide bandwidth
of comparators like the LM111. To avoid oscillation or
instability in such a usage
Either it is oscillating or its bad.
Andy
 
Try using the LM393 instead. It's a dual comparator so only use 1. The LM311 tends to oscillate, and is high speed, whereas the LM393 should suit better. The other way is just to use an LM555 timer. You can control both duty cycle and frequency.
 
Either it is oscillating or its bad.

If those are the only two options, I'm going to vote "oscillating", even though I don't see any oscillation on the output on my scope. I've tried three brand-new 311Ns, and they all perform identically.
 
OK then look at the data sheet and see if any of the oscillating condishoins exsit.
Andy
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top