Inspiration
Etch-a-Sketch is a beloved toy that many of our team members have fond memories with. During HackAndCrafts, we decided to pay homage to all the drawings we have made and turn this toy digital.
What it does
The hardware interface consists of two potentiometers to emulate the two knobs on a traditional etch-a-sketch and a ball-based tilt switch so that we can sense shaking. Turning the two potentiometers controls the x and y location of the pointer on a window, which is continuously drawing a line.
To clear the screen, just shake the circuit like you would a normal etch-a-sketch, and your drawing will magically disappear.
How we built it
Software
The serial output from the arduino is received and interpreted by a python script on the local machine. This is made possible using “pyserial”. Python manipulates the string and stores the necessary x and y coordinates in a variable for future use. Those coordinates are then received by the GUI module. Turtle graphics is used to display the sketch made by the user. The input from the user and output on the screen is an infinite while loop which enables real-time graphical feedback.
Hardware
The hardware consists of 2 10kΩ potentiometers hooked up to 2 analog input pins on an Arduino Uno. There is a ball-based tilt switch connected to a digital pin. The Arduino is continuously polling all these pins and sense data to the laptop via UART when it detects a change. This means that the Python program running on the laptop only draws when you turn the knobs or shake the circuit, just like a real etch-a-sketch. We defined our own protocol for sending data in a quick way. One packet of data consists of 9 characters:
- First 4 characters: X axis data from 0000-1023
- Second 4 characters: Y axis data from 0000-1023
- 9th Character: If 0: nothing happens, if 1: clear screen
Challenges we ran into
- Team members were not adept at turtle graphics which induced a learning curve
- The turtle module takes in differential values(relative to the turtle’s current position), whereas the Arduino was producing absolute XY coordinates(relative to the origin). We had to read deep into the documentation for the turtle to find a solution to this.
- Only of the team members had access to the hardware necessary to build the project
- The team is located in different time zones so efficient communication was a challenge
Accomplishments that we're proud of
- Creating our own protocol to quickly send data packets to the host laptop.
- Our team was spread out across 4 cities and 2 continents. However, we were still able to work together and build this.
What we learned
- Using Python’s turtle module to create etch-a-sketch type graphics.
- Analog interface for arduino
What's next for Hack-a-Sketch
- Will be integrating different and colors for visual appeal
- Will be making the program responsive
- Will be increasing the user experience by custom settings for the user
Log in or sign up for Devpost to join the conversation.