8 | Untoolkit: Electronic Outputs
Zine

Capacitive sensor + RGB LED

Drawing with Capacitive Sensor in Processing
I wanted to start of easy since it is my first time writing code in Processing. First I started building a circuit using a LDR, that was what the example code provided by the minor uses.
Inspiration
After looking at more and more tutorials I wanted to be able to create a painting or drawing with the sensor. Lots of Processing tutorials showed examples of being able to draw with your mouse, using the x- and y-axis of the mouse position. The YouTube channel thedotisblack creative coding has some cool examples.
At first I chose to recreate this video from thedotisblack creative coding. I'm not that advanced in coding so I searched for some tutorials. Bu while searching for tutorials I stumbled upon a nice example from Processing. When I saw this example I decided it was a better idea to use this and just change a few lines of code, to make it fit in with the swatches. The benefit from the example was that I didn't have to start from scratch. And another benefit was that the drawing is never finished, thats something the first idea didn't have. The idea that I wanted to try and recreate from the video had to be started over again if the canvas was filled.
Code from Processing example
Pointillism by Daniel Shiffman.
Setup
I used a Seeeduino Lotus Cortex M0+ instead of a Arduino Uno.

Changing window size
The first thing I did was change the of the window. I wanted the window to be full screen. So I deleted the line size(600, 600); to fullScreen();.
As seen in the image above the dots were only appear in a box the exact same size as the original image used to pick the colors. So it treats the image as a canvas.
Resizing image to window size

Because the dots only appear in the image size I simply needed to resize the image to the whole window size. img.resize(width,height);

Swapping mouse position with sensor values
Fitting in with the other outputs
To make the output fit in with the others. I had to make two changes, use another picture with copper colors and use rectangles instead of ellipses to make a drawing. Both simple changes, I only had to change this line of code ellipse(x, y, pointillize, pointillize); to rect(x, y, pointillize, pointillize); and search a picture with nice black and copper colors.
Before swapping the ellipses to squares I thought I wouldn't like the squares as much as the ellipses.


End result
When seeing one of my classmates, Andrei, designs in Process I realized that my full screen design wasn't making it fit in with the other outputs. Thats when I chose to resize it to a square just like Andrei did.
So I swapped fullScreen(); back to size(600, 600); to make the window a square.


In the beginning of the week I ordered some 1M ohm resistances at tinytronics.nl. Unfortunately they haven't arrived yet. That's why I couldn't use my own capacitive sensor from week 6, because I didn't have any 1M ohm resistance to get some nice values out of my sensor.
Final code
Arduino IDE
Processing
Reflection
Looking at the work of the classmates, at the show and tell, I'm able to notice some of the flaws in my design I didn't think of before. It's nice to have some fresh eyes and feedback at the show and tell, to improve my work.
I also noticed that I enjoyed coding in Processing.
Last updated