Arduino based Waveform Generator

New Tool- Waveform Generator

Finally, after sitting in the TODO list for a long time, I’ve made a basic wavefrom generator based on arduino, made using  this instructable as reference. I had an enclosure laying around which has incorrect dimensions for the project in which it was supposed to be used. The instructable had the sch for Waveform generator shield, I modified it a bit so its a stand alone system. I had to carefully plan the layout as it uses too many resistors, The DAC is done using R-2R network of 10k and 20k, in place of 20K I used two 10k in series. the output of DAC  network goes to LM386 audio amp. Below are some build and testing pictures. It can generate 4different types of waves, sine, pulse,sawtooth and triangle, with frequency and amplitude control, and pulse width control for the pulse wave form. For each wave the corresponding LED lights up.

arduino wavefrom generator

Sine Waveform

arduino wavefrom generator Sine Wave

Sawtooth Waveform

arduino wavefrom generator sawtooth

Triangle Waveform

arduino wavefrom generator Triangle wave

Pulse waveform

arduino wavefrom generator Pulse waveform

Building the enclosure

IMG_20140701_102052796 IMG_20140701_102059525 IMG_20140701_102959460 IMG_20140701_160248412

Schematic

****Please note the switches are connected together are connected to  ground.

sch

Source Code

Schematic: waveformgenerator (Save the file and change the extension to .sch ,made with eagle 6.5.0)

Videos

Testing on speaker

  • Pingback: Arduino based waveform generator | RLabs()

  • name

    can you add which potis you used and the maximal frequency?

    • I’ve used all 5k pots and frequency max frequency is 50kHz

      • name

        ty

  • jp

    hello hemalchevli, can you post code for pure mega328 (without arduino bootloader)?

    • Hemal Chevli

      It can be done, but I can’t give you an ETA.

  • Guest

    Hi, mind putting the eagle files up for download?

    I like to generate a layout for etching…. thanks!

    • Hemal Chevli

      Updated!

  • Prudhvi Rockzz

    Hello,can we build this on Uno R3?

    • Hi, Its based on ATMEGA328, so yes it can be made on an UNO.

      • Prudhvi Rockzz

        Thanks for the real quick response,i just stimulated it on proteus, here in the given schematic out of 4 terminals of push button the pins which are on same side are shorted and one of the shorted terminal is connected to Resistors, can you tell me bout the other side of the PushButtons, i mean they are just shorted and left alone, is it okay to isolate them? or we need to connect them to Ground?

        • Dude, thanks for the this, I made a mistake in the schematic, the left side of the switches are indeed connected to ground. I’ll correct it asap.
          Thanks again! 🙂

          • Prudhvi Rockzz

            🙂

  • Slawek

    Is Vin LM328 is powered by 9V.

    • Yes it is.

    • Slawek

      In the original scheme Instructables Push Button Switch [Sine, Saw, Triangle, Pulse] points 1 and 2 are connected to GND.
      In your diagram they are only connected together but not to GND.
      Is this a mistake on your schematic?

      • yes they are connected to ground. I’ll update the post now.

        • Slawek

          function_generator.ino.zip
          Is this code is 100% correct.
          reading the posts are reported bugs in the code.
          The oscilloscope shows me only the square-wave signal ..

  • Slawek

    Can you give the correct code because there are errors.
    The oscilloscope shows me only the square-wave signal.
    People write about będach code on Instructables.

    • Its already listed above, it is right after the schematic image.

  • Jason Markham (Jason Kits)

    Hi

    I modified the circuit to use just 1 analog line for the switches and also added a nice 1602 display showing me the frequency and mode .

    • Sweet, can share a photo of the same?

      • Jason Markham (Jason Kits)

        Hi ,,
        I did draw the schematic on paper , as soon as i transfer it to design the pcb i will upload the files and code

  • Tirupati Joshi

    Join the discussion…
    Hi,
    Jason Markham
    Will you please upload the modified code and the schematic having added the 1602 display.