10 posts / 0 new
Author
Message

i want to make a simple but accurate zero crossing detector whose input is an ac sine wave and its output is digital signal(0 and 5V).
what i am doing is using LM339 to make it, if i use single 5V supply power, it is easy but no one have mentioned this before(simulation also tells it is unsteady), but if i use split power supply , i don't know whether the one(74LS04) can endure the negative voltage for a long time.

## Attachment(s):

Our Martians are beginning to learn AVR

What you can do is run the LM339 off + and - supplies and on the output put a 1K resistor to 5V and then stuff that into your logic chip.

Good luck

i have tried this, but the result is that it outputs +5v and a negative voltage.
what i am meditating is whether the digital IC is able to endure the negative voltage(-18V), and if it can endure, it can last a long time to keep steady??

Our Martians are beginning to learn AVR

No, the digital IC won't like the negative voltages. In the datasheet you'll find a section 'Absolute maximum ratings', usually there's a item that says 'Max input voltage' that says 'VCC+0.7V and GND-0.7V". -18V surely violates this :D

If you put a resistor (say 1K) in series from the opamp output to the logic gate input, the resistor and the input protection diode that's built in the gate will clamp the negative voltage to ~-0.7V and keep the current through the diode small enough (this diode has a max.rating too). And the aforementioned pull-up resistor is needed too.

got it! you say just puting a resistance between LM339 and 74LS04 will make it ok . it is so simple. several hours ago, i place an ac sine wave(+-18V) to the AVR MCU, but i forgot to add a resistance, then the microcontroller sees the lord in the heaven in a few seconds.

Our Martians are beginning to learn AVR

yyw794 wrote:
i have tried this, but the result is that it outputs +5v and a negative voltage.

Sorry, there is also a diode to ground on the output of the comparator to clamp the negative voltage.

Thanks for pointing that out as the prototype has been running with this diode omitted for the last 3 weeks!

Another real simple idea is to place a diode in series with the gate. Anode to the comparator, cathode to the gate. Then add a pull down resistor to the cathode of the diode to ground. The diode prevents the negative voltage from passing.

Another option is to use a comparator that has an isolated output. Take a look at the LM311.

Jim

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown

Atmel Studio6.2/AS7, DipTrace, Quartus, MPLAB, RSLogix user

Indeed, i have simulated the above methods before, but the simulation result is not like we have imagined( i use diode 1n4148 )

Our Martians are beginning to learn AVR

the best way is using LM311. but i lack of LM311, so i use LM311's schematic diagram to change LM339. i place a transistor following the LM339, its emitter to the GND, and its collector plus a 10k resistance to the +5V. then it is done!

Our Martians are beginning to learn AVR

Excellent work Marty the Martian!!

I would rather attempt something great and fail, than attempt nothing and succeed - Fortune Cookie

"The critical shortage here is not stuff, but time." - Johan Ekdahl

"Step N is required before you can do step N+1!" - ka7ehk

"If you want a career with a known path - become an undertaker. Dead people don't sue!" - Kartman

"Why is there a "Highway to Hell" and only a "Stairway to Heaven"? A prediction of the expected traffic load?"  - Lee "theusch"

Speak sweetly. It makes your words easier to digest when at a later date you have to eat them ;-)  - Source Unknown