# sinewave to square signal

Discussion in 'The Projects Forum' started by jetcar, Jun 11, 2015.

1. ### jetcar Thread Starter New Member

Jun 11, 2015
2
0
i have sine wave signal and want to make from it square signal, which i can use in arduino to measure frequency from 100hz to 10000hz
voltage 12-60V. I have tried to use LM393N for that, but google gives many solutions and as i don't really understand why and where should i use certain resistors and capacitors. I don't want to spend lot of time learning all electronic things, because i't my first and maybe last thing i do, if there is some already done solution i can even buy it, but i haven't found any.
So can someone provide simplest solution for that with a little bit explanation why things are there, i'm programmer so everything which is logical i can understand and i know simple things about electricity what you can learn in school.
btw i use this thing http://www.zeitnitz.eu/scope_en to generate and listen output signal before connecting to real device but in most cases it it starts to show required signal because input and output have somehow connected by mistake.

Apr 5, 2008
17,120
3,001
3. ### MikeML AAC Fanatic!

Oct 2, 2009
5,451
1,071
Here is how I would do it: four parts only.

4. ### jetcar Thread Starter New Member

Jun 11, 2015
2
0
thanks, but can you explain why you use 10K resistances resistance is limiting current and i have lot of 600 Ohm resistances 60/600=0.1A which is still quiet low current or it is't and why diodes are in such direction as i know they allow electricity flow in one direction from + to - and arrow shows that direction, but it your circuit they are in opposite direction

5. ### MikeML AAC Fanatic!

Oct 2, 2009
5,451
1,071
The resistance needs to be high to mimimize the power in R1, and to limit the current injected back into the Arduino's 5V supply.
Diode D2 conducts when the input signal is more positive than 5V+Vf = ~5.6V, so clamps the positive excursions of the input.
Diode D1 conducts when the input signal is more negative than 0V-Vf = ~-o.6V, so clamps the negative excursions of the input.
R2 is a secondary current-limiter that acts with the protection diodes inside the Atmega chip.

Circuit is tried and true...