Sqare to Sine wave Converter

Projects that are not for RC, but are cool and worthy of development.
Post Reply
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Sqare to Sine wave Converter

Post by jhsa »

Is there any easy way of converting a square wave into a sine wave?
I would like to convert the audio signal from the beeper to a sine wave and then into the megasound board.. I think this would give a better quality vario sound, and other sounds in general I suppose

Thanks,

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Sqare to Sine wave Converter

Post by gohsthb »

http://keywon.com/wiki/index.php?title=Semiconductors
scroll down there is a circuit in the op-amp section.
Or plenty of circuits here:
https://www.google.com/search?q=sine+to ... B530%3B332

-Gohst
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Sqare to Sine wave Converter

Post by Flaps 30 »

This is where my favourite filter comes into effect.. The twin T filter.. :) ----> https://www.circuitlab.com/circuit/ks9m ... ch-filter/

Worth a look at this as something you can mess around with -----> http://www.youtube.com/watch?v=IIDp0nfPrts

I'm sure that there is a nice little block that is a narrow bandpass filter that is available from some Chinese supplier that would do the trick

I haven't measured the frequency of the beeper output from the MCU.. I take it that the output frequency is constant, or does it vary depending upon settings?
User avatar
Kilrah
Posts: 11109
Joined: Sat Feb 18, 2012 6:56 pm
Country: Switzerland

Re: Sqare to Sine wave Converter

Post by Kilrah »

Your links are for the opposite operation ;)

No, no "easy" way.

Sent via mobile
User avatar
Flaps 30
Posts: 1490
Joined: Tue Dec 27, 2011 6:04 pm
Country: -
Location: Wokingham Berkshire

Re: Sqare to Sine wave Converter

Post by Flaps 30 »

Kilrah wrote:No, no "easy" way.
That would be a sine wave oscillator with the output of it being switched on and off by the beeper signal. ;)

User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Sqare to Sine wave Converter

Post by jhsa »

Gohst thanks for the links. yeah, as Kilrah said I wanted the opposite ;)

Flaps30, thank you for your advice.. but I see that the circuit on the video is for a constant frequency.. it's working very well though as far as I understand..
So what would the options be to have a sine wave at the input of the amp?
Please no comments like "buy a Taranis or a skyboard" ;) :mrgreen:

maybe the atmega "Beeper pin" could output PWM, as always ;) and trigger another oscillator that would output the sine wave? like changing a voltage? I think I saw an instructable showing how to transform a Pwm Signal into a voltage, like a DAC does, using a resistor and a capacitor.
Thanks

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
gohsthb
Posts: 1412
Joined: Wed Dec 28, 2011 2:32 pm
Country: -
Location: Naperville, IL

Re: Sqare to Sine wave Converter

Post by gohsthb »

Well buy a Taranis then. Or just wait a few years for the Horus. :twisted: :mrgreen:

Wow, note to self have caffeine before reading and responding to posts.
-Gohst
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Sqare to Sine wave Converter

Post by jhsa »

Ggrrrrr :evil: :twisted: :mrgreen: :mrgreen:
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sqare to Sine wave Converter

Post by MikeB »

Several stages of RC filter. A square wave can be described as the sum of a number of sine waves:
sin(x) +(1/3)sin(3x) + (1/5)sin(5x) . . . .
Since you want just the sin(x) you need a filter to remove all the higher frequencies. The main problem is 3x isn't that much higher so is difficult to remove, hence several RC filters cascaded. They will get rid of the higher frequencies, phase shift the lower ones, and generally reduce the signal level.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Sqare to Sine wave Converter

Post by jhsa »

well, the signal level wouldn't be a big problem as we can just change the resistors at the input of the amplifier on the megasound module..
But I don't know if I'm understanding well (or maybe I didn't understand anything :) ).. would it work on the complete range of frequencies we need for the beeper signal?

would something like this be possible to achieve? even if we would have to make a little board with all those RC filters and find place for it inside the radio?

João
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Sqare to Sine wave Converter

Post by jhsa »

Found this:
http://interface.khm.de/index.php/lab/e ... generator/

If i well understand it works in a similar way to the sound module itself?

João

Also here. An atmega8 would probably do the job?

http://www.csulb.edu/~hill/ee470/Lab%20 ... erator.pdf

So would it be possible to sense the frequency of the beeper at one of the inputs and then produce a sine wave with equal frequence??.. This would require maybe a very little circuit board and glued on top of the megasound board, or even placed somewhere else.. it could maybe be powered by the 5V or even 3.3V regulator from the megasound?
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW
User avatar
thomas9x
Posts: 230
Joined: Wed Feb 29, 2012 3:12 am
Country: -
Location: USA

Re: Sqare to Sine wave Converter

Post by thomas9x »

For audio amp installations the Piezo signal's square wave sound quality can be enhanced with a simple RC filter. With this trick the tones I hear sound awesome (just as good as "real" sinewaves).

Here is a screen shot of my 9X voice circuit that shows the beep signal's filter that feeds the audio amplifier.
Piezo squarewave filter.
Piezo squarewave filter.
Details of the implementation are discussed here (with full schematics too):
http://www.rc-cam.com/forum/index.php?/ ... ject-blog/

- Thomas
User avatar
MikeB
9x Developer
Posts: 17993
Joined: Tue Dec 27, 2011 1:24 pm
Country: -
Location: Poole, Dorset, UK

Re: Sqare to Sine wave Converter

Post by MikeB »

The input circuit of the Megasound board for the piezo signal includes a 0.1uF capacitor and a 100K resistor, so C13 and R22 of this circuit shouldn't be needed for this.

If the volume level seems too low with this, try reducing the 100K on the Megasound board.

Mike.
erskyTx/er9x developer
The difficult we do immediately,
The impossible takes a little longer!
User avatar
jhsa
Posts: 19480
Joined: Tue Dec 27, 2011 5:13 pm
Country: Germany

Re: Sqare to Sine wave Converter

Post by jhsa »

Thanks Thomas.. I will give this circuit a try..
I will need to find a sketch for my arduino to generate some sounds emulating the 9x beeper output and see/hear the difference..
If it can really improve the vario beeps it would be nice ;)

João

EDIT: I know someone that might already be holding his soldering iron at this moment to try it.. ;)
Right Hans?? :mrgreen:
My er9x/Ersky9x/eepskye Video Tutorials
https://www.youtube.com/playlist?list=PL5uJhoD7sAKidZmkhMpYpp_qcuIqJXhb9

Donate to Er9x/Ersky9x:
https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YHX43JR3J7XGW

Post Reply

Return to “Other Electronic Projects”