Sine to square wave converter
Electronics Forum Index Electronics
Circuits, theory, electrons and discussions.
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web ElectronicsHelp.net
Sine to square wave converter
Goto page 1, 2  Next
 
Post new topic   Reply to topic    Electronics Forum Index -> Basics
Author Message
Jack// ani
Guest





Posted: Thu Mar 24, 2005 7:10 pm    Post subject: Sine to square wave converter Reply with quote

Hi all,

How can I convert 50Hz AC to a square wave so that I can feed it to a
microcontroller? Will CD4093 work here? I will steps down the ac to
5volts then use a diode in series before hooking it to CD4093?

Thanks

Back to top
Lord Garth
Guest





Posted: Thu Mar 24, 2005 7:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

"Jack// ani" <nospam4u_jack@yahoo.com> wrote in message
news:1111688349.178611.282570@l41g2000cwc.googlegroups.com...
Quote:
Hi all,

How can I convert 50Hz AC to a square wave so that I can feed it to a
microcontroller? Will CD4093 work here? I will steps down the ac to
5volts then use a diode in series before hooking it to CD4093?

Thanks


This will explain how you should proceed:

http://www.web-ee.com/primers/files/AN-140.pdf
Back to top
Jack// ani
Guest





Posted: Thu Mar 24, 2005 7:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

Thanks for reply Lord. Unfortunately link is dead!

Back to top
Jack// ani
Guest





Posted: Thu Mar 24, 2005 7:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

Whoops, i'm sorry the link is working! Something was wrong here!
Back to top
Lord Garth
Guest





Posted: Thu Mar 24, 2005 7:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

"Jack// ani" <nospam4u_jack@yahoo.com> wrote in message
news:1111689339.387719.13490@o13g2000cwo.googlegroups.com...
Quote:
Thanks for reply Lord. Unfortunately link is dead!

Not from here though it is slow....send an email address or I can post

it to alt.binaries.schematics.electronic
Back to top
John Woodgate
Guest





Posted: Thu Mar 24, 2005 10:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

I read in sci.electronics.design that Jack// ani
<nospam4u_jack@yahoo.com> wrote (in
<1111689339.387719.13490@o13g2000cwo.googlegroups.com>) about 'Sine to
square wave converter', on Thu, 24 Mar 2005:
Quote:
Thanks for reply Lord. Unfortunately link is dead!

IE6 barfs badly, but Firefox retrieves it OK. I'm having the same

problem with PDFs from other sites, using IE 6 and Acrobat 6.
--
Regards, John Woodgate, OOO - Own Opinions Only.
There are two sides to every question, except
'What is a Moebius strip?'
http://www.jmwa.demon.co.uk Also see http://www.isce.org.uk
Back to top
RST Engineering (jw)
Guest





Posted: Thu Mar 24, 2005 10:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

There are trivial ways to do it...it all depends on how "square" square must
be. Do you absolutely HAVE to have 50.000% duty cycle, or are you only
worried about using it as a leading (or falling) edge clock. Do you have
any spare circuits in another multi-circuit chip, or do you have room for a
dedicated chip. Tell us what matters to you and we'll have a shot at making
the sucker go.



Jim



"Jack// ani" <nospam4u_jack@yahoo.com> wrote in message
news:1111688349.178611.282570@l41g2000cwc.googlegroups.com...
Quote:
Hi all,

How can I convert 50Hz AC to a square wave so that I can feed it to a
microcontroller? Will CD4093 work here? I will steps down the ac to
5volts then use a diode in series before hooking it to CD4093?

Thanks
Back to top
Guest






Posted: Thu Mar 24, 2005 10:10 pm    Post subject: Re: Sine to square wave converter Reply with quote

If a 50% duty cycle is important, a zero-cross detector into a D
flip-flop as divide by 2 would get pretty close.
GG
Back to top
Pooh Bear
Guest





Posted: Fri Mar 25, 2005 1:10 am    Post subject: Re: Sine to square wave converter Reply with quote

Jack// ani wrote:

Quote:
Thanks for reply Lord. Unfortunately link is dead!

Works fine for me.


Graham
Back to top
Robert Monsen
Guest





Posted: Fri Mar 25, 2005 1:10 am    Post subject: Re: Sine to square wave converter Reply with quote

Jack// ani wrote:
Quote:
Hi all,

How can I convert 50Hz AC to a square wave so that I can feed it to a
microcontroller? Will CD4093 work here? I will steps down the ac to
5volts then use a diode in series before hooking it to CD4093?

Thanks


One simple way is to use a large value resistor, like 1MEG, into the
base of an NPN transistor. The emitter should be grounded, and the
collector tied to your +5V power supply rail through a 100k resistor.
Take the output from the collector of the transistor. Note that for this
to work, your power supply should have it's ground someplace near earth
ground.

One problem with this is that the base goes very negative. This can be a
problem. Thus, if you use a diode from ground to base, if the input goes
very negative (which it will, of course) the diode will keep it within
about 7/10 of a volt of the ground.

So

VCC
|
.-.
| | 100k
| |
'-'
|
o------ PIC Input
|
1MEG |
___ |/
AC IN -|___|----o----|
| |>
| |
- |
^ |
| |
| |
GND ------------o------'
(must be near neutral)
(created by AACircuit v1.28.5 beta 02/06/05 www.tech-chat.de)

This is probably going to be fast enough so that the PIC will only see
one transition for each transition of the AC line. However, if it isn't,
you can build a simple schmitt trigger out of two transistor that will
prevent false triggering.

That would be like this (which is swiped out of Art of Electronics,
Volume 2)

.--------------o--------- VCC
| |
.-. .-.
| | 1.5k | |1k
| | | |
'-' '-'
| ___ |
o---|___|--. o------Output to PIC
| 10k | |
1MEG | | |
___ |/ | |/
AC IN -|___|----o----| '-|
| |> |>
| | |
- '------o-------'
^ |
| 100R |
| ___ |
GND ------------o----|___|----'
(must be near neutral)

(created by AACircuit v1.28.5 beta 02/06/05 www.tech-chat.de)

However, I think the first circuit is probably ok.

--
Regards,
Robert Monsen

"Your Highness, I have no need of this hypothesis."
- Pierre Laplace (1749-1827), to Napoleon,
on why his works on celestial mechanics make no mention of God.
Back to top
mike
Guest





Posted: Fri Mar 25, 2005 7:10 am    Post subject: Re: Sine to square wave converter Reply with quote

Robert Monsen wrote:
Quote:
Jack// ani wrote:

Hi all,

How can I convert 50Hz AC to a square wave so that I can feed it to a
microcontroller? Will CD4093 work here? I will steps down the ac to
5volts then use a diode in series before hooking it to CD4093?

Thanks


One simple way is to use a large value resistor, like 1MEG, into the
base of an NPN transistor. The emitter should be grounded, and the
collector tied to your +5V power supply rail through a 100k resistor.
Take the output from the collector of the transistor. Note that for this
to work, your power supply should have it's ground someplace near earth
ground.

One problem with this is that the base goes very negative. This can be a
problem. Thus, if you use a diode from ground to base, if the input goes
very negative (which it will, of course) the diode will keep it within
about 7/10 of a volt of the ground.

So

VCC
|
.-.
| | 100k
| |
'-'
|
o------ PIC Input
|
1MEG |
___ |/
AC IN -|___|----o----|
| |
| |
- |
^ |
| |
| |
GND ------------o------'
(must be near neutral)
(created by AACircuit v1.28.5 beta 02/06/05 www.tech-chat.de)

This is probably going to be fast enough so that the PIC will only see
one transition for each transition of the AC line. However, if it isn't,
you can build a simple schmitt trigger out of two transistor that will
prevent false triggering.

That would be like this (which is swiped out of Art of Electronics,
Volume 2)

.--------------o--------- VCC
| |
.-. .-.
| | 1.5k | |1k
| | | |
'-' '-'
| ___ |
o---|___|--. o------Output to PIC
| 10k | |
1MEG | | |
___ |/ | |/
AC IN -|___|----o----| '-|
| |> |
| | |
- '------o-------'
^ |
| 100R |
| ___ |
GND ------------o----|___|----'
(must be near neutral)

(created by AACircuit v1.28.5 beta 02/06/05 www.tech-chat.de)

However, I think the first circuit is probably ok.


All depends on what you're trying to do.
If all you need is line synchronization...
On PIC16F877A, I've used a voltage divider directly into the input.
The inputs are clamped. As long as you have enough series resistance to
limit the current, it should work ok. External clamps are even safer.
Transistor is better. You can spend as much as you like.
Use SW to mitigate noise.
Assume you have mains isolation.
mike

--
Return address is VALID but some sites block emails
with links. Delete this sig when replying.
..
Wanted, PCMCIA SCSI Card for HP m820 CDRW.
FS 500MHz Tek DSOscilloscope TDS540 Make Offer
Wanted, 12.1" LCD for Gateway Solo 5300. Samsung LT121SU-121
Wanted 13" LCD for Mitac 6133 Samsung HT13X13-201
Bunch of stuff For Sale and Wanted at the link below.
MAKE THE OBVIOUS CHANGES TO THE LINK
ht<removethis>tp://www.geocities.com/SiliconValley/Monitor/4710/
Back to top
Fred Bloggs
Guest





Posted: Fri Mar 25, 2005 7:10 am    Post subject: Re: Sine to square wave converter Reply with quote

Jack// ani wrote:
Quote:
Hi all,

How can I convert 50Hz AC to a square wave so that I can feed it to a
microcontroller? Will CD4093 work here? I will steps down the ac to
5volts then use a diode in series before hooking it to CD4093?

Thanks


It depends on what powers your logic circuit and what it needs the 50Hz
square wave for. You can't just couple a voltage off the line into a GND
referenced circuit and expect it to work trouble free. Also, most
circuits are looking for zero-crossing on the AC- waveform and this is
difficult to get with the massive attenuation required of a line voltage
in conjunction with the fairly large uncertainties of typical Schmitt
trigger thresholds and hysteresis. You will get a square wave, but it
may not be of much use.
Back to top
John Fields
Guest





Posted: Tue Sep 20, 2005 10:14 pm    Post subject: Re: newbie:Simple LED sequence? Reply with quote

On Tue, 20 Sep 2005 00:57:30 GMT, ehsjr <ehsjr@bellatlantic.net>
wrote:

Quote:
John Fields wrote:

---
I understand the fascination with microcontrollers, but in an
application where one isn't warranted, it's just wasteful to design
one in. Consider the OP's application, a simple four-position
marquee scroller, and it becomes evident (to me, anyway) that $1 for
a PIC VS about fifty cents' worth of glue logic for the same
function makes the PIC unattractive. Plus, even with a free
programmer and development system there's still the learning curve
to climb.



It was another damn "use a PIC" post. Some of these posters drive
me crazy. Never a "Wow John, you sure put a lot of work into that,
nice job!" Never a complete project, with a schematic and source
code. Just "you could use a PIC". Hell, if you did what those
pic-ophiles do, your posts would say "use a soldering iron."
One thing's for sure - we can't criticize the PIC designs posted as
solutions to requests from posters. I'll tell you this, I'll put
any one of the solutions you've offered in the newsgroup against
all of the posted "PIC solutions", combined. Your solutions are
always great. Theirs are non-existant.

Ed

---

Thanks! :-)


--
John Fields
Professional Circuit Designer
Back to top
Terry Pinnell
Guest





Posted: Tue Sep 20, 2005 10:15 pm    Post subject: Re: newbie:Simple LED sequence? Reply with quote

ehsjr <ehsjr@bellatlantic.net> wrote:


Quote:
It was another damn "use a PIC" post. Some of these posters drive
me crazy. Never a "Wow John, you sure put a lot of work into that,
nice job!" Never a complete project, with a schematic and source
code. Just "you could use a PIC". Hell, if you did what those
pic-ophiles do, your posts would say "use a soldering iron."
One thing's for sure - we can't criticize the PIC designs posted as
solutions to requests from posters. I'll tell you this, I'll put
any one of the solutions you've offered in the newsgroup against
all of the posted "PIC solutions", combined. Your solutions are
always great. Theirs are non-existant.

Agreed. I could probably have made a movie of it in the time it would

take a PIC-er to just get started! Here it is:
http://www.terrypin.dial.pipex.com/Images/LED-Sequencer4MB.wmv

--
Terry Pinnell
Hobbyist, West Sussex, UK
Back to top
marika
Guest





Posted: Wed Sep 21, 2005 12:35 am    Post subject: Re: newbie:Simple LED sequence? Reply with quote

Terry Pinnell wrote:
Quote:

Agreed. I could probably have made a movie of it in the time it would
take a PIC-er to just get started! Here it is:
http://www.terrypin.dial.pipex.com/Images/LED-Sequencer4MB.wmv


thanks for this great freakin link!!!!

mk5000

"...aside from uknova.com. Anyone know any good ones?
While uknova is a good site for certain shows, I find that you usually
get zero response to requests for stuff not already torrented. The
fact that the mods don't allow you to bump your requests on the forum
doesn't help either, as the volume of traffic means that your post
soon drops off the page... "-- a single locust
Back to top
 
Post new topic   Reply to topic    Electronics Forum Index -> Basics All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Home & Living New Topics
Powered by phpBB