Introduction: Virtual Etch a Sketch
Step 1: Parts List
Fortunately, the parts required for this project are simple and cheap. You might even have them all!
1 x arduino (any kind of course)
2 x potentiometers (resistance value doesn't matter, mine are 10k ohm)
1 x accelerometer (this is optional, but adds some fun. Mine is only one degree so any will work)
1 x breadboard (not necessarily needed, just makes things easier)
2 x small piece of material approx 5 in by 5 in (wood, cardboard, whatever)
4 x some sort of standoffs for mounting the two pieces of material together
Some lengths of wire to breadboard.
Random tools will also be needed to mount and screw whatever material you're using together.
Step 2: Potentiometers
Now to learn about potentiometers (or pots)! They are in fact variable resistors and we will be using the Arduino to read the resistance value from it to determine where the program should draw the lines.The majority of them will have three leads for you to attach wires too, as seen in the first picture. In order from left to right we have the ground wire, the signal wire (goes to an analog port), and the power line (5v).
In order to make them useful, you will need to run a simple test program on the Arduino to find the min (most likely 0) and max values that the potentiometer will have when you call analogRead(pin); I have a sample sketch of this HERE. Just download the "TestPotentiometer" file and run it in arduino. Make sure you have the potentiometer in the first analog port (A0). Record these max and min values as you will have to enter them in the processing program for accurate readings!
Step 3: Accelerometer
Next we have the accelerometer. Really any one will do, but they are not totally necessary! It's just really fun to shake it and have it clear. These hook up to the arduino in the same way as the pots (ground, 5v, and analog signal wire) the wires should be color coded so you know which is which. Similar to the potentiometer test, you also need to find the max accelerometer value. You can actually do this with the potentiometer test code, just make sure you pick the right analog port. Record the maximum value (minimum doesn't matter).
Step 4: Arduino
For this project we need the Arduino (If you've never used it before, it can be downloaded HERE) to communicate with processing. Fortunately for both of us some smart people have already developed an Arduino library to do just that! The Arduino IDE already has the example in it so all you need to do is click File then go to Examples. Scroll down to Firmata and select Standard Firmata, the program will open. Make sure your Arduino is connected to the computer and upload it.
Step 5: Processing
Now for the Arduino to talk to Processing (Processing can be downloaded HERE) you will need a new Processing library (don't worry you just download one file and move it into the Processing libraries) the people on Arduino's site have the library for download and an easy step by step of how to move it to the correct location! The link to that page is right HERE.
Next you will need my processing sketch which is available HERE. Once you have my sketch open, click the run button and if the Etch A Sketch frame pops up you are good to go! If not, check to make sure you correctly loaded the Arduino program and Processing library.
To ensure beautiful drawings, insert the max and min values you found for the potentiometers' into the 5th line of code where it says
"int min1 = 0, min2 = 0, max1 = 1023, max2 = 1023;"
For the accelerometer put your max vallue into the line that reads "int MAX_ACCEL = 624;"
Step 6: Controller
Now to build the controller device and make it look good! Put your two pieces of material on top of one another and slightly inwards from each corner make a hole (drill, stab, lick: whatever needs to be done) to mount your standoffs. Mount the standoffs to the bottom piece. Next, lay out your accelerometer, arduino, and breadboard on the bottom piece and mount them (however makes you happy and keeps them in place). The accelerometer should be oriented so that when you hold the device upright it will read it's maximum value (may need to go back and test, or if you're lucky like me it has a little arrow on it), so shaking will trigger the clearing of your drawing.
Take the top piece of material and mark two holes for your potentiometers. You will want to make them large enough for the middle part to stick through but not too large that the lock ring won't hold it in place. Then cut a hole and mount these (if confused look at the side view of them mounted below). Now wire everything up to the breadboard. Ground wire's to ground, power wires to 5v, and signal wires to analog ports. You'r "left" pot (the one your left hand will change when you hold it) should be in port a0, the "right" pot should be in a1, and the accelerometer should be in a2.
Screw on the top the layer to the standoffs and you're done! Go crazy. Actually, not too crazy.
Step 7: Results
Wowee you're ready to Etch A serious Sketch. The magic of the digital Etch A Sketch is that it's so easy to modify what it puts out. In the pic below you can see I made some code that alternated the colors red, blue, and white when I drew (I even tried an American flag, although that didn't turn out as well). I left the code for those colors in, so you just have to uncomment a line that says "usa();" to try it out.
Go nuts, but really make it put out rainbows or pictures of your grandmother. Do something neat and send me a pic of the results! This controller you made could also be used for many other programs (2 player pong perhaps? Or if you're especially nuts then an asteroids type game?). I was thinking I'd really like to project this onto the side of a building and let passerby's have a go. Could be lots of fun!
I hope you enjoyed the instructable and it got you thinking!
Participated in the
Participated in the
Game.Life 3 Contest
Participated in the
Jury Rig It! Contest
1 Person Made This Project!
- rubenzilzer made it!