DIY Etch A Sketch

by littleBits May 9, 2014

Use two dimmers to draw on your computer screen, just like an Etch-a-Sketch. 

*To complete this exercise, you will need to download the Arduino softwareYou will also need to download Processing to run the Processing sketch.

The two dimmers send analog data into the Arduino and output serial data to Processing, a programming language that lets you control visual information on your computer. By moving the dimmers, you control movement on your screen and can draw lines.

For more “getting started” sketches, click here.

For support check out the littleBits and Arduino forums.

To learn more about coding, find examples on Arduino’s website.

Bits used: Arduino, dimmer, fork, power

Tags: Programming Fun & Games

Videos and Recipes


  1. 1

    Download the Arduino software to your computer (it's free!) and open the "Etch A Sketch" sketch. You will also need to download Processing to run the Processing sketch.

    The "Etch A Sketch" Arduino and Processing files can be found on this page in the "other files" section.

  2. 2

    Build your circuit (see the photo gallery for an image of the setup). Make sure your two dimmers are connected to the analog input pins, A1 and A0.

  3. 3

    Plug the micro USB cable into both the Arduino module and a USB port on your computer.

  4. 4

    Turn your power module on. You should see a red light illuminate on the power module and a yellow light flash on your Arduino module.

  5. 5

    In the Arduino program, select your board. Go to Tools>Board>Arduino Leonardo. This littleBits Arduino module is modeled after the Arduino Leonardo and is therefore compatible.

  6. 6

    Next select the serial port that the Arduino will communicate over by going back to "Tools" and selecting the correct port in the "Port" section. The name of the port will depend if you are on a Mac or Windows computer. On a Mac, it will start with /dev/tty.usbmodem... and a PC will start with COMM… In Windows, you can look for the USB serial device in the ports section of the Windows Device Manager. If you are on a Linux machine, the port will look like /dev/ttyUSB…

  7. 7

    To upload the Arduino sketch to your Arduino module, press the arrow button in the top left corner of the screen. You will see a blue bar at the bottom of the window that says "compiling sketch", and you should see two yellow lights flash on your Arduino module when this happens. The upload is complete when you see "done uploading" at the bottom of your sketch window.

  8. 8

    Now, switch over to the processing sketch. Press the "play" button in the Processing window (top left corner). This will open a purple window. Now, when you move the dimmers, you are able to draw on your screen like an Etch A Sketch.

  9. 9

    If you are unable to draw any lines, you may need to make a slight adjustment to the code in the processing sketch so that you connect to the correct serial port.

    Scroll down until you find this line of code:
    myPort = new Serial(this, Serial.list()[0], 9600);

    You will need to replace the 0 in Serial.list()[0]. Start counting up from 0. After each change you make, try and run the game. We found that we needed to replace the 0 with the number 2.

  10. 10

    You can also try replacing the dimmers with other littleBits sensors for some fun interactions.

Bits used (5)


You can also save big by getting all these bits and more in this kit:


Add this collection to get these modules and more for a price savings

Other files

  • Donji 6 months ago

    I couldn't get it to work. The DIY mouse module worked so I think there is a problem with the code that has to be uploaded. I even tried changing the port # like the instructions suggested.

    Help please

    • rob_21063 6 months ago

      the port number is the position of the port you need to use in the port list you see under tools>serial port. In my case with a mac I needed to enter 13 in the program to get to the correct /dev/tty.usb......

  • Donji 6 months ago

    Thanks, I figured this one out actually. If you go under the Arduino app and you go under tools>serial port you have to count the items starting from the top untill up you get to the right one and that is your number. I do not believe it is random like the instructions suggest.

  • Steve Marks 6 months ago

    I'm on a Mac and getting this when I try to upload after selecting Leonardo, the USB port and clicking the arrow... Serial port '/dev/tty.usbmodemfd121' already in use. Try quitting any programs that may be using it.

  • adama18 4 months ago

    Okay, we have our purple java square but our dimmers aren't doing anything. I did have to change
    myPort = new Serial(this, Serial.list()[0], 9600);
    myPort = new Serial(this, Serial.list()[2], 9600);
    That is what gave us the purple box. But our dimmers don't change anything. They are definitely on a0 and a1 and I checked in the Arduino program and it's definitely looking for a0 and a1. The board looked like it received the program just fine. No errors and it blinked and everything. So I'm not sure what we're doing wrong... Any ideas? Mac user...

    • aspoone 3 months ago

      This worked for my Mac setup.
      1. launch Arduino and upload etchasketch_arduino.ino to littlebits board
      2. turn off power to littlebits board
      3. launch Processing and open etchasketch_processing.pde
      4. power on littlebits board (wait until you see the d0 led flash)
      5. run the Processing sketch

    • adama18 3 months ago

      aspoone - thanks for your response. It's still not working. Should the dimmers be in a particular position before I upload the Arduino sketch and/or the Processing sketch? My purple box does have a TINY white dot in the lower left but it's not moving with the dimmers...

    • littleBits 3 months ago

      Hi adama18! Directing you to the littleBits forum where you will be able to connect with littleBits engineers to get this sketch up and running:

Must be logged in to comment. Sign in. Not a member? Join now