Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Converting a square wave into sine wave using a D/A converte

Status
Not open for further replies.

khalifemazen

New Member
does anyone know how to convert a square wave from function generator into sine wave using a digital to analog converter ???
 
Re: Converting a square wave into sine wave using a D/A conv

khalifemazen said:
does anyone know how to convert a square wave from function generator into sine wave using a digital to analog converter ???

Square to sine isn't particularly easy!.

The only way that springs to mind is using a PIC (or similar) - measure the frequency of the incoming square wave, then output a stored sinewave of the same frequency through the D2A. The upper frequency will be limited by the speed of the PIC, and the number of samples used for the sinewave.

I don't know how 'realtime' this could be made though!.
 
square to sine

Hmmn... never thought of doing it that way. A low-pass filter that cuts off harmonics is another approach that would do away with much of the real-time lag.

Using a microcontroller, you could measure the period of the square wave and convert/scale to a number of appropriate precision (8-16 bits). Use this number as the period to sweep through a table of sine wave values (from what I remember, usually only the 1st quadrant is modeled, then mirrored and flipped to get the full sine wave). Output these values over the period and interpolate as needed. This may be helpful for table values.
 
Sorry to essentially repeat Nigels' suggestion, often multiple people are considering a problem and responding at approximately the same time.
 
hi

he sensor which i am working is a micro device which is a piezoelectric cantilever. I do not have any datasheet for this because it is fabricated by ourselves in our lab. I need to excite this device using the piezoelectric material with the help of a signal generator. The sensor has two pins. one input and one output. The output of the sensor usually ranges from microvolts to millivolts. So I feed the output to an current difference amplifier where I can read the signal in volts(2-3V). I also read its frequency. This is a moisture sensor. So when it is exposed to the atmosphere it senses moisture which results in a change in its frequency. Now I feed this signal back to the input but the amplitude should be really low in the range of 10mv-200mv because higher voltages result in its breakdown ( the sensing part of this device is far thinner than one strand of the hair). So I have tried using AGC in order to control the output amplitude of the amplifier to mV but that is really complicated as I can see a lot of noise in my circuit. So can you suggest me any simple circuitry which can serve my purpose. The other way to control this amplitude is to use a diode clamping circuit. But this generates a square wave and I cannot use this square wave to excite my device because it results in odd harmonics and I have to take a really good care of the frequency. So I am thinking of using a square to sine wave converter so that I can use the sinesoidal signal of amplitude 10-200mV to excite my device through the feedback. Hope I am clear this time. But if you have any questions further let me know.

Regards,
Deepika
 
Normally I would suggest a low pass filter to convert from square to sign. If you remove all the harmonics you get a sign.

From last time you posted this same question; you said the frequency changes over a wide range. Therefore a low pass filter will not work.

Good luck
 
A PLL circuit is just that. It controls a VCO to generate a sine wave locked to a square wave input.
Try using a 74hc46
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top