Week 8 - Untoolkit: Electronic Outputs

Untoolkit: Electronic Outputs

This week we are going to work with outputs. We have to write 150 words about our own toolkit that we may have used in the last couple of weeks. Next to that you have to make an original image that fits your text. This week the editors for the zine are Kim and Summer.

Zine design

https://www.notion.so/Week-8-Dezine-toolkit-56c8d7410b4b4cf295017ebebbdd5cb3

My text

This week we talked about toolkits and how this was a part of the exercises the last couple of weeks. A lot of the things we did, I’ve never done before, so what I found really helpful is to start with an introduction. We had this in workshops, but you can also look online for videos. It’s always nice to know the basics and to know what’s possible. The next step is to lay out everything in a comprehensive and clear manner. This way you know which materials you have, and you can start experimenting. I always go in blindly and start doing stuff. Sometimes it works and sometimes you’re not getting anywhere. When things are not working out it’s nice to draw it out, to find instruction videos online or talk to other people about it. This always helps me. You’ll usually figure out really quickly what to do with this new inspiration and explanations.

Desiree van Dam

My visuals

My files

The end product

http://summerdanoe.nl/zine/

Assignment 0 - Zine with the entire group

Produce a class zine on the RISO printer together, 2 people will be editors this week. Individual contributions in the form of zine spreads.

Zine prompt:

"In a 'post-post-it' society, I wonder what the ultimate design toolkit to train the 21st century designer could be. Rather than the usual canvases or user journey maps, this toolkit would feature a set of basic design exercises that help everyone, not only design students, to make things that move, think, communicate, sense, see, compute or augment. These exercises would help students to control technology, to assertively own it as a material, a tool, and a key factor influencing society today." - Serena Cangiano

Reflect on your experience in the minor thus far. Can you link this to the readings of this week?

This week the zine will be an ultimate design toolkit. Think, create, design an exercise that would be part of this ultimate design toolkit, Cangiano mentions. Reflect on this exercise, why did you choose this, how is it linked to the minor and to this weeks reading.

Assignment 1 - individual

  • Build an electronic circuit with at least one input (made by you!) and one actuator. Bonus assignment connecting your input with Processing.

  • Program a microcontroller in the Arduino IDE to control your actuator with the input

  • Design an output swatch of 10x10cm that is archive worthy. How can you make hardware look interesting/appealing/evocative? Use all the techniques you learned in previous weeks.

  • Document the design, building, debugging and working results step by step

Connecting sensor with led

First I tried to connect my sensor with the new led. This worked pretty quickly because I'd done this before two week ago. However, I accidentally caused a short circuit at one of the LED lights, now only the blue and the green still work. This is a bit stupid of me but sadly I can do nothing about it at this time.

Connecting button with led

Then I connected the button with the led. I used one from the kit because Anoush has our homemade switches at her home. Again this went very smoothly.

Connecting the motor

Later I tried to connect the motor. I asked Micky for some help because I didn't know where to start. Micky gave me then some links with explanations. I followed the instructions and it accually went very smoothly then. It worked and I was very happy. Then I looked into how to connect the sensor and button with the motor.

Source: https://learn.adafruit.com/adafruit-arduino-lesson-13-dc-motors/arduino-code, https://www.tutorialspoint.com/arduino/arduino_dc_motor.htm

Connecting button with motor

First I tried to connect the motor with the button because I thought this would be easier (and I was right). This also was very easy and I was happy and confident to try it with the sensor.

Connecting sensor with motor

The sensor was a completely different story. I attached all the wires but the motor kept going at full speed. At first I thought that was because the motor is attached to it's own energy source, so I removed the vin. But that didn't work so I looked at the picture of the button and saw that I put the D1 in the circuit of the sensor. So I tried to do that aswel but it still didn't work. It was very frustrating and I tried a lot of different ways but I couldn't figure out how to get it to work. So then I asked Micky if she could help me.

I talked with Micky for about two hours, to debug the circuit. At first we looked at how everything was plugged in. We deattached the power and put the analog wire next to the wire of the sensor. This didn't work. So we went to check if the sensor worked. We deattached the motor and put in Loes her code. This worked so we attached the motor again, but this time a bit differently. Then the motor stared to make a weird noise. The noise would go louder the more I pressed the sensor. Later we found out that the motor works but doesn't spin, it's moves a bit to the side when I press my sensor and than goes back when I let go. Which meant it worked but the motor can't handle different variations in readings. So it works and Micky is going to look into getting the motor to work.

/*
   Loes Bogers - March 2019
   Liza Stark - May 2018
   This sketch reads an analog sensor. It incorporates smoothing
   and calibration examples by Mellis and Igoe.
   The sensor is attached to A0 through a 10k voltage divider.
*/

// Define the number of samples to keep track of.  The higher the number,
// the more the readings will be smoothed, but the slower the output will
// respond to the input.  Using a constant rather than a normal variable lets
// use this value to determine the size of the readings array.

const int numReadings = 10;     // average number of readings
int readings[numReadings];      // the readings from the sensor
int readIndex = 0;              // the index of the current reading on the sensor
int total = 0;                  // the running total for the sensor
int average = 0;                // the average for the sensor
int sensorPin = A1;                // sensor pin
int ledPin = 3;                // LED connected to digital pin 3 (PWM pin ~ )

// Calibration variables
int sensorValue = 0;
int sensorMin = 1023;           //this is supposed to be higher
int sensorMax = 0;              //this is supposed to be lower

void setup() {

  // initialize serial communication with computer:
  Serial.begin(115200);

  // turn on LED to signal the start of the calibration period:
  pinMode(ledPin, OUTPUT);
//  digitalWrite(ledPin, HIGH);

  pinMode(sensorPin, INPUT);   // sets the pin as output

  // initialize all the readings on the sensor to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readings[thisReading] = 0;
  }

  Serial.println("Calibration beginning");
  Serial.println("Find the extremes of your sensor for 5 secs");

  // calibrate during the first five seconds
  while (millis() < 5000) {        //make shorter if it crashes
    sensorValue = analogRead(sensorPin);

    // record the maximum sensor value
    if (sensorValue > sensorMax) {
      sensorMax = sensorValue;
    }

    // record the minimum sensor value
    if (sensorValue < sensorMin) {
      sensorMin = sensorValue;
    }

    // print values for debugging
    Serial.print("Max = ");
    Serial.print(sensorMax);
    Serial.print("\t");
    Serial.print("Min = ");
    Serial.println(sensorMin);

  }

  // signal the end of the calibration period
//  digitalWrite(ledPin, LOW);
  Serial.println("Calibration end");

}

void loop() {
  // READ VALUES COMING IN FROM THE SENSOR - Take average of 10 readings
  // subtract the last reading:
  total = total - readings[readIndex];

  // read from the sensor:
  readings[readIndex] = analogRead(sensorPin);

  // 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...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }

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

  // print the original average for debugging
  Serial.print("Average = ");
  Serial.print(average);
  Serial.print("\t");

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

  // constrain the values within a certain range
  average = constrain(average, 0, 255);

  //set brightness of LED to average value (after mapping and constraining, so between 0-255)
  analogWrite(ledPin, average);  

  // print the new average for debugging
  Serial.print("New Average = ");
  Serial.println(average);

  delay(1);        // delay in between reads for stability

}

Later that evening Micky texted me with the solution. The motor has not enough power to start on its own. So you have to spin it a bit to give it a kick start and than it will spin on its own. I tried this the next morning and it worked. I adjusted the values a bit because when it's standing still, I have to kickstart it again. So I have set the values not to fall below 100, because below 100 the motor will stop. Doing this keeps the engine running all the time and I don't have to kickstart it again.

Values from 0 to 255 when the motor will stop and you have to kickstart it again:

// record the maximum sensor value
    if (sensorValue > sensorMax) {
      sensorMax = 550;
    }

    // record the minimum sensor value
    if (sensorValue < sensorMin) {
      sensorMin = 350;
    }

Values from 100 to 255 so the motor can continue spinning:

  // record the maximum sensor value
    if (sensorValue > sensorMax) {
      sensorMax = 550;
    }

    // record the minimum sensor value
    if (sensorValue < sensorMin) {
      sensorMin = 270;
    }

Mixing Led colors with sensor

Later I tried mixing the colors with code. Sadly my red is burned out so I did my best with the other two. I looked at DLO and made the circuit and copied the code from Micky from google drive. At first I thought it didn't work because I could only get one color. Later I figured that you had to put in some values in the code. I entered the values (highest = 1024, lowest = 370) and it worked. I then commented the code for red out and when the values are low you get blue, by middle you get green and really high you get aqua. It is a pity that I cannot make all colors.

/*
   Micky van Zeijl - March 2020
   Loes Bogers - March 2019
   Liza Stark - May 2018
  
   This sketch reads an analog sensor. It incorporates smoothing
   and calibration examples by Mellis and Igoe.
   The sensor is attached to A0 through a 10k voltage divider.

*/

// Define the number of samples to keep track of.  The higher the number,
// the more the readings will be smoothed, but the slower the output will
// respond to the input.  Using a constant rather than a normal variable lets
// use this value to determine the size of the readings array.

const int numReadings = 10;     // average number of readings
int readings[numReadings];      // the readings from the sensor
int readIndex = 0;              // the index of the current reading on the sensor
int total = 0;                  // the running total for the sensor
int average = 0;                // the average for the sensor
int sensorPin = A1;             // sensor pin I used A1 forArduino MKR
//int ledPin = 3;               // LED connected to digital pin 3 (PWM pin ~ )
//int redPin = 10; // for Arduino MKR 1010 use pin 3 (PWM pin ~ )
int bluePin = 4; // for Arduino MKR 1010 use pin 4(PWM pin ~ )
int greenPin = 5; // for ARduino MKR 1010 use pin 5 (PWM pin ~ )




// Calibration variables
int sensorValue = 0;
int sensorMin = 1023;           //this is supposed to be higher
int sensorMax = 0;              //this is supposed to be lower

void setup() {

 // pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  // initialize serial communication with computer:
  Serial.begin(115200);

  // turn on LED to signal the start of the calibration period:
  // pinMode(ledPin, OUTPUT);
  //  digitalWrite(ledPin, HIGH);

  pinMode(sensorPin, INPUT);   // sets the pin as output

  // initialize all the readings on the sensor to 0:
  for (int thisReading = 0; thisReading < numReadings; thisReading++) {
    readings[thisReading] = 0;
  }

  Serial.println("Calibration beginning");
  Serial.println("Find the extremes of your sensor for 5 secs");

  // calibrate during the first five seconds
  while (millis() < 5000) {        //make shorter if it crashes
    sensorValue = analogRead(sensorPin);

    // record the maximum sensor value
    if (sensorValue > sensorMax) {
      sensorMax = 1025;
    }

    // record the minimum sensor value
    if (sensorValue < sensorMin) {
      sensorMin = 370;
    }

    // print values for debugging
    Serial.print("Max = ");
    Serial.print(sensorMax);
    Serial.print("\t");
    Serial.print("Min = ");
    Serial.println(sensorMin);

  }

  // signal the end of the calibration period
  //  digitalWrite(ledPin, LOW);
  Serial.println("Calibration end");

}

void loop() {
  // READ VALUES COMING IN FROM THE SENSOR - Take average of 10 readings
  // subtract the last reading:
  total = total - readings[readIndex];

  // read from the sensor:
  readings[readIndex] = analogRead(sensorPin);

  // 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...
  if (readIndex >= numReadings) {
    // ...wrap around to the beginning:
    readIndex = 0;
  }

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

  // print the original average for debugging
  Serial.print("Average = ");
  Serial.print(average);
  Serial.print("\t");

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

  // constrain the values within a certain range
  average = constrain(average, 0, 255);

  //set brightness of LED to average value (after mapping and constraining, so between 0-255)

  /* Use the readings of the sensor to control the LED. Each RGB color pin is linked to the readings of average. You can play around with the color combination of each pin. At the moment it’s a bit random.  
*/

  if (average <= 85) {

 //   analogWrite(redPin, average*3);
    analogWrite(greenPin, 0);
    analogWrite(bluePin, (85-average)*3);
  }

  else if (average > 85 && average <= 240) {

  //  analogWrite(redPin, (170-average)*3);
    analogWrite(greenPin, (average-85)*3);
    analogWrite(bluePin, 0);

  }

  else {
 //   analogWrite(redPin,0);
    analogWrite(greenPin, (240-average)*3);
    analogWrite(bluePin, (average-240)*3);
    
  }



  // print the new average for debugging
  Serial.print("New Average = ");
  Serial.println(average);

  delay(1);        // delay in between reads for stability

}

Changing Led colors with button

Later I tried it with the button. I made the circuit that Micky posted on DLO and used her code. This was easier then with the sensor and I got it working pretty quickly. I commented the code for red out again and made the last one aqua (so blue and green on HIGH).

//       RGB LED Color Control
//      circuits4you.com
//========================================================================
//Changes made by Micky van Zeijl 
 
// constants won't change. They're used here to
// set pin numbers:
 
// Make sure to change the pinnumbers when you’re using the Arduino MKR.
// For the nodeMcu you can use all pins except 0. Don’t forget to add a D
// so it’s redPin = D3; for example

const int buttonPin = 6; // for Arduino MKR 1010 I used 6
//const int redPin = 10; // for Arduino MKR 1010 - use pin 3
const int bluePin = 4; // for Arduino MKR 1010 - use pin 4
const int greenPin = 5; // for ARduino MKR 1010 - use pin 5

int counter = 0;
bool previousbuttonstateLow = false;

void setup() {
  pinMode(buttonPin, INPUT);
  //pinMode(redPin, OUTPUT);
  pinMode(greenPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
  Serial.begin(9600);
}

void loop() {

  int buttonState;
  buttonState = digitalRead(buttonPin);

  Serial.println(counter);

  if (buttonState == LOW && !previousbuttonstateLow) {
    counter++;

    if (counter > 3) counter = 0;
    previousbuttonstateLow = true;

  }

  if (buttonState == HIGH) {
    previousbuttonstateLow = false;
  }

  Serial.print("buttonstate is:" );
  Serial.println( buttonState);
  Serial.print("previous buttonstate is:");
  Serial.println(previousbuttonstateLow);

  if (counter == 0) {
    //digitalWrite(redPin, LOW);
    digitalWrite(greenPin, LOW);
    digitalWrite(bluePin, LOW);
  }

  else if (counter == 1) {
    //digitalWrite(redPin, HIGH);
    digitalWrite(greenPin, LOW);
    digitalWrite(bluePin, HIGH);
  }

  else if (counter == 2) {
    //digitalWrite(redPin, LOW);
    digitalWrite(greenPin, HIGH);
    digitalWrite(bluePin, LOW);
  }

  else if (counter == 3) {
    //digitalWrite(redPin, LOW);
    digitalWrite(greenPin, HIGH);
    digitalWrite(bluePin, HIGH);
  }


}

Swatch

For the swatch I wanted to do something with the motor. What can I attach to the motor to make it interesting? I was thinking of our first lesson when we had to bring stuff that suited us. Sam then took a spiral thing and I tried to copy that. For this I cut a skewer and cut rounds of some gray cardboard. I also found some ribbons in the house and cut them into small pieces. I connected te pieces and attached it to the motor. Later I thought about the unity (black and copper), but I already made mine with colors. Later I will make a new one with only black and white.

I made an hole in the middle of the black cardbox where the tip of the motor could go through. On the side I put some coppertape. On the back I connected the motor to the coppertape with aluminium foil and some coppertape. The motor was not very tightly bound this time. That's why I put some black tape over it for support. At last I connected the spiral thing to the motor with tape.

Show and tell

Reflection

This week I learned how to attach an motor to the arduino and how to work with an RGB led. This was very interesting because I had never done this before and I really had to do it on my own with a bit of help from a website. After a while I figured out how it worked and I was really happy about it. I'm glad I already had an intro about this subject in week 6 so I knew the basics again. I also learned more about the code and how to make different colours with the LED. I liked to figure out how it works even tho it took me awile. Making the swatch was also a fun process even tho it's not working the way I inteded it to. But next time I have to think before I start making it because it has to be black instead of different colours.

This week I didn't had that much time to look at processing but maybe I can look at that later.

Last updated