DC voltage converted to square wave?

Discussion in 'General Electronics Chat' started by Eurokid, May 7, 2011.

1. Eurokid Thread Starter New Member

May 7, 2011
2
0
I have a pressure switch that puts out 0 to 5 VDC. I need to convert this signal to a square wave but I'm not sure how to go about doing it. Do I have to convert it to AC then to a square wave? or can i go from DC to square wave? I recently developed a interest in electronics so my knowledge of the subject is limited. Any help would be great.

2. Jaguarjoe Active Member

Apr 7, 2010
770
90
What is the frequency range that you need? You may be able to program a cheap microcontroller to do what you need. Search for Arduino, they might have an existing design/program that does what you need. There are also IC's that convert voltage to frequency, I think National Semiconductor makes one.

http://www.national.com/ds/LM/LM231.pdf

Last edited: May 7, 2011
3. wmodavis Well-Known Member

Oct 23, 2010
737
150
Does the 0-5V vary in an analog fashion from zero to five volts or is it either 0 volts or 5 volts as suggested by your use of the term 'switch'? If it is in fact a pressure switch it should easily provide a square wavepretty much directly. A little more information on the functionality you want/need would be helpful in order to give you some helpful direction.

4. Eurokid Thread Starter New Member

May 7, 2011
2
0
Last edited: May 7, 2011
5. Jaguarjoe Active Member

Apr 7, 2010
770
90
You are not making square waves. You are generating a PWM (pulse width modulation) signal. The duty cycle of a square wave is fixed at 50%.
This chip will generate a fixed frequency 0-100% variable duty cycle signal from a 0-5 volt input:

http://www.maxim-ic.com/app-notes/index.mvp/id/4502

You will need to massage the 0-5v input to limit the PWM output to your desired range of 50-90%. As shown, it runs at 500Hz. That can be changed by choosing different R's and C's.

You can get free samples of this chip from Maxim.

6. DerStrom8 Well-Known Member

Feb 20, 2011
2,428
1,329
You could probably just use a 555 timer in astable mode, couldn't you? It would be a lot simpler. I can post a simple PWM circuit, if you're interested.
Der Strom

7. Jessica Webb New Member

Nov 5, 2014
2
0
I am interested.

8. GopherT AAC Fanatic!

Nov 23, 2012
6,339
4,090
That offer was 3 1/2 years old. Why don't you start a new thread and tell us what you need.

9. DerStrom8 Well-Known Member

Feb 20, 2011
2,428
1,329
Hi Jessica,

As pointed out, this thread is quite old. However, seeing as this is still on-topic I will go ahead and post it.

Here is the PWM circuit I generally use. It is based around a 555 timer and a 393 comparator:

It is possible to create a PWM circuit with just one 555 timer, but it is much less accurate, and the frequency and duty cycle are not adjustable independently. I have found this circuit to be far superior.

Hope this helps!
Regards,
Matt

10. Jessica Webb New Member

Nov 5, 2014
2
0
It does help, it does... except I figured out the problem in my original design---<snip> misconnected wire. TT

Thank-you so much for restoring my faith in the 555 timer. All roads lead to... well, this design.

Edit: deleted expletive.

Last edited by a moderator: Nov 5, 2014

Feb 20, 2011
2,428
1,329