All About Circuits Forum Sine wave generation - logarithmic shaping
 User Name Remember Me? Password
 Register Blogs FAQ Members List Today's Posts Search Today's Posts Mark Forums Read

 Notices Welcome to the All About Circuits forums.Our forum is a place where thousands of students, hobbyists and professionals from around the world share knowledge and ideas. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact us.

 General Electronics Chat Discussion forum for general chat about anything electronics related, including asking questions about material in the All About Circuits E-book, Worksheets, and Videos.

#1
01-04-2011, 04:03 AM
 Veracohr Senior Member Join Date: Jan 2011 Posts: 246
Sine wave generation - logarithmic shaping

Greetings!

Could anyone possibly explain, from National Semiconductor's AN-263 "Sine Wave Generation Techniques" page 11 - Logarithmic Shaping, how the "logarithmic relationship between Vbe and collector current in transistors" shapes a triangle wave to an approximation of a sine wave? Maybe my math isn't up to the task, but I don't see how a logarithmic response becomes a sine wave.

http://www.national.com/an/AN/AN-263.pdf

I wasn't able to get this shaper working, although admittedly I changed it based on what I have at hand. Still, I always understand circuits better when I know the why as well as the how.

Thanks!
#2
01-04-2011, 04:33 AM
 thatoneguy Senior Member Join Date: Feb 2009 Location: Midwest USA Posts: 6,356 Blog Entries: 4

It's math, essentially.

integrate square wave = triangle wave
integrate triangle wave = sine wave

differentiate sine wave = triangle wave
differentiate triangle wave = square wave

When you integrate or differentiate some waveforms, you will often find a natural logarithm or exponent show up.
__________________
$\small{\fra{1}{\fra{1}{R_1}+\fra{1}{R_2}+{\dots}+{ \fra{1}{R_N}}}$ Nifty? -Click Here to see how to make your formulas Look GOOD!
Bypass Caps! Read Me
Also-Impedance Graph paper.
#3
01-04-2011, 05:19 AM
 bitrex Member Join Date: Dec 2009 Posts: 79

The circuit you're looking at generates a sine wave from a triangle wave by using the properties of the differential pair of transistors contained in the LM394. The transconductance of a differential pair of transistors is defined to be:

$Gm = I_o*tanh(\frac{Vid}{2*VT})$

Where I_o is the tail current, Vid is the differential input voltage, and VT is the thermal voltage - 26 mV at room temeperature.

In the case of this circuit, the output voltage will be approximately:

$V_o = \frac{RL*I_o*tanh(\frac{Vid}{2*VT})}{2}$

Where RL is the 100 ohm load resistor on the output. The division by 2 happens because you're only taking a single ended output, not a differential output.

So the output voltage will be a function of the input voltage and the hyperbolic tangent. The first few terms of the Taylor series of the sine and hyperbolic tangent functions are:

Sine: $x - \frac{x^3}{3!} + \frac{x^5}{5!} ...$

Hyperbolic Tangent: $x - \frac{x^3}{3} + \frac{2x^5}{15} ...$

If you compare the two Taylor series you will see that they are both linear to first order. What this means is that if you apply a triangle wave to a differential pair with a hyperbolic tangent transfer function, and keep the amplitude _low_, what you get out should be indistinguishable from a sine wave! That's the purpose of the two 5k resistors and the 200 ohm resistor in the circuit going into the differential pair - it's to divide down the triangle wave signal from the oscillator in an attempt to keep the circuit operating in the amplitude range where the output is a low distortion sine wave.

You can take a look at this paper for some more of the math involving analysis of a similar circuit, including THD calculations:

http://electrooptical.net/www/sed/TanhSineShaper.pdf

The original National paper certainly doesn't explain the method very well, but the hyperbolic tangent approximation to a sine is what the circuit you refer to is using.

Last edited by bitrex; 01-04-2011 at 05:26 AM.
#4
01-04-2011, 05:29 AM
 Kermit2 Senior Member Join Date: Feb 2010 Posts: 2,420

Visualize the difference in a linear graph and a Log graph.

The lines in a log graph get closer together as you go from 1 to 10.

A sine wave shape on a linear graph will produce an almost straight line on a log graph.

Therefore a linear voltage ramp (triangle wave) can generate a sine wave if the resistance (base/emitter) has a logarithmic response to current flow in the collector.

When graphed linearly of course!
__________________
I'm too old.
#5
01-04-2011, 05:33 AM
 Veracohr Senior Member Join Date: Jan 2011 Posts: 246

Aha! Thank you bitrex!
#6
01-05-2011, 02:48 AM
 Veracohr Senior Member Join Date: Jan 2011 Posts: 246

Quote:
 Originally Posted by Alberto More simply because the circuit uses a RC function to obtain the sine aproximation. And the time required for the voltage to fall to V0/2.718281 is called the RC time constant (where 2.718281 is the natural log base) Cheers Alberto
bitrex's explanation made sense but your simpler one doesn't. There's no capacitor in the circuit after the triangle-producing integrator. The notes specifically say "The LM394 dual transistor is used to generate the actual shaping..."
#7
01-05-2011, 03:02 AM
 Audioguru Banned Join Date: Dec 2007 Location: Ontario, Canada Posts: 9,411

It was a 40 years old way to make a pretty poor sine-wave.

About 10 years ago I made a stepped sine-wave from a CD4018 digital IC. It had 10 steps. It made an "oversampled" sine-wave. Then I used a switched-capacitor 8th-order Butterworth lowpass filter IC to remove the remaining harmonics so the distortion was only 0.005% or less.
#8
01-05-2011, 03:24 AM
 Bill_Marsden Super Moderator Join Date: Mar 2008 Location: Dallas, TX (GMT-5 w/ DST) Posts: 19,044 Blog Entries: 5

As AudioGuru says, it can get you in the ball park without being perfect. I've used back to back diodes, and just looking at it it is hard to tell the difference. However, overlay it with a good sine wave and it jumps out at you.

555 Function Generator
__________________
..
"Good enough is enemy of the best." An old engineering saying, Author unknown.

General info:
If you have a question, please start a thread/topic. I do not provide gratis assistance via PM nor E-mail, as that would violate the intent of this Board, which is sharing knowledge ... and deprives you of other knowledgeable input. Thanks for the verbage Wookie.
#9
01-05-2011, 03:29 AM
 Veracohr Senior Member Join Date: Jan 2011 Posts: 246

Quote:
 Originally Posted by Bill_Marsden As AudioGuru says, it can get you in the ball park without being perfect. I've used back to back diodes, and just looking at it it is hard to tell the difference. However, overlay it with a good sine wave and it jumps out at you. 555 Function Generator
I read that thread, and others here, but I wanted specifically to know about the logarithmic shaper thing. Not because it's better but because I wanted to know how it worked.

All in my poor-man's quest to try getting a sine wave for testing purposes without having to buy a proper function generator.
#10
01-05-2011, 04:53 AM
 Bill_Marsden Super Moderator Join Date: Mar 2008 Location: Dallas, TX (GMT-5 w/ DST) Posts: 19,044 Blog Entries: 5

Mine too, which is why I worked on that circuit (and will again). They sell a lot of function generator chips out there, which IMO is the best way to go around it. I don't like digital shaping circuits because the oscillator has to run at least 10X the output waveforms speed (probably more). If you are willing to truly shape the waveform you can use multiple diodes (8 or more) that slowly hand off the shaping duty when it enters the next circuits domain. Problem is, there are frequency response considerations, just because it works at one frequency doesn't mean it will work on another.

The dual diode method I explored is close enough for me. If I need a precision sine wave I'll build something that does it from scratch, and not worry about the other waveforms.

Bill's Index

Sine Wave Oscillators A PDF abstract by TI
__________________
..
"Good enough is enemy of the best." An old engineering saying, Author unknown.

General info:
If you have a question, please start a thread/topic. I do not provide gratis assistance via PM nor E-mail, as that would violate the intent of this Board, which is sharing knowledge ... and deprives you of other knowledgeable input. Thanks for the verbage Wookie.

 Tags generation, logarithmic, shaping, sine, wave

 Related Site Pages Section Title Worksheet Logarithms for analog circuits Worksheet Design Project: audio media-based signal generator Worksheet Design Project: Simple component curve-tracer circuit Worksheet Passive integrator and differentiator circuits Worksheet Mixed-frequency signals Textbook AC voltmeters and ammeters : Ac Metering Circuits Textbook More on spectrum analysis : Mixed-frequency Ac Signals Textbook Other waveshapes : Mixed-frequency Ac Signals Textbook Square wave signals : Mixed-frequency Ac Signals Video Lecture Generation of Alternating Voltage - Alternating Current

 Similar Threads Thread Thread Starter Forum Replies Last Post aliman1 The Projects Forum 23 12-10-2010 11:09 PM electronics1 General Electronics Chat 3 01-18-2010 02:48 AM ecslabsiuc The Projects Forum 2 09-23-2009 06:35 PM kahafeez The Projects Forum 13 12-16-2008 07:27 PM kaleanae Programmer's Corner 6 11-13-2007 08:22 AM

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Electronics Forums     General Electronics Chat     The Projects Forum     Homework Help     Electronics Resources Software, Microcomputing, and Communications Forums     Programmer's Corner     Embedded Systems and Microcontrollers     Computing and Networks     Radio and Communications Circuits and Projects     The Completed Projects Collection Abstract Forums     Math     Physics     General Science All About Circuits Commmunity Forums     Off-Topic     The Flea Market     Feedback and Suggestions

All times are GMT. The time now is 09:59 PM.

User-posted content, unless source quoted, is licensed under a Creative Commons Public Domain License.
Powered by vBulletin
Copyright ©2000 - 2014, vBulletin Solutions, Inc.