Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

comparator as a switch to 8051

Status
Not open for further replies.

burassu

Junior Member level 1
Joined
Jul 2, 2011
Messages
16
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,391
Hi,I have designed a light sensor by using this circuit->>>>>> **broken link removed** .

As a comparator Ic I am using the Lm339. The circuit is working perfectly but I need it to be connected with an 8051 to act as a switch.

But the only problem is that the output of the comparator when high it is giving 2.5v as an output although it is connected to a pull up resistor to 5v .

How can I switch the output to 5v so that it can be connected to the 8051???

Tnks
 

You are right being confused because I always use LM339 (open collector output) with a pullup around 2K2 to 10K and it works very well .... 0 to Vcc=5V
 

even If i remove the circuit from acting as an input to the micro controller it is giving an output voltage of 2.5v. I don't know what to do.
 

Is it the same for all four comparators of LM339?

And this could happen when there is a negative feedback.
 

The circuit is working perfectly but I need it to be connected with an 8051 to act as a switch.

even If i remove the circuit from acting as an input to the micro controller it is giving an output voltage of 2.5v

So, at the first time, your comparator was working and now it is not? Just replace your LM339.
The output only can be 0V or 5V (with pull up). When it becomes 2.5V, i think there's symmetrical frequency carried by LM339 and 2.5V is average output voltage. Please check the input voltage first. Or maybe the difference is two inputs is to small and output can not be stable. You maybe need add an hysteresis.
 
  • Like
Reactions: KerimF

    KerimF

    Points: 2
    Helpful Answer Positive Rating
Only now I noticed the pin numbers... They are not for LM339... right?

Sorry I confused it with LM324 :sad:
 

So, at the first time, your comparator was working and now it is not? Just replace your LM339.
The output only can be 0V or 5V (with pull up). When it becomes 2.5V, i think there's symmetrical frequency carried by LM339 and 2.5V is average output voltage. Please check the input voltage first. Or maybe the difference is two inputs is to small and output can not be stable. You maybe need add an hysteresis.


It actually is working , the only problem is that the output voltage is not that of 5v .
 

So you are 100% sure it is 2.5 Vdc and not average... real weird!

If this happens to me ... I may not be able to sleep well :smile:
 

So you are 100% sure it is 2.5 Vdc and not average... real weird!

If this happens to me ... I may not be able to sleep well :smile:

What do you mean with average ???

---------- Post added at 18:16 ---------- Previous post was at 18:13 ----------

I have replaced the Ic , the same voltages were given at the output .
 

I'll try to answer but i'm not sure anyway :| . Try replace it with all another chip that you have, measure input and output with an oscilloscope to make sure there is no wave on them. And make sure you have a good power supply (no ripple at all). Or try change to lower pull up resistor value. If it still doesn't work, try check the basic checking procedure (PCB, cable, soldering, bad connection, short connection, etc). And if you want to buy a new one, choose it from different factory and different store (maybe there are different characteristics).

---------- Post added at 00:23 ---------- Previous post was at 00:18 ----------

What do you mean with average ???

---------- Post added at 18:16 ---------- Previous post was at 18:13 ----------

I have replaced the Ic , the same voltages were given at the output .

Average of 0V and 5V, because the condition is switch for 0 to 5 quickly and repeatedly . If we use volt meter, the reading is average of this voltage, 2.5V. So, we must use oscilloscope to see it clearly.
 

the pull up is lowered to 2k2 , the voltage is pure 5v , the ic was also replaced.. im testing it on a breadboard ..I dont know what to do more ....

---------- Post added at 18:31 ---------- Previous post was at 18:25 ----------

So what do you suggest ? Because the controller still is reading it as low .
 

The only thing left to replace is the... breadboard :)
Did you measured the voltages of all LM339 pins?
Anytime this happens to me, I leave the circuit then I return to it after a good sleep. Always the fault was where I was sure there is no need to check :)
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top