LogoLogo
  • Documentation Pages
  • About Minor Makers Lab
  • Documentation templates
    • Recipe template
    • Label templates
    • Ingredient template
  • Projects
    • Project overview
      • Gelance Cushion - Andrei Motian
      • Landscapes for Warhammer - Dusanka Prvulovic
      • Bioplastic Filters: An Analogue Photoshop - DaniĆ«l van Kesteren
      • Hyperdisposables - Anoush Mazloumian
      • Project Stop Touching - Summer Danoe
      • Foam For Material Activists - Laura Velgersdijk
      • DateKleed - Duncan van Norden
      • One Size Hurts All - Kaz Bison
      • Biodegradable Packaging Bags - Kim Sinke
      • DIY Faceguards - Thijs Uffen
      • Bioplastics on a Rainbow Spectrum - Desiree van Dam
      • Beyond Humanity - Britt de Heer
  • Coursework
    • Britt
      • research zine text
      • Week 11
      • Week 12 / 13
      • Week 14
      • 1 ) Kick-Off
        • Grafische Werkplaats Amsterdam
        • Safetyzine
      • 2 ) Electronics: Connecting Materials
      • 4 ) Cutting Supersurfaces
        • Zine: Art Approach
        • Furry Sample Book
      • 5 ) Additive Manufacturing
      • 6 ) Untoolkit: Electronic Inputs
      • 7 ) Transforming: Moulding and Casting with Bioplastics
      • 8 ) Untoolkit: Electronic Outputs
    • Andrei
      • Week 1
        • GWA
        • Textielmuseum
        • Safetyzine
      • Week 2
        • Ohm's Law & circuits
        • Speaker on denim
      • Week 4
        • Inflatables 2D to 3D
        • Smooth to sharp with polypropylene
      • Week 5
        • Making a switch for the laser cutter in Fusion360
        • Designing and 3D printing molds
      • Week 6
        • Wearable switch for sound
        • Analog Sensor
      • Week 7
        • Home materials
        • Making bioplastics
        • Material properties
      • Week 8
        • Virtual Swatch
        • Processing
        • RGB LED
      • Project weeks 11 - ?
        • Week 11: Kick-off
          • Brainstorm Session
          • 5 min pitch
          • Trail of Evidence
          • Proposal
        • Week 12: Experimenting
          • Research workout materials
          • First Experiment
          • Trail of Evidence
        • Week 13: Project Work
          • Insights
          • Reframing session with Laura
          • Trail of Evidence
        • Week 14: Reframing
          • Reflective design method
          • Going bigger
          • Trail of Evidence
        • Week 15
          • Highlights photo's
          • Reframing, research & insights
          • Trail of Evidence
        • Week 16
          • Going even bigger
          • Trail of Evidence
        • Week 17
          • Trail of Evidence
        • Project
    • Anoush
      • Week 11-19
        • Week 11 | project kick-off
        • Week 14 | First experiments
        • Week 15 | Progress presentation
        • Last reframing session
        • Trail of Evidence
      • Week 1-8
        • Overall Reflection
        • Week 8 | Untoolkit - Electronic Outputs
        • Week 7 | Transforming bioplastics
        • Week 6 | Untoolkit - Electronic inputs
        • Week 5 | Additive Manufacturing
        • Week 4 | Cutting Supersurfaces
        • Week 3 | Reading Week
        • Week 2 | Electronics: Connecting Materials
        • Week 1 | Kick-off
    • DaniĆ«l
      • Week 20: Expo Week
      • Week 19: Project Week 9
      • Week 18: Project Week 8
      • Week 17: Project Week 7
      • Week 1: Kick-Off
      • Week 2: Electronics and Connecting Materials
        • Part I: The Basics and Recreating Circuits
        • Part II: The Making of the Speaker
        • Part III: Testing the speaker
      • Week 3: Reading Week
      • Week 4: Processes & Collaboration
        • Part I: exploring the words
        • Part II: experimenting with the laser cutter
      • Week 5: Critical Making 3D
        • Part I: Creating the injection mold
        • Part II: Creating the two-part mold
        • Part III: Printing the designs
      • Week 6: Electronics & Open Design
      • Week 7: Bioplastics
        • Material Properties Sheet
        • The Ma2E4 Toolkit
        • The Ma2E4 Toolkit (second bioplastic)
        • An application for the bioplastic
      • Week 8: Interfaces & Algorithmic Bias
      • Week 9: Documentation Week
      • Week 10: Assessments
      • Week 11: Project Kick-Off
      • Week 12: Recess
      • Week 13: Project Week 2
      • Week 14: Project Week 3
      • Week 15: Project Week 4
      • Week 16: Project Week 5
        • Presentation Preparation
    • Desiree
      • Summaries
      • Kick-off
      • Week 1 - Safety Zine
      • Week 2-3 Electromagnets
      • Week 4 - Cutting Supersurfaces
      • Week 5 - Additive Manufacturing
      • Week 6 - Untoolkit: Electronic Inputs
      • Week 7 - Transforming: Molding and Casting with Bioplastics
      • Week 8 - Untoolkit: Electronic Outputs
      • Trail of Evidence
      • Website
      • Material Archive
      • Week 11 - Choose a project
      • Week 12 - 13
      • Week 14
      • Week 15
      • Week 16
      • Week 17
      • Week 18
      • Week 19
    • Duncan
      • Week 1: Kick-Off
        • Masterclass Studio Overvelde
        • Workshop letterpress
        • Textielmuseum Tilburg
        • Meet the Makers - introduce yourself
        • Safetyzine
        • extraĀ“s
      • Week 2: Electronics: Connecting Materials
        • Zine: Kits & Open sources
      • Week 3: Reading week
      • Week 4: Cutting Supersurfaces
        • Zine:
      • Week 5: Additive Manufacturing
        • Workshop Amstelstation
        • Zine: 3D-printers & Being editors
        • Overall conclusion
      • Week 6: Untoolkit (Inputs)
        • Together w/ Loes
        • Zine: week 6
        • ExtraĀ“s
      • Week 7: Transforming
        • Zine: Social issues
        • extra's
      • Week 8: Untoolkit (Outputs)
        • Zine: Does being a 'maker' makes you a better civilian?
        • extraĀ“s: week 8
      • Week 9: Reflection
        • Zine:
        • extra's (week 9)
      • Week 10: Assessments
        • Zine:
      • Week 11
        • Makers skills & attitude
        • Design research skills
        • Collaborative learning
      • Week 12
        • Maker skills & attitude
        • Design research skills
        • Collaborative learning
      • Week 13
        • Scenario
        • Maker skills & attitude
        • Design research skills
        • Collaborative learning
      • Week 14
      • Week 15
        • Materialen lijst
        • Lijst met verschillende manier van connecten
        • Scenarios
        • Inspiratie voor vormen
        • Concrete voorbeelden tekenen
        • Samples / plan schrijven om te MAKEN!!
        • Kleuren inspiratie
      • Week 16
      • Week 18
        • Samples
        • The making of Samples
        • Inspiratie
        • Benodigdheden Woensdag 03/06/20
        • Inspiratie foto serie
        • Digitale tekeningen
      • Week 19
      • Week 20
    • DuÅ”anka
      • Week 1 - 8
        • 1 | Kick-Off
          • 2 | Electronics: Connecting Materials
            • Assignment 0 - Zine
            • Assignment 1 - Paper circuit
            • Assignment 2 - Soft speaker
          • Assignment 1
          • Assignment 2
        • 4 | Cutting Supersurfaces
          • Assignment 0 - Zine
          • Assignment 1 - Sample Book
        • 5 | Additive Manufacturing
          • Assignment 0 - Zine
          • Assignment 1 - Mold documentation
          • Assignment 2 - Molds
        • 6 | Untoolkit: Electronic Inputs
          • Assignment 0 - Zine
          • Assignment 1 - Antiprimadonna's
          • Assignment 2 - Working circuit
        • 7 | Transforming: Molding and Casting with Bioplastics
          • Assignment 0 - Zine
          • Assignment 1 - Intro
            • Bioplastics
            • Experiential toolkit
            • Material properties sheet
            • Future applications
            • Reflection
        • 8 | Untoolkit: Eelectronic Outputs
          • Assignment 0 - Zine
          • Assignment 1 - Working circuit
      • 11 | Projects Kick-Off
        • Trail of Evidence
      • 12 | First experiments
        • Trail of Evidence
        • Building the board
      • 13 | Project Work
        • Trail of Evidence
        • Building scenery
      • 14 | Reframing
        • Trail of Evidence
        • Game ideation
      • 15 | Making fake water
        • Trail of Evidence
      • 16 | Making a cherry blossom tree
        • Trail of Evidence
      • 17 | Expo plan & Clouds
        • Trail of Evidence
      • 18 | Research zine & Coffee soil
        • Research zine
      • 19 | Research zine 2.0
    • Kaz
      • 1 | Kick-Off
      • 2 | Electronics: Connecting Materials
        • Assignment 0 - Zine
        • Assignment 1 - Paper circuits
        • Assignment 2 - Building a speaker
      • 4 | Cutting Supersurfaces
      • 5 | Additive Manufacturing
      • 6 | Untoolkit: Electronic Inputs
      • 7 | Transforming: Molding and Casting with Bioplastics
      • 8 | Untoolkit: Electronic Outputs
      • 11 - 20 | Project: Face Mask Strap
        • 11 | Kick-Off / Pitch
        • Trail of Evidence
        • 15 | Midterm presentation
    • Kim
      • 1 - Introweek
        • Discussion notes
        • Try out zine - Week 1
      • 2 - Electronics: Connecting Materials
        • Zine - Week 2
      • Zine - Week 3
      • 4 - Cutting Supersurfaces
        • The making of: The Sample Book
        • Dense - Clear final sample book
        • Zine - Week 4
      • 5 - Additive Manufacturing
        • Understanding Fusion 360
        • Understanding Cura
        • Understanding the 3D Printer
        • Zine - Week 5
      • 6 - Coronaweek Untoolkit: Electronic Inputs
        • LDR LED connection with Arduino
        • Zine - Week 6
      • 7 - Coronaweek Transforming: Molding and Casting with Bioplastics
        • Material properties sheet + Experiential toolkit
        • Future Bioplastic concept
        • Zine - Week 7
      • 8 - Untoolkit: Electronic Outputs
        • Output swatch
        • Zine - Week 8
      • Project Page Biodegradable Packaging Bags
      • 11 - Project proposal week
        • Trial of evidence week 11
      • 12&13 - Project Bioplastic Consumables
        • Trial of evidence week 12&13
      • 14 - Reframing week
        • Trial of evidence week 14
      • 15 - Project work
        • Trial of evidence week 15
      • 16 - Reframing and expo prep
        • Trial of evidence week 16
        • 16 - The first test
      • Material Sample 1
      • 17 - Project work
        • 17 - Ironing a bioplastic bag
        • 17 - New method for sticking a bioplastic bag together
        • 17 - How to compost?
        • Trial of evidence week 17
      • 18 - Trial of Evidence
      • 19 - Trial Of Evidence
      • 20 - Trial Of Evidence
      • 21 - Final Expostion
    • Laura
      • Week 1: Kick off
      • Week 2: Electronics: connecting materials
      • Week 4: Cutting Supersurfaces
      • Week 5: Additive Manufacturing
      • Week 6: Untoolkit: Electronic inputs
      • Week 7: Transforming Molding and Casting with Bioplastics
      • Foam For Material Activists
        • How to protect?
        • To find a material
        • Foam
        • Trail of Evidence
        • Midterm presentations
    • Summer
      • Foto's
      • Midterm presentation
      • Project: Stop touching
        • Project Proposal
        • Inspirational projects
      • Cutting Supersurfaces
      • Additive Manufacturing
      • Molding and Casting with Bioplastics
        • Creating natural dyes
        • Created bioplastics
      • Electronic input
      • Electronic output
    • Thijs
      • Week 1 - Kickoff
      • Week 2 - Electronics : connecting materials
      • Week 2 - Workshop : debugging circuits
      • Week 2 - Making a speaker
      • Week 3 - Processes & Collaboration
      • Week 4 - Cutting supersurfaces
      • Week 4 - Zine editor
      • Week 5 - Additive manufacturing
      • Week 6 - Untoolkit: Electronic Inputs
      • Week 7 - Transforming: Molding and Casting with Bioplastics
        • Ma2E4 Toolkit
        • Future applications & reflection
      • Week 8 - Untoolkit : electronic outputs
      • Week 11 - Project kickoff
      • Week 12 - First experiments
      • Week 13 - Project work
      • Week 14 - Reframing & trail of evidence
        • Reframing : additional research
        • Shopping list
        • Testing bioplastic material
      • Week 15
      • Weeks 15 - 20
      • Expo prep
  • CLASS NOTES
    • Zine documentation (collaborative doc)
    • Discussions week 2-8
      • Week 02 - Connecting Materials
      • Week 04 - Cutting Supersurfaces
      • Week 05 - Additive Manufacturing
      • Week 06 - Untoolkit Electronics Inputs
      • Week 07 - Transforming Bioplastics
Powered by GitBook
On this page
  • Zine
  • Capacitive sensor + RGB LED
  • Drawing with Capacitive Sensor in Processing
  • Inspiration
  • Setup
  • Changing window size
  • Resizing image to window size
  • Swapping mouse position with sensor values
  • Fitting in with the other outputs
  • End result
  • Final code
  • Arduino IDE
  • Processing
  • Reflection
Export as PDF
  1. Coursework
  2. Kaz

8 | Untoolkit: Electronic Outputs

Previous7 | Transforming: Molding and Casting with BioplasticsNext11 - 20 | Project: Face Mask Strap

Last updated 5 years ago

Zine

Capacitive sensor + RGB LED

//https://www.instructables.com/id/Capacitive-Sensing-for-Dummies/
//https://www.arduino.cc/en/Tutorial/Smoothing
//https://howtomechatronics.com/tutorials/arduino/how-to-use-a-rgb-led-with-arduino/

#include <CapacitiveSensor.h>
// how to install libraries https://learn.sparkfun.com/tutorials/installing-an-arduino-library 
// download capsense lib here https://playground.arduino.cc/Main/CapacitiveSensor/

//send at pin 3, receive at pin 4, 1-10M ohm resistor between
CapacitiveSensor cs_3_4 = CapacitiveSensor(3, 4); // 1-10 megohm resistor between pins 4 & 3, pin 3 is sensor pin, add wire, foil

const int numReadings = 10;     // size of array/number of readings to keep track of (higher = slower)
int readings[numReadings];      // the readings from the analog input
int readIndex = 0;              // the index of the current reading
int total = 0;                  // the running total
int average = 0;                // the average
int brightness = 0;             // initialize delay time at 0
//int ledPin = 11;
int newAverage = 0;             //store values after mapping

int redPin= 11;
int greenPin = 12;
int bluePin = 13;

void setup() {

  pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);

  // initialize serial communication with computer:
  SerialUSB.begin(9600);           //start serial communication via USB cable
  
  cs_3_4.set_CS_AutocaL_Millis(0xFFFFFFFF); // turn off autocalibrate on channel 1 - just as an example Serial.begin(9600);

  //initatialize readings array setting all values to 0
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readings[thisReading] = 0;
  }  
}

void loop() {

  // subtract the last reading:
  total = total - readings[readIndex];

  // read from the sensor:
  readings[readIndex] = cs_3_4.capacitiveSensor(30);

  // add the reading to the total:
  total = total + readings[readIndex];

  // advance to the next position in the array:
  readIndex = readIndex + 1;

  // if we're at the end of the array...wrap around to the beginning
  if (readIndex >= numReadings) {
    readIndex = 0;
  }

  // calculate the average:
  average = total / numReadings;

  // map the average value to the min and max we recorded above
  newAverage = map(average, 0, 65, 0, 255);

  //set brightness of LED to sensorValue (between 0-255)
//  analogWrite(ledPin, newAverage);

  if (newAverage <= 85) {
    setColor(255, 0, 0); // Red Color
  }
  else if (newAverage > 85 && newAverage <= 170) {
    setColor(0, 255, 0); // Green Color
  }
  else if (newAverage > 170) {
    setColor(0, 0, 255); // Blue Color
  }
  
  SerialUSB.print("Old Value = ");
  SerialUSB.print(average);
  SerialUSB.print("\t");   // add a tab between the numbers
  SerialUSB.print("New Value = ");
  SerialUSB.println(newAverage);

  delay(10); // arbitrary delay to limit data to serial port
}

void setColor(int redValue, int greenValue, int blueValue) {
  analogWrite(redPin, redValue);
  analogWrite(greenPin, greenValue);
  analogWrite(bluePin, blueValue);
}

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

Code from Processing example

Pointillism by Daniel Shiffman.

PImage img;
int smallPoint, largePoint;

void setup() {
  size(640, 360);
  img = loadImage("moonwalk.jpg");
  smallPoint = 4;
  largePoint = 40;
  imageMode(CENTER);
  noStroke();
  background(255);
}

void draw() { 
  float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
  int x = int(random(img.width));
  int y = int(random(img.height));
  color pix = img.get(x, y);
  fill(pix, 128);
  ellipse(x, y, pointillize, pointillize);
}

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

float pointillize = map(mouseX, 0, width, smallPoint, largePoint);
float pointillize = map(dataInput, 0, width, smallPoint, largePoint);

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.

Final code

Arduino IDE

//ARDUINO CODE FOR ANALOG SENSOR
int sensorValue = 0;

void setup() {
SerialUSB.begin(9600); //needs to match processing baudrate
}

void loop() {
//SerialUSB.println(analogRead(A0)); // for debugging only
sensorValue = analogRead(A0); // store value in sensorValue
SerialUSB.write(map(sensorValue, 0,1023,255,0)); // map to processing range
delay(50);
}

Processing

/*
  DRAWING WITH CAPACITIVE SENSOR by Kaz Bison
  
  Recources:
  https://hello.processing.org/editor/             <- Nice for understanding the basics of Processing
  https://processing.org/examples/pointillism.html <- Processing example I used
*/

import processing.serial.*;
Serial myPort;
int dataInput;
PImage img;
int smallPoint, largePoint;

void setup() {
  println(Serial.list()); //use to find list of your port addresses
  String portName = "/dev/cu.usbmodem141101";  //change to your own port address! (Arduino: Tools > Port)
  myPort = new Serial(this, portName, 9600); //needs to match arduino baudrate
  size(600, 600); // window size 600 x 600 px
  img = loadImage("copper-on-black-pattern.jpg"); //image source (I removed the bottom part): https://cdn2.vectorstock.com/i/1000x1000/09/01/copper-rose-gold-foil-florals-on-black-pattern-vector-22540901.jpg
  img.resize(width,height);
  smallPoint = 4;
  largePoint = 40;
  noStroke();
  background(255);
}

void draw() {
  float pointillize = map(dataInput*20+70, 0, width, smallPoint, largePoint);
  int x = int(random(width));
  int y = int(random(height));
  color pix = img.get(x, y);
  fill(pix, 128); //uses color for ellipse from picture
  rect(x, y, pointillize, pointillize);
  println(dataInput); // data sent from Arduino in console
}

void serialEvent(Serial myPort) {
  dataInput = myPort.read();
}

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.

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 has some cool examples.

At first I chose to recreate 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.

In the beginning of the week I ordered some 1M ohm resistances at . 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.

thedotisblack creative coding
this video
tinytronics.nl
LDR sensor circuit