loading

Step 2: 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.
<p>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.</p><p>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.</p><p>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.</p>
<p>Hi, </p><p>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, </p><p>Keep you posted.</p>
<p>Very nicely done!</p>
<p>hi i would like to know what is the 10.01&micro;f 50V Ceramic Disc Capacitor its cermic capacitor is same function with that? because i have the 10 uf 50v ceramic one</p>
<p>Thanks for thid project.</p><p>Its very nice.</p>
<p>Hi Luis,<br>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.</p>
<p>HendM, sorry I see your message now.</p><p>Here is the code</p><p>https://mega.nz/#!h0FSwATA!vxiu_BQT4qBLKSHARao4zluUT-fPTr_WdtbGhKq_n_4</p><p>Its works fine</p><p>Good luck</p>
<p>Please could anyone post the code or share the file! I can not open the zip file..Please</p>
<p>i want to make only sine wave using arduino how can i do it</p>
<p>Hello Amanda, thanks for all your project.<br>Could you suggest me the <br>difference between this way to amplificate with 2 capacitors and the <br>single capacitor application in your Analog output project? </p><p><a href="http://www.instructables.com/id/Arduino-Audio-Output/" rel="nofollow">http://www.instructables.com/id/Arduino-Audio-Outp...</a><br><br>Many thanks!</p><p>Andrea</p>
<p>Thanks for posting this nice project.</p><p>The saw does not work correctly; Error in code line 218. Should be if(t == 0) {</p><p> And if (!t) should also work.</p><p>I made the function generator with 1 button:</p><p>void checkShape() { //debounce and check states of button<br> if (digitalRead(BUTTON)==HIGH){<br> if (!debounce ) { <br> debounce = millis(); //Start debounce time<br> if (++type &gt; 4) type = 1; //New press done, check for max state<br> }else {<br> unsigned long currentMillis = millis(); //Put in temp because using milles in if below does not work<br> if ((unsigned long)(currentMillis - debounce) &gt; DEBOUNCE_TIME ) debounce = 0;<br> }<br> }else debounce = 0; //if not pressed any more reset the debounce function.<br>}</p><p>I used a Due</p><p>Have fun</p>
<p>Hii Jandemna,</p><p>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.</p><p>I have posted the question Forum:</p><p>If you want to refer my code please find the following link</p><p><a href="http://forum.arduino.cc/index.php?topic=393201.msg2706670#msg2706670" rel="nofollow">http://forum.arduino.cc/index.php?topic=393201.msg...</a></p><p>Thanks In advance</p>
<p>I have been seeing a few people having errors with &quot;sine20000&quot;</p><p>It has been suggested to use an earlier Arduino IDE build, but there is a simple fix for Arduino 1.6.+ </p><p>Change the first section in the code containing the sine20000 array:</p><p>from:</p><p>byte sine20000[] PROGMEM = { </p><p>to:</p><p>const byte sine20000[] PROGMEM = {</p><p>and leave everything in the brackets alone</p><p>After doing this I was able to get the program to compile without error in 1.6.7</p>
<p>I did the same, <br></p><p>const byte sine20000[] PROGMEM = { .....</p><p><br>and work good for me.. Thanks.</p>
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?
<p>hi, i have this error:</p><p>Arduino: 1.6.5 (Windows 7), Board: &quot;Arduino Nano, ATmega328&quot;</p><p>In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,</p><p> from function_generator.ino:30:</p><p>function_generator:30: error: variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'</p><p>variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences.</p><p>pleaseeeeee help me </p>
<p>Try using Arduino IDE 1.0.5 -- that fixed my problems for me.</p>
<p>Hello amanda .. i made this project nut when i upload the given code it gives me following error <br></p><p><br> from function_generator.ino:30:<br><br>function_generator.ino:30:18: <br> error: variable 'sine20000' must be const in order to be put into <br>read-only section by means of '__attribute__((progmem))'Can yu please help me out</p>
<p>Try using Arduino IDE 1.0.5 -- that fixed my problems for me.</p>
<p>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?</p><p>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 &quot;untouched&quot; source.</p><p>The &quot;30:18&quot; 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 &quot;const&quot;, so I did that, I added the word &quot;const&quot; so the line starts with &quot;const byte sine20000&quot; instead of just &quot;byte sine20000&quot;, and again, it compiled just fine for me.</p><p>Give that a try.</p><p>&quot;const&quot; 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.</p>
<p>Arduino: 1.6.5 (Windows 8), Board: &quot;Arduino Uno&quot;</p><p>In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,</p><p> from function_generator.ino:30:</p><p>function_generator:30: error: variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'</p><p>variable 'sine20000' must be const in order to be put into read-only section by means of '__attribute__((progmem))'</p><p>Please help me out!!</p>
<p>Try using Arduino IDE 1.0.5 -- that fixed the problems for me.</p>
<p>Arduino: 1.6.1 (Windows XP), Board: &quot;Arduino Uno&quot;</p><p>function_generator.ino:30:8: error: 'sine20000' does not name a type</p><p>In file included from C:\Program Files (x86)\Arduino\hardware\arduino\avr\cores\arduino/Arduino.h:28:0,</p><p> from function_generator.ino:30:</p><p>function_generator.ino: In function 'void __vector_11()':</p><p>function_generator.ino:227:31: error: 'sine20000' was not declared in this scope</p><p>Error compiling.</p><p> This report would have more information with</p><p> &quot;Show verbose output during compilation&quot;</p><p> enabled in File &gt; Preferences. </p><p>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 ?</p>
<p>Try using Arduino IDE 1.0.5 -- that fixed my problems for me.</p>
<p>After googling for &quot;Sine Wave Circuit&quot;, I was delighted to find this &quot;Arduino&quot; 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.</p><p>However, the article has room for improvement, which is the reason for this comment. Here are my suggestions:</p><p>1. The several places the text refering to &quot;300Ohm&quot;, and &quot;470Ohm&quot; need a space to make it &quot;300 ohm&quot; and &quot;470 ohm, so it doesn't look like a value ten times larger than intended.</p><p>2. One schematic shows the 300 ohm resistor and cap for the low pass filter. But the other schematic omits this circuit.</p><p>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</p><p>http://1.bp.blogspot.com/-FLaRrce1svE/VFtEWeuSL0I/AAAAAAAAANI/1GbkconjhXU/s1600/bluetoothcontrol_bb.jpg</p><p>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.</p><p>4. The text says, &quot;A 4.7kOhm resistor bridges pins 3 and 4 of the IC socket.&quot; Yet the schematic shows this as being a 2.2k ohm resistor. Which value is correct?</p><p>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.</p><p>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.)</p><p>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?</p><p>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.</p>
<p>Hello Paul .. i made this project nut when i upload the given code it gives me following error</p><p><br> from function_generator.ino:30:<br><br>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))'</p><p>Can yu please help me out<br></p>
<p>What version of the Arduino IDE are you using? Try using 1.0.5 -- that fixed the problem for me.</p>
<p>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.</p><p>I used a ladder DAC like yours and it is smoothing out my signal without a lowpass filter. </p><p>Did you have any problems like these yourself , I would really appreciate help.</p><p>Thanks so much Anthony</p>
<p>Why don't you account for the 10K equivalent resistance of the R2R ladder when dimensioning the RC filter?</p>
<p>how can i upload this on attiny4312 ?</p>
<p>I have been disappointed with it.</p>
<p>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 :)</p>
<p>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.</p><p>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.</p>
<p>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)</p>
<p>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 </p>
<p>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. </p>
<p>Hello Amanda,</p><p>can i use arduino atmega2560 in place of uno???</p><p>thank you!</p>
<p>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.</p>
<p>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</p>
<p>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.</p>
<p>How can I change the R 2R resistor set for a DAC08 (<a href="http://docs-europe.electrocomponents.com/webdocs/077f/0900766b8077fe46.pdf" rel="nofollow">http://docs-europe.electrocomponents.com/webdocs/0...</a>) in order to save components? What connections do I have to do?</p><p>Thank you</p><p>Great project</p>
<p>Hi Amanada.</p><p>can i use arduino atmega2560 in olace of uno???</p><p>thanks..</p>
so im not 100 sure on the math but im short a few 10k resistors.. if I just do 2 4.7k resistors in series will that be close enough? will that just affect the amplitude a small bit?
<p>Amazing and well laid out! I look forward to making one!</p>
<p>Great work! Very well thought out and quite useful. Using an Arduino instead of a professional arbitrary waveform generator can save us a bunch of money. <br>I have one suggestion, however: add a button that, when pressed, will send just one cycle of the selected waveform in the selected configuration (one-shot trigger). </p>
Hi there; this has been a great project so far! <br> <br>I just wanted to ask about one hiccup im having. For some reason, the signal coming out from my amp is clipped clean in half, only going up to about half the voltage it should be before just flattening off. The signal coming into the amp is nice and clean, and im fairly sure ive got everything wired up with the same components you used, although my amp is an lm386n-1; do you suppose that could be what's making the difference? I couldnt find anything different about it's specs, but I'm really just a beginner, so I wouldnt know for sure. <br> <br>Anyway, thanks for a brilliant tutorial!
Ah, my mistake actually; got confused with the AC readings from my oscilloscope. It actually is getting the full voltage from the amp, but it's still clipping. I put 3 20k resistors in series with the frequency coming from the arduino, and it's fixed the clipping, but it hardly seems an ideal solution. Is there something else I could be doing to lower the gain on the amplifier?
I too am having a clipping problem ... can you please tell me where to hook to 20k resistors to resolve this ?
what op amp are you using?

About This Instructable

496,776views

557favorites

License:

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" IMU Twitter Controlled Pet Feeder 
Add instructable to: