555 Function Generator

Discussion in 'The Projects Forum' started by Wendy, Jun 17, 2008.

  1. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    I owe everyone who helped me with this thread an apology...

    http://forum.allaboutcircuits.com/showthread.php?t=10936

    I dropped the ball. I did do some preliminary measurements with my oscope, but a fellow Mason and DeMolay advisor who does DJ duty with a really nice, expensive, barely portable setup heard I had a oscope and asked if he could borrow it, and of course I said yes. This is what is driving my PC Oscope project on another thread.

    Anyhow, I had a brainstorm. Somewhere I've seen this circuit...

    [​IMG]

    Don't remember where. I believe it would use something very close to the standard 555 formula to calculate the frequency.

    \huge F = \frac{.7}{RC}

    Anyhow, using the concept from the previous post, I expanded the idea to this...

    [​IMG]

    And for something that might be usable for a home brewed test equipment, I took it one step further...

    [​IMG]


    I've said this before, but the sine wave isn't pure. You couldn't tell this by looking at it though. I ran a computer program to show the two overlapping each other...


    [​IMG]

    The green line is a reference sine wave, while the blue is the expected output of the above circuit.

    It's going to be a while before I can look at it, but this might have possiblities. What do you think?
     
    Last edited: Jun 17, 2008
  2. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    The sinewave isn't pure, but quite an approximation. Since you integrated a square wave two times, you are expected to get a "quadratic" function. Note the parabolas overlapping.

    I though on doing a UPS using a 555, but I think it might have problems of stability.
     
  3. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    That's how I did it in the GW Basic program. Never did figure out how to transfer the image using the computer, what you are seeing is a photograph of the display. :rolleyes:

    The really funny thing is, technically it is a second order low pass active filter.

    It would be easy to sync the basic 555 to a more stable reference. For that matter, give up on the 555 and use a precision oscillator with a square wave output and use the 2 integrators afterwards. I think the 555 would be stable enough by itself to use though, invertors aren't that precision to begin with.

    Something else, Pin 5 of the 555 would make a dandy VCO. I suspect with this design it would become even more linear, although the triangle and sinewave would have no DC baseline stability. The square wave would be good though.

    Figure 1 is a probable way of doing a Class D amp, the triangle wave being a core component of one. Add a different section that uses the sine wave and you have most of an invertor in a handful of parts.

    The more I've used the 555 over the years, the more I've liked it.
     
    Last edited: Jun 17, 2008
  4. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    You used two integrators in a chain. An op-amp integrator resembles an active low-pass filter, but doesn't have a resistor going from the output to the - input. Just to clear some confusion.

    By setting a voltage or a resistance pin 5 you are adjusting the internal voltage divider. Thus you are adjusting the pulse with and also the frequency.
     
  5. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    I've been boning up on two text books on the subject lately, The Active Filter Handbook, and Design of Active Filters, with Experiments. I think I could argue this point if I were so inclined. These are core components of multi order filters, just like a simple RC circuit is a 1st order filter.

    Take another look at a Schmitt Oscillator, the DC baselines of the triangle wave changes, but it remains a square wave (other than the transitional change on the edge). The square wave is a function of the triangle wave, which remains symmetrical on the two slopes, much like a ADC.
     
  6. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    656
    The second integrator is running with no DC feedback. Any DC offset in the output of the first integrator or the input of the second op amp, or duty cycle error from the first integrator, will cause the second integrator to "bump its head" on one of the power supply rails, potentially leaving "flat spots" on either the positive or negative peaks.
     
  7. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    I hadn't thought of that. The other design, the first one, feed back all the way. I wonder if I feed the sine wave back to the 555 whether that would work? I'm going to have to percolate on it. I would be interested in your ideas, if you have any.

    I was thinking of using some very large capacitors and resistors (around 100KΩ), for very slow sine waves.

    I could have the same problem between the op amps on this layout.

    [​IMG]
     
    Last edited: Jun 19, 2008
  8. The Electrician

    AAC Fanatic!

    Oct 9, 2007
    2,281
    326
    Bill, in another thread you wondered what the distortion of your sine wave approximation was.

    FYI, the distortion of two parabolas stuck together to approximate a sine wave is 3.8%.
     
  9. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    Thanks guy.

    OK, lets try another approach, the triangle wave should be extremely stable, both in amplitude and waveform. If I put 2 diodes into a log amp, how close do you think I could get? This could have some advantages, assuming it works at all, in that the frequency control components are brought down to just one resistor and one capacitor.
     
  10. Ron H

    AAC Fanatic!

    Apr 14, 2005
    7,050
    656
    National's AN-263 has triangle-to-sine shaping circuits.
     
  11. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    This approach remembered me of a Taylor series of a sine. You could use that approximation to create a sine wave.

    Out with the Taylor series, lets have, for an interval:
    f (x) = A, A constant (square wave peak)

    The integer will be:
    g (x) = Ax + B, A and B constants (A is triangular wave slope and B is DC offset)

    And the second integer will be:
    h (x) = Ax^2 + Bx + C, A B and C constants

    Basically, you are integrating these functions inside certain intervals. By setting the constants A, B and C (B and C are set with resistors), you can adjust the waveforms so the parts will coincide when the square wave signal changes value.
     
  12. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    Could you translate that into a circuit, perhaps? I still haven't figured out how to stop the DC offset from adding up. I've been working hard on the Oscope, my prototype (1st of 3) is almost finished. I hadn't thought of it before, but it is also a spectrum analyzer, which should show waveform purity.

    When I get an time I'll put up my other ideas. So many things, so few hours, including that job thing that allows all the others.
     
  13. cumesoftware

    Senior Member

    Apr 27, 2007
    1,330
    10
    It is basically the circuit you presented, with two integrators on a chain.
     
  14. RmACK

    Active Member

    Nov 23, 2007
    54
    0
    I did see somewhere an example of creating a sine from a square wave literally by filtering out the harmonics. You need an incredibly steep filter. It was probably something similar to that AN263 link (didn't work for me) but was an IC that allowed you to fairly simply implement a 7 or 8th order switched capacitor filter. I'm really glad I'm not the only person trying to crack this problem! Your quadratic function from the double integrator *looks* pretty good though 3% is fairly high distortion. I don't suppose you have an fft of that handy?
     
  15. SgtWookie

    Expert

    Jul 17, 2007
    22,182
    1,728
  16. RmACK

    Active Member

    Nov 23, 2007
    54
    0
    Thanks for the good link. I had not seen that very interesting app note! :)
     
  17. Audioguru

    New Member

    Dec 20, 2007
    9,411
    896
    I made an extremely low distortion sine-wave signal generator with a CD4018 stepper making a sine-wave with 10 steps, then filtering it with a switched capacitor lowpass filter. My distortion analyser used a switched capacitor notch filter that had the same high frequency oscillator as the generator for good tracking.
     
  18. RmACK

    Active Member

    Nov 23, 2007
    54
    0
    That's very interesting. Good idea using the same clock.

    I actually implemented a 16 point sine in a PIC16F722 using both hardware pwm registers each for the bottom fets of a centre tapped transformer. The PIC was fast enough to take an ADC from a pot to adjust the frequency although the overheads were big so I couldn't adjust the frequency to more than 0.5Hz accuracy. Another ADC was also performed between each of the 16 points to adjust the amplitude of the sine wave. Of course I was generating a 50Hz sine with a 20khz pwm so an 8MHz micro could keep up.

    I had a small transformer with a rectifier & minimal rc network running off the inverter's output feed the amplitude adc for feedback voltage control. I had a very slow loop -I turn on a desk lamp & then see it brighten up over a second or 2. Concept worked well though! Not sure how much the pic I used cost. My flatmate had one in a nice dev board so I just borrowed the whole board....

    The transformer did an ok job of filtering the sine but could have been better. It filtered the 20khz quite well but still didn't hide the fact that it was only a 16 sample sine. Still wasn't bad tho.
     
  19. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    Seems I've done it again, and stuck my foot in it. I'm getting good at that. SgtWookie pointed out a problem with the design I've been touting, so I breadboarded it using this schematic.

    [​IMG]

    You look at it, and all I've done is make a fancy set reset flip flop. DOH!

    So I tried this one.

    [​IMG]

    No Joy, it oscillates at 72Khz, but that is all.

    The good news is I have my oxcope I loaned out back, so I can take a real look at some waveforms. I'm going to try some experiments to see if I can't get this concept to work, basically a Schmitt Trigger with an intigrator to make a good square wave and triangle wave with minimum parts, and one simple component to vary the frequency. I know it can be done other ways, but I want this one to work. I'll post results as I get them, I may have to stop putting the pretty pictures up as I have been, I'm running out of room in my albums, so I'll probably have to start attaching the pictures instead. Nothing like shooting yourself in the foot twice.
     
  20. Wendy

    Thread Starter Moderator

    Mar 24, 2008
    20,764
    2,534
    OK, the solution was simple enough. This is a verified schematic.

    [​IMG]

    Measured frequency was 1349Hz, calculated was 1489Hz. I don't put too much faith in the formula anyhow, I haven't gone through the process to verify it.

    The waveform was not 50% duty cycle, but it wasn't 50% using the 555 as a straight Schmitt Trigger oscillator either. I've built enough of those that I suspect 555 I was using. The triangle was extremely clean though, if not a perfect duty cycle.

    I also found out my old HP120 Oscope isn't very high impedance on the input either, but then I'm using meter leads for its banana plug inputs. :p
     
Loading...