Project showcase
Paddle A Sketch (Tm)

Paddle A Sketch (Tm) © GPL3+

Electronic "Etch a Sketch" to draw directly on the computer and save the screens.

  • 997 views
  • 1 comment
  • 2 respects

Components and supplies

Necessary tools and machines

x-acto
I made the box from 3mm plywood and the knobs with soda caps

About this project

I love Etch a Sketch(TM) toy, but it is very difficult to take pictures so with an Arduino, two potentiometers, a tilt sensor and soda caps I made my own Electronic "Etch a Sketch" to draw directly on the computer and save the screens.

I saw the basics of this project here, and added a tilt sensor for erasing the screen and modified the Processing code for saving the picture. Shaking it will erase the screen, a mouse click will save the picture.

Code

Arduino part for the Paddle a sketch Arduino
This parts reads the value of two potentiometers and the tilt sensor and send them to the serial output.
int x;
int y;
int pushButton = 2;//originally was a pushbutton but now is a tilt sensor

void setup()
{
  Serial.begin(9600);
  pinMode(2,INPUT);
}

void loop()
{
 int buttonState = digitalRead(pushButton);
  x = analogRead(A0);
  y = analogRead(A1);
  Serial.print(x);
  Serial.print(",");
  Serial.print(y);
  Serial.print(",");
  Serial.println(buttonState);
  delay(50);
}
Processing part for the paddle a scketchJava
This is the Java part that reads the serial output from Arduino and draws in the screen.
// Etch-a-Sketch
// based on a sketch by Trevor Shannon

import processing.serial.*;

Serial port;
String serialInterface = "COM5";
int lastX = -1;
int lastY = -1;

void setup() {
  size(1024, 920);
  background(205);
  port = new Serial(this, serialInterface, 9600);  
}

void handleData(int x, int y) {
  if (lastX >= 0 && lastY >= 0) {
    line(x, y, lastX, lastY);
  }
  lastX = x;
  lastY = y;
}  

void draw() {
  readSerial();
}

void mouseClicked() {
  saveFrame(); 
 // added to save the drawing
}

void readSerial() {  
  int x; int y; int z;
  String s;
  while ((s = port.readStringUntil('\n')) != null) {
    String[] parts = s.substring(0, s.length()-2).split(",");
    if (parts.length == 3) {

      x = int(parts[0]);
      y = int(parts[1]);
      z = int(parts[2]);
      if (z==0) {
      background(205);//clears the screen when shaken
    }

      handleData(x, y);
    }
  }
}

Schematics

paddlea scketch
Easparts
schematics
Schema

Comments

Similar projects you might like

Web Sketch (HTML5 Canvas)

Project tutorial by hmkim

  • 2,454 views
  • 1 comment
  • 22 respects

Sketch It (CNC Plotter)

Project tutorial by Yogeshmodi

  • 108,276 views
  • 29 comments
  • 155 respects

Bulls and Cows Game with Arduino

Project showcase by Jose Luis Bejarano Vasquez

  • 4,350 views
  • 1 comment
  • 14 respects

Upload a Sketch to an Arduino UNO with Bluetooth

Project tutorial by Jeremy Lindsay

  • 704 views
  • 0 comments
  • 2 respects

Magic Arduino Ball

Project showcase by Ruben Zilzer

  • 2,013 views
  • 1 comment
  • 6 respects
Add projectSign up / Login