Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/25/09 15:38
Modified:
  02/25/09 15:41

Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#162822 - Give this a try...
Responding to: ???'s previous message
Hi Aamir,

learning electronics is really hard, isn't it? But don't give up, it's worth the trouble...




A voltage divider is needed to produce a reference voltage of about 9V / 220k x 100k = 4.09V at the inverting ("-") input of LM339.

Because the input voltage at non-inverting ("+") input can rise up to 7V you need to power the LM339 by a supply voltage of 9V. Then, input voltages up to 9V - 1,5V = 7.5V are allowed, according to datasheet.

Take care, the output of LM339 is not a push-pull, but an open collector. So, you need a pull-up resistor to produce high state! This pull-up resistor can be connected to the +5V supply of micro or to the +9V supply of LM339. If you want to connect the comparator output to any of the micros' pins, then hook the pull-up to +5V.

There's another feature shown in the scheme, which is important when driving a counter, the Schmitt-trigger hysteresis provided by the 1M resistor. When the input signal at non-inverting input is near the reference voltage, the comparator output can oscillate due to noise on the input signal. The positive feedback (because the 1M resistor is connected from the output to the positive (non-inverting) input) helps to traverse this critical point faster and steeper, by additionally increasing the input voltage when rising above the reference voltage and by additionally decreasing the input voltage when going under the reference voltage. So, the feedback stabilizes the performance of LM339 arround the reference voltage. The hysteresis is about 50mV which should be enough in your application.

Don't forget proper supply voltage decoupling at the LM339. Connect 100n X7R directly across the supply pins. In very noisy systems it can be of benefit to add a small ceramic cap of 1...100nF from inverting input of LM339 to ground.

Good luck my friend,

Kai

List of 27 messages in thread
TopicAuthorDate
comparator with 8051            01/01/70 00:00      
   What have you tried?            01/01/70 00:00      
      description of project            01/01/70 00:00      
         Look at photo transistor            01/01/70 00:00      
            further description            01/01/70 00:00      
               But why 7V ?            01/01/70 00:00      
   Another project?!            01/01/70 00:00      
      this is another project            01/01/70 00:00      
   Not a sinusoidal waveform!            01/01/70 00:00      
      Well, it can look like a sine...            01/01/70 00:00      
         still problem with comparator            01/01/70 00:00      
            Circuit missing            01/01/70 00:00      
            sorry the circuit is here            01/01/70 00:00      
               the circuit            01/01/70 00:00      
                  Why bandages, and why 9V VCC?            01/01/70 00:00      
                  VREF is wrong!            01/01/70 00:00      
               How is Vref 4V ?            01/01/70 00:00      
            used two diodes at input to MCU            01/01/70 00:00      
               Doesn't solve the Vref problem!            01/01/70 00:00      
   kai, help me with comparator            01/01/70 00:00      
      Give this a try...            01/01/70 00:00      
         thanks            01/01/70 00:00      
         thanks, the circuit worked            01/01/70 00:00      
   LM339 is an open collector            01/01/70 00:00      
   As Aamir Javaid said about input to 8051.            01/01/70 00:00      
      Not for an open-collector output!            01/01/70 00:00      
         Is that tied to +5VDC            01/01/70 00:00      

Back to Subject List