How to make a simple function generator?

Go To Last Post
17 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi - so I recently wrote some code for somebody that allows a computer to control an AVR so that it creates a square wave of a set frequency and with set on and off times. But I got to thinking about it - how would one go about creating a different kind of function generator? Say a sine wave generator, or a trapezoidal wave generator? Can an AVR even output anything besides a 0 or 1?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Search google for AVR and DDS

I Know Jesper made one on http://www.myplace.nu/avr/minidds/ , others did too.

But most others used an Analog Design chip

/Bingo

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I did this with the Butterfly using a resistor ladder DAC and some lookup tables for Sine, Triange, Sawtooth, and Square. The output is in asterisks and spaces to HyperTerminal so it may be the worlds slowest function generator, but it shows the principles. I could post the lookup tables if you'd like them.

Good Luck

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Bingo600 wrote:
Search google for AVR and DDS

I Know Jesper made one on http://www.myplace.nu/avr/minidds/ , others did too.

But most others used an Analog Design chip

/Bingo

Jesper's software DDS (uses a '2313) works very well. I've modified it to use a proper DAC/buffer and designed a PCB for it:

http://www.geocities.com/leon_he...

Leon

Leon Heller G1HSM

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You can also use a DDS chip of Analog Devices. (up to 1GHz) :P

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What is a DDS chip?

j.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Direct Digital Synthesis. Generates frequencies by constructing a sine wave in real time.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

j_sorensen wrote:
What is a DDS ...

In the US, Doctor of Dental Surgery. :wink:

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I made a low frequency one for testing eqipment - only up to 20 Hz or so with various waveforms. It uses a mega8 with an lcd display. CVAVR code. I'll post the files if they are of use.

Ralph Hilton

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I use Jesper DDS generator and my own "GenerAll" with ad9833 func. generator
FEATURES
+2.3 V to +5.5 V Power Supply
25 MHz Speed
Tiny 10-Pin µSOIC Package
Serial Loading
Sinusoidal/Triangular DAC Output
Power-Down Option
Narrowband SFDR > 72 dB
20 mW Power Consumption at 3 V

The"a MAX038 chip

Alexander

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Goto Maxim (www.maxim-ic.com) and find the device called MAX038. Then look at the datasheets and app notes. They have a full app circuit for creating a digitally controlled sig gen (sine, saw and sqr) from 1Khz to 16Mhz in 1Khz steps. You could easily replace the switches with the i/o pins from a microcontroller as I did.

Only down side is the Motorolla phase chip - it was the most expensive part. If you don't need accuracy then just remove it and go with the DAC.

M.

There are already a million monkeys in front of a million keyboards, and the internet is nothing like Shakespeare!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

This program and circuit will get you a variable frequency sine wave. I use one of these most every day - very reliable.

Attachment(s): 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The latest issue of Analog Dialogue has a DDS article:
http://www.analog.com/library/an...

Lee

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The old fashioned way would just be to integrate the square wave to get the triangle wave. There are other ways to get a pretty good sine wave that are also analog. A web search should get you schematics.

Here's one: http://www.national.com/nationaledge/jun04/article.html

Please note - this post may not present all information available on a subject.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

i want to make a function generator i'm using wien's bridge to make sine wave,then i pass it to comparator to make square wave,then passing it to integrator circuit it make triangular wave, then passing from op-amp closed loop to amplify it or deamplify but how would imanage to have a sampe amplitude if iswitch from sine to squrare

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

plz reply soon

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You need to add the magic letters A, V and R to your post if you want a reply

Imagecraft compiler user