Introduction: Arduino Waveform Generator

Picture of Arduino Waveform Generator
Waveform generators (also called function generators) are useful for testing and debugging circuits.  I often use them to test the frequency response of electronics components like op amp and sensors.  This waveform generator is powered by an Arduino.  It outputs four waveshapes: sine, triangle, pulse, and saw, each waveshape ranges in frequency from 1Hz-50kHz.  The frequency, pulse width, and overall amplitude (gain) of the waveforms is controlled by three potentiometers.  I've also included (optional) indicator LEDs that let you know which type of wave is currently being sent to the output.

Parts List:

(4x) Mini SPST 1.5-Amp Momentary Pushbutton Switch (2 packages) Radioshack #275-1556
(8x) 10K Ohm 1/4-Watt Carbon Film Resistor  (2 packages) Radioshack #271-1335
(9x) 20K Ohm 1/4-Watt Carbon Film Resistor (2 packages)
(1x) 50K-Ohm Linear-Taper Potentiometer Radioshack #271-1716
(1x) 10K-Omh Audio-Taper Potentiometer Radioshack #271-1721
(1x) 10K-Ohm Audio Control Potentiometer with SPST Switch Radioshack #271-215
(1x) 1/8" Stereo In-Line Audio Jack Radioshack #274-274
(1x) 10.01µf 50V Ceramic Disc Capacitor Radioshack #55047551
(1x) 4.7K Ohm 1/4-Watt Carbon Film Resistor Radioshack #271-1330
(1x) 8 Pin Socket Radioshack #276-1995
(1x) LM386 Low Voltage Audio Power Amplifier Radioshack #276-1731
(2x) 220µF 35V 20% Radial-lead Electrolytic Capacitor (or anything between 200 and 300 uF) Radioshack #272-1029
(1x) Arduino Uno REV 3 Radioshack #276-128
(1x) Arduino Proto Shield Radioshack #276-140
(4x) White Super-bright LED Indicator Radioshack #55050633
(4x) 740 ohm 1/4W 5% Carbon Film Resistor (1 package) Radioshack 271-1317
(1x) 300Ohm resistor

Additional Materials:

Heat Shrink Radioshack #278-1611
22 Gauge Wire Radioshack #278-1224
Solder Radioshack #64-013
Hot Glue
Black diffusor material (tissue paper, plastic, etc)

Step 1: Prepare Arduino Proto Shield

Picture of Prepare Arduino Proto Shield

The Arduino Proto Shields are a convenient way to attach circuits to an Arduino, but I like to trim them down a little bit first so they do not take up so much room in the project enclosure.   Start by trimming the pins down with a pair of wire cutters.  Next, cut off the six pin socket.  Finally, cut the sockets from the top of the board.

Step 2: Enclosure

Picture of Enclosure

I decided to laser cut a custom enclosure for my project.  I designed the enclosure using AutoCAD, Autodesk 123D Make, and Corel Draw, and I've included corel draw and adobe illustrator 2D files as well as the STL, and DWG files from this process below.  If you do not have access to a laser cutter, you can use my 2D files a guide and drill the necessary holes in a project enclosure of some kind.  Figure 4 shows the holes that should be drilled on the front panel:

(3x) 7mm holes for gain, freq, and PWM pots
(3x) 7mm holes for four push buttons- sin, saw, tri, and pulse
(1x) 10mm hole for audio out
I cut out shapes of all four waveforms in the front of the enclosure so that I could backlight them with indicator LEDs, you may choose to just drill four 5mm holes for these LEDs in the front panel of the enclosure, place one LED under each momentary switch.
Also include a rectangular (11mm tall, 12mm wide) cutout somewhere on the side of the enclosure for the arduino's usb port.

I made my project enclosure out of wood, so I had to glue all the pieces (except the bottom) together with wood glue.  I will attach the bottom panel on later in this instructable.

Step 3: Solder Button Leads

Picture of Solder Button Leads

Solder a 10kOhm resistor to one lead of each of the four push buttons.  As shown in the second image, solder a green wire to the junction between the button and the resistor and a red wire to the other end of the resistor.  Solder a black wire the the second lead of the push button.  It's a good idea to cover these connections with a bit of heat shrink to prevent short circuits (fig 2).

Step 4: Install Audio Jack

Picture of Install Audio Jack

Unscrew the plastic casing from the audio jack.  Solder a red wire to the two stereo out pins and solder a black wire to the ground pin (fig 3).  I used hot glue to prevent short circuiting the jack and to give the soldering joints some extra support.  Finally, mount the audio jack in the enclosure with super glue.

Step 5: Install Buttons

Picture of Install Buttons

Snap the top of the button off and fit them into the wooden enclosure.  Secure with hot glue.  Once dried, snap the black button tops back on.

Step 6: R2R DAC on Arduino Shield: Part 1

Picture of R2R DAC on Arduino Shield: Part 1

Solder eight 20kOhm resistors to the arduino protoshield.  One end of each resistor should connect to digital pins 0-7.

Step 7: R2R DAC on Arduino Shield: Part 1

Picture of R2R DAC on Arduino Shield: Part 1

Solder 7 10kOhm resistors to the protoboard so that they bridge the leads of the 8 20kPhm resistors you have just soldered.

Step 8: R2R DAC on Arduino Shield: Part 3

Picture of R2R DAC on Arduino Shield: Part 3

Solder a 20kOhm resistor to the protoshield so that one end is connected to the 10kOhm resistor attached to digital pin 0 and the other  end is connected to a jumper wire to ground.

Step 9: IC Socket

Picture of IC Socket

It's a good idea to use sockets for your ICs, this way you won't risk burning the IC with your soldering iron and you can  easily replace the IC if it breaks.  Solder an 8 pin socket to the protoboard as shown in the image.

Step 10: Low Pass Filter

Picture of Low Pass Filter

Use a resistor and capacitor in series to create a low pass filter.  Low pass filters let low frequencies pass through and silence (attenuate) high frequencies.  Connecting a low pass filter to the output from the dac will smooth out the steps in the wave.

Here's how I calculated the value of the components in my low pass filter:

corner frequency = 1/(2*pi*R*C)

According to Nyquist's Theorum, signals cannot contain frequencies higher than half their sampling rate.  If I used a sampling rate of 100kHz, then the highest frequency I can produce is 50kHz.

if I use a 300Ohm resistor and I want a corner frequency of 50kHz:

50000 = 1/(6.28*300*C)
C = 1.06*10^-8 F

round this to:
C = 0.01uF

Connect one end of the the 300Ohm resistor to the 10kOhm resistor connected to digital pin 7.  Connect the capacitor to the other end of the 300Ohm resistor.  The other side of the cap should connect to ground.

Step 11: Amplifier: Part 1

Picture of Amplifier: Part 1

Connect the positive lead of the 220uF capacitor to the junction between the resistor and capacitor of the low pass filter.  The other end of the 220uF capacitor connects to a 20kOhm resistor that is connected to pin 3 of the IC socket.  A 4.7kOhm resistor bridges pins 3 and 4 of the IC socket.

Step 12: Amplifier: Part 2

Picture of Amplifier: Part 2

Connect ground to pin 4 of the IC socket.

Step 13: Amplifier: Part 3

Picture of Amplifier: Part 3

Connect the positive lead of a second 200uF capacitor to pin 5 of the IC socket.  The other end of the cap will be connected to the gain pot in a later step.

Step 14: Amplifier: Part 4

Picture of Amplifier: Part 4

Connect pin 6 of the IC socket to Vin, pin 2 to ground, and snap the IC into the socket.

Step 15: Wire Gain Pot

Picture of Wire Gain Pot

Volume or gain of the audio signal will be controlled with the 10k audio taper pot with switch.  Connect the audio out from the amplifier and ground to either side of the potentiometer as indicated in the picture.  The middle is audio out, it will be hooked up directly to the audio jack.

Also connect a wire to the bottom and left leads on the back of the pot (figure 2).  This is the switch that will be used to connect to power in the next step.

Step 16: Connect to Battery

Picture of Connect to Battery

Connect the black wire from the battery clip to ground on the Arduino Shield.  Connect one lead from the gain pot switch to the red wire  from the battery clip and connect the other gain pot lead to Vin on the Arduino Shield.

Leave the battery disconnected for now.

Step 17: Connect Output to Headphone Jack

Picture of Connect Output to Headphone Jack

Connect the output from the amplifier (the negative lead of the cap connected to the IC at pin 5) to the red wire we attached to the gain potentiometer in an earlier step.  Connect the green wire from the amplitude pot to the red wire connected to the audio jack.  Connect the black wire from the audio jack and the black wire from the pot to ground on the Arduino Shield.

Step 18: Wire Buttons

Picture of Wire Buttons

Connect all read leads from the button to 5V and all the black wires to ground on the arduino shield (fig 1).  Connect the green wires to analog in 0-3 in the following order:

analog 0   =   pulse
analog 1   =   triangle
analog 2   =   saw
analog 3   =   sine

Step 19: Wire Frequency and PWM Pots

Picture of Wire Frequency and PWM Pots

Connect a red, black, and green wire to the 10kOhm and 50kOhm potentiometers as shown in the images.  Connect the red lead to 5V and the black leads to ground on the arduino shield.  Connect the center green wires to analog  pins 4 (PWM) and 5 (frequency).

Step 20: Install Pots

Picture of Install Pots

Remove the side tab on all of the pots before installing in the enclosure, this will allow them to sit flush against the wood.  Remove washer and nut from each of the pots, place pot through hole in enclosure, and secure with nut.  Install all three pots in the enclosure.

Step 21: Wire LEDs: Part 1

Picture of Wire LEDs: Part 1

Attach a 470Ohm resistor to the cathode of each of the four LEDs.  Solder a black wire to the other end of the resisotr and a red wire to the anode of the LED.  Cover these connections with shrink wrap to prevent short circuiting.

Step 22: Wire LEDs: Part 2

Picture of Wire LEDs: Part 2

Solder the black leads from all four LEDs to ground on the arduino shield.  Solder the red leads to digital pins 8-11.

Step 23: Black Diffuser

Picture of Black Diffuser

Glue a light diffusing material behind the wave cutouts in the front panel.  I used a piece of a black plastic garbage bag.

Step 24: Glue LEDs

Picture of Glue LEDs

Glue the LEDs in the enclosure so that they are each pointed towards one of the cutout symbols on the front panel.  Here is a table for reference:

digital 8    =   pulse
digital 9    =   triangle
digital 10  =   saw
digital 11  =   sine

Step 25: Firmware

Picture of Firmware

Upload the code at the bottom of this step onto the Arduino.  The code uses a timer interrupt at a frequency of 100kHz to send new data out to the DAC.  The rest of the code monitors the state of the buttons and knobs and adjusts variables accordingly.  Since the interrupts occur at such a high frequency, I had to keep the interrupt routine, the piece of code encapsulated in the ISR(TIMER1_COMPA_vect){} as short as possible. Time intensive operations like mathematical operations with floats and using the sin() function take too much time to complete.  I used several work around to get by this:

For triangle and saw I created the variables sawByte, triByte, sawInc, and triInc.  Every time the frequency changed I calculated the amount that the triangle and saw function would have to increment at a sampling rate of 100kHz:

triInc = 511/period;
if (triInc==0){
   triInc = 1;
sawInc = 255/period;
if (sawInc==0){
   sawInc = 1;

then all the needed to be done in the interrupt routine was some simple math:

case 1://triangle
if((period-t) > t);
    if (t == 0){
        triByte = 0;
        triByte += triInc;
    triByte -= triInc;
if (triByte>255){
    triByte = 255;
else if (triByte<0){
    triByte = 0;
wave = triByte;

case 2://saw
if (t=0){
wave = sawByte;

For the sine function, I wrote a simple python script which outputs 20000 values of 127+127sin(x) for one complete cycle:

import math

for x in range(0, 20000):
    print str(int(127+127*math.sin(2*math.pi*x*0.00005)),)+str(","),

I stored this array in the Arduino's memory called sine20000[] and recalled the values I needed to send to the DAC.  This is much faster than calculating the values individually.

Step 26: Last Few Connections

Picture of Last Few Connections

Plug the Arduino into your shield.  Connect a 9V battery to the battery clip.  Secure these items inside the enclosure.  Make sure that the Arduino's usb port is accessible from the outside of the enclosure.  Upon startup you should see the sine wave LED light up.

Step 27: Screw Back Panel

Picture of Screw Back Panel

Drill four holes in the back panel and secure with screws.

Step 28: Add Knobs

Picture of Add Knobs

Screw knobs on the three potentiometers.

Step 29: Test

Picture of Test

Turn up the gain knob to turn on the function generator.  Plug an eighth inch jack into the output and hook up the function generator to an oscilloscope.  Test out each of the waveforms and adjust the frequency and gain to make sure they are working properly.  Switch the output to pulse and check if the pulse width modulation knob works (figs 4-6).

You will notice that the pulse wave is the only wave which truly ranges from 1Hz to 50kHz.  Since the sampling rate is 100kHz, the sine, triangle, and saw waves start to become somewhat unrecognizable at about 25kHz (they are only comprised of 4 samples per cycle- 100kHz/25kHz).  The saw and triangle waves only go down to about 100Hz, this is because the values of triInc and sawInc get so low that they are rounded to zero below this frequency.  The sine wave reaches all the way to 1 HZ but the resolution stays the same for anything under 5Hz, since the Arduino only has enough memory to store about 20 thousand samples.


atanvir1 (author)2017-11-07

Is there any way to add an LCD display to show the state?

pparuzel (author)2017-10-11

Hi would this work on an Arduino Nano? Can I substitute in a 741 Op Amp in place of the IC?


ZacharyC39 made it! (author)2017-06-06

Thanks for the tutorial! I wanted a simple function gen to troubleshoot audio equipment, so I decided on this one. I got all the pieces in a kit from Jameco, which was very nice. I noticed a lot of the waveforms were clipping off the top and bottom though, and a few other behaviors I didn't like (switched debounce wave select stuff from the loop() to interrupts) etc. I did a lot of other misc modifications to the code (check it out! I'm having some difficulty setting a specific frequency for each waveform though, it seems that whatever I select doesn't actually come through at the output; there's some timing issues I still need to work out. The waves look good though, nice and smooth and no more clipping! Cheers!

AaronH135 made it! (author)2017-05-18

Thanks, Amanda! Nice project!

SamadR1 (author)2017-05-11

Hello Amanda. I am new to Arduino and I just come across to your project and I have the same project to develop. The basic idea of my project is to develop a function generator in which will be used to send signal to the ignition coil for the spark timing. The ignition coil I have will control 6 spark plugs. The problem here is, I want to deliver signal for each spark plug with delay of circa 2 seconds for example. This means that the second spark plug will generate sparks after 2 seconds the first spark plug made, and also the third will do the same after the second spark plug sparks. Do i have to change anything inside the coding ?

dieselpony (author)2017-02-28

I really like this project. I wish i could build it. But sadly the typos are so horrible you cant get any of the parts. Radio shack PN's are either wrong, or unknown. Some of the resistor values are transposed. I'm surprised its a sponsered project. Its flashy, but needs to be reengineered by any person wanting to build it.

danielroibert (author)2017-02-02

Great thank-you.

KnightT3 (author)2016-12-19

Instead of plugging it to the detector can I plug it into my laptop microphone and listen to the waves sounds??

AhmedS419 (author)2016-11-05

can anyone provide me with illustrated schematic please?

MathiasP1 (author)2016-07-09

I really don't mean to offend you, but I just got 10 minutes of my time wasted, browsing through this 'instructable', just to figure that it's almost completely useless, unless I wanted to copy this thing, which I certainly don't want.

It seems kind of the wrong way around and general information is totally missing. This is much more like a presentation or some sort of making-of than an instructable.

Let me close with some kind words, sorry. You apparently did a pretty good job on that project. And I know how much effort must be in there, so take my respect.

jasonmarkham (author)2016-06-29


I came across your project and I got interested in building it, i checked the code and saw that it need revising, i shall add an lcd to this little project and remove the leds and 2 switches. compiling for sd1306 is out of the question so i will resort to a 16 x 2 lcd,

Keep you posted.

AsYetUnnamed (author)2016-06-09

Very nicely done!

StevenK42 (author)2016-05-28

hi i would like to know what is the 10.01µf 50V Ceramic Disc Capacitor its cermic capacitor is same function with that? because i have the 10 uf 50v ceramic one

Luisdlahuerta made it! (author)2016-05-10

Thanks for thid project.

Its very nice.

HendM (author)Luisdlahuerta2016-05-11

Hi Luis,
Could you please send me the code or share the file because the link that she posted I could not open it. Thank you very much for your kindness.

Luisdlahuerta (author)HendM2016-05-21

HendM, sorry I see your message now.

Here is the code!h0FSwATA!vxiu_BQT4qBLKSHARao4zluUT-fPTr_WdtbGhKq_n_4

Its works fine

Good luck

HendM (author)2016-05-11

Please could anyone post the code or share the file! I can not open the zip file..Please

rsk123 (author)2016-04-29

i want to make only sine wave using arduino how can i do it

AndreaS76 (author)2016-04-18

Hello Amanda, thanks for all your project.
Could you suggest me the
difference between this way to amplificate with 2 capacitors and the
single capacitor application in your Analog output project?

Many thanks!


jandemna (author)2016-01-31

Thanks for posting this nice project.

The saw does not work correctly; Error in code line 218. Should be if(t == 0) {

And if (!t) should also work.

I made the function generator with 1 button:

void checkShape() { //debounce and check states of button
if (digitalRead(BUTTON)==HIGH){
if (!debounce ) {
debounce = millis(); //Start debounce time
if (++type > 4) type = 1; //New press done, check for max state
}else {
unsigned long currentMillis = millis(); //Put in temp because using milles in if below does not work
if ((unsigned long)(currentMillis - debounce) > DEBOUNCE_TIME ) debounce = 0;
}else debounce = 0; //if not pressed any more reset the debounce function.

I used a Due

Have fun

surajp32 (author)jandemna2016-04-11

Hii Jandemna,

I am also facing the same problem of button debouncing in Arduin Due. I have written a code for button debouncing but still not got success.

I have posted the question Forum:

If you want to refer my code please find the following link

Thanks In advance

EpicGeekPoetry (author)2015-12-21

I have been seeing a few people having errors with "sine20000"

It has been suggested to use an earlier Arduino IDE build, but there is a simple fix for Arduino 1.6.+

Change the first section in the code containing the sine20000 array:


byte sine20000[] PROGMEM = {


const byte sine20000[] PROGMEM = {

and leave everything in the brackets alone

After doing this I was able to get the program to compile without error in 1.6.7

I did the same,

const byte sine20000[] PROGMEM = { .....

and work good for me.. Thanks.

ezio719 (author)2016-02-01

Hey guys, i wanna ask that in above circuits the lady used 5V from arduino many times but in actual arduino has just one 5V output pin... So how to ise it multiple times? Parallel?

JuanQ4 (author)2015-08-31

hi, i have this error:

Arduino: 1.6.5 (Windows 7), Board: "Arduino Nano, ATmega328"

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

from function_generator.ino:30:

function_generator:30: error: variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

pleaseeeeee help me

music_connector (author)JuanQ42015-10-17

Try using Arduino IDE 1.0.5 -- that fixed my problems for me.

adeel.asghar.1466 (author)2015-05-05

Hello amanda .. i made this project nut when i upload the given code it gives me following error

from function_generator.ino:30:

error: variable 'sine20000' must be const in order to be put into
read-only section by means of '__attribute__((progmem))'Can yu please help me out

Try using Arduino IDE 1.0.5 -- that fixed my problems for me.

Just now, I compiled the sketch with Arduino 1.0.6 set to Uno, and it didn't have a problem. So I can't prove I've found your answer. What board are you compiling for that gave you this error?

Sometimes I accidently type something into a sketch without knowing it, that causes it to crash. You could try reloading the sketch from the original "untouched" source.

The "30:18" in your error message means it happened on line 30, and the 18th characcter in from the left. The error message states the line should be a "const", so I did that, I added the word "const" so the line starts with "const byte sine20000" instead of just "byte sine20000", and again, it compiled just fine for me.

Give that a try.

"const" means the values in that line will not be changed, which I beleive is correct since it's only read -- over and over again -- to make the sine wave.

Arduino: 1.6.5 (Windows 8), Board: "Arduino Uno"

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

from function_generator.ino:30:

function_generator:30: error: variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

Please help me out!!

Try using Arduino IDE 1.0.5 -- that fixed the problems for me.

daudahmad (author)2015-05-10

Arduino: 1.6.1 (Windows XP), Board: "Arduino Uno"

function_generator.ino:30:8: error: 'sine20000' does not name a type

In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,

from function_generator.ino:30:

function_generator.ino: In function 'void __vector_11()':

function_generator.ino:227:31: error: 'sine20000' was not declared in this scope

Error compiling.

This report would have more information with

"Show verbose output during compilation"

enabled in File > Preferences.

I get the following error while i compile the code in arduino IDE. I tried alot. but could't solve the problem. Would anybody please help me ?

Try using Arduino IDE 1.0.5 -- that fixed my problems for me.

PaulS20 (author)2015-04-18

After googling for "Sine Wave Circuit", I was delighted to find this "Arduino" sine wave circuit, because I love working with Arduino and it's compatible modules. Also, the lazer cutter used here was a wonderful discovery for me too! I didn't even know there was such a thing, but now must have one to add a professional look to the projects I sell.

However, the article has room for improvement, which is the reason for this comment. Here are my suggestions:

1. The several places the text refering to "300Ohm", and "470Ohm" need a space to make it "300 ohm" and "470 ohm, so it doesn't look like a value ten times larger than intended.

2. One schematic shows the 300 ohm resistor and cap for the low pass filter. But the other schematic omits this circuit.

3. Although the photography is very clear, no one picture shows all the wiring where it's easy to understand everything at once. Take a look at

Every wire -- and where it connects -- is easy to see in one picture. And like in this picture, I always try out my projects on a white breadboard first; for it's far easier to try out alternatives and correct mistakes where all parts plug and unplug, than it is on a project board where you have already soldered the parts permanently in place.

4. The text says, "A 4.7kOhm resistor bridges pins 3 and 4 of the IC socket." Yet the schematic shows this as being a 2.2k ohm resistor. Which value is correct?

5. It would help to have a note on the pictures, explaining you can mouse-over the rectangles to pop up notes on what's inside the rectangle. I'd nearly finished the project before discovering this.

6. One such rectangle (over a straight section of wire in a schematic) says a resistor should have been here. Why not just add the resistor to the image and reload it? The note is easy to miss (and thus the need for the resistor.)

7. Another mouse-over rectangle says the color code on the resistor shown is wrong. So why not just use an art program to paint the correct colors on the resistor, and re-upload the image?

I think this is a GREAT project; exactly what I needed. But the above seven items make it hard to follow correctly. For the benefit of others, I'd LOVE to see these modifications made.

Hello Paul .. i made this project nut when i upload the given code it gives me following error

from function_generator.ino:30:

function_generator.ino:30:18: error: variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'

Can yu please help me out

What version of the Arduino IDE are you using? Try using 1.0.5 -- that fixed the problem for me.

antomullen (author)2015-10-17

Hi My name is anto , I am building a sig gen for a project in college. I planned to have a large array and increment by different values to give me different frequencies so that that the frequency resolution will be intergral multiples of the lowest frequency. I presumme that is what u did . My problem is that if make the array too big the lowest frequency sine wave is very distorted. the lowest frequency i can get is about 400Hz any lower it is not good. Also I dont use a timer interupt i am just using a tight loop with a quick check on PINB for button presses.

I used a ladder DAC like yours and it is smoothing out my signal without a lowpass filter.

Did you have any problems like these yourself , I would really appreciate help.

Thanks so much Anthony

AndreaG36 (author)2015-09-21

Why don't you account for the 10K equivalent resistance of the R2R ladder when dimensioning the RC filter?

adam.verner.790 (author)2015-08-31

how can i upload this on attiny4312 ?

LanoraB (author)2015-08-08

I have been disappointed with it.

adeel.asghar.1466 (author)2015-05-05

Adi M (author)2015-03-14

Is there a point in storing 20000 samples? If our DAC can only represent 2^8 values? Surely 256 samples should be the maximum sample resolution? Im a bit confused. Nice project :)

Cheeseduck (author)Adi M2015-05-01

Think of a sine wave in the x-y plane. There are only 256 y values available, because that's the resolution of the arduino's analog output pins. However, we can have as many x values as we need, to some extent.

So the question becomes what is the smallest number of x values you need for it to still look like a sin wave. The author chose 20k, but you could do more or less if you wanted to. As I see it, the only reason to do more is for higher resolution at lower frequencies, and the only reason to do less is to save storage space.

wgrabarz (author)2015-04-26

Hey, would it be possible to convert this project to a synthesizer dual DCO? Midi controlled and with one output for each DCO where DCO2 frequency is DCO1*detuneFactor (set by a pot on an analog pin, range +/- 1 octave so detuneFactor would have to go from 0,5 to 2)

fariha.abid.980 (author)2015-04-05

hey i have to take the output of the arduino through earphones instead of speaker.. my arduino output is working pretty fine with speaker.. but i have to switch it now to earphones. can you please guide

PaulS20 (author)fariha.abid.9802015-04-15

The problem with earphones is that they put all that power right into your ears! Just connect a resistor in series with each earphone wire. If they are 8 ohm ear phones, a ten ohm resistor would reduce the power about in half, a 33 ohm resistor would reduce it to 1/4th as loud, etc.

ashish.gujarati (author)2015-03-12

Hello Amanda,

can i use arduino atmega2560 in place of uno???

thank you!

PaulS20 (author)ashish.gujarati2015-04-15

If you already have your atmega2560, just try loading the software sketch this instructable provided into your Adruino. If the the Arduino tells you it's happy with it, that should bve your answer.

tony.kupcho (author)2015-03-30

Is there any particular reason for the 35 V rating on the 220 microF capacitors? I already have a set of 16V and was wondering if there would be any reason I couldn't use them

Peter-PaulV (author)tony.kupcho2015-03-31

No, no reason why you cannot use your 16 V caps. I guess the 35 V volt ones was what the author had available at that moment. As a general rule: as long as the capacitor voltage rating is higher than the supply voltage of your circuit, it will be OK.

About This Instructable




Bio: I'm a grad student at the Center for Bits and Atoms at MIT Media Lab. Before that I worked at Instructables, writing code for ... More »
More by amandaghassaei:OTCA Metapixel - Conway's Game of Life"9 Degrees of Freedom" IMUTwitter Controlled Pet Feeder
Add instructable to: