Compy Sketch is an Etch-A-Sketch for your computer! Save your images and impress your friends with your skillz! I made a remote packed with a couple of knobs, a switch, a button, and an Arduino Duemilanove. The remote talks to Processing to display and save all the doodling fun.
The project box enclosure for the remote turned out pretty well. The left knob draws horizontal lines, and the right knob draws vertical lines. Pressing the red button will either erase the screen or save the image, depending on the state of the state of the switch labeled with an S (save) and an E (erase). Read on to see how it all works.
Above: initial Compy Sketch prototype (left) and second iteration (right).
The basic idea behind this project is getting the Arduino to talk to Processing. Assuming you have already installed both environments, you need to do the following:
Arduino: upload StandardFirmata to the Arduino board once. StandardFirmata is a program that is included with the Arduino installation. You can find it in the "open" menu. Open it, and upload it to the board.
Processing: in the Documents > Processing directory, create a folder called "libraries." Download the first file on this page, and unzip it. Take out the folder called "arduino" and drop it into the "libraries" folder you just made. Restart Processing.
This page is a very good guide that explains the steps in detail. Definitely check it out. Once you've done these two things, you can actually see some cool results using only your Arduino board. When you start Processing, you should now see an option in the "open" menu called "libraries." Select Open > libraries > arduino > examples > arduino_input. Run the sketch, and touch the metal leads on the back of the arduino. You should see some squares change color and some circles change size. Great! It works!
(1) Arduino Duemilanove
(1) computer
(1) spool of wire
(2) 10k potentiometers
(2) knobs
(2) SPST switch
(1) momentary switch
(2) 220-ohm resistors
(1) mini breadboard
(1) box to hold everything
(1) soldering iron, solder
(1) wire cutter / stripper
(1) swiss army knife, drill, or dremel
For the enclosure, I used a cheap sewing kit box. It was the perfect size to squeeze in an Arduino. First I marked out and cut a hole in the side for the USB port of the Arduino, then I drilled holes for all the components.
Next I connected the hardware to the Arduino. I used analog pins 0 and 1, and digital pins 2 and 3 to sense the position of the potentiometers and the states of the button and switch. The value of the resistor next to the button and switch can be anything; I used 220 ohms. They just need to keep the +5V separate from the ground when the switch is on.
After connecting all the components, I tried to close the box. The pins from the flexible connection wires stuck out too much, so I bent them over. Next, I taped everything inside the box so that any shaking wouldn't make components come loose. Finally, I finished it off with some knobs on the potentiometers and an index card taped to the top so I could label the switch states.
Above: the finished enclosure!
I recommend reading the comments in the code to best understand how the program was written. There are a couple short methods for getting the line data from the Arduino and for saving the image, and one fairly long method for drawing the frame. If you don't want to mess with the code, you can use the standalone application, though you'll still need the Arduino and hardware setup to get it to work.
Download the source code: windows/mac/linux