Saturday, September 27, 2014



Lab #3
 first research:

The Piezo or knock sensor is a little disk that detects sound over a certain threshold.
you connect to ground (black)and an analog pin with a resistor.. A Piezo is an element that can be used to produce or detect sound.. It can be used to perhaps open a door when a loud enough knock is sensed..Also the result can be printed to the serial port to be used in serial communication with processing.


Now for the sensor experiments.. I was able to get the light sensor to read in a variety of configurations.. The potentiometer I had (at home) kept falling off the breadboard ..it worked but was unstable so did not video it. The photocell was much better and got two to work.. just worked with fade and calibrating but understand smoothing and mapping..

here is some code and video..

nt buttonPinA = 8; //set buttonpin#
int buttonPinB = 9; //set buttonpin#
int buttonPinC = 10; //set buttonpin#
int sensorValue = 0;         // the sensor value
int sensorMin = 1023;        // minimum sensor value
int sensorMax = 0;           // maximum sensor value


const int ledPin = 5; //set ledpin#
const int sensorPin = A0;    // pin that the sensor is attached to
byte leds = 0;

void setup() {
 
  pinMode(ledPin, OUTPUT); //led output
  pinMode(buttonPinA, INPUT_PULLUP); //button input
  pinMode(buttonPinB, INPUT_PULLUP); //button input
  pinMode(buttonPinC, INPUT_PULLUP); //button input
  //digitalWrite(buttonPin,HIGH);
  // turn on LED to signal the start of the calibration period:
  pinMode(13, OUTPUT);
  digitalWrite(13, HIGH);

  // calibrate during the first five seconds
  while (millis() < 5000) {
    sensorValue = analogRead(sensorPin);

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

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

  // signal the end of the calibration period
  digitalWrite(13, LOW);

}
void loop() {
   // read the sensor:
  sensorValue = analogRead(sensorPin);

  // apply the calibration to the sensor reading
  sensorValue = map(sensorValue, sensorMin, sensorMax, 0, 255);

  // in case the sensor value is outside the range seen during calibration
  sensorValue = constrain(sensorValue, 0, 255);

  // fade the LED using the calibrated value:
  analogWrite(ledPin, sensorValue);

  //buttonState = digitalRead(buttonPin); //read state of button

  if (digitalRead(buttonPinA) == LOW)
  {
    digitalWrite(ledPin, HIGH);
  }
  // else{
  //turn led off
  if (digitalRead(buttonPinB) == LOW)
  {
    digitalWrite(ledPin, LOW);
  }

  if (digitalRead(buttonPinC   ) == LOW)
  {
    digitalWrite(ledPin, HIGH);
  }
}

and another which I put in a little left over box project to finally finish it.. was able to connect 9V battery so no wires ma!

//Pins:
int sensorPin = 0;
int lightPin = 2;
int lightState = 0;
int lowThreshold = 8;
int highThreshold = 20;

void setup()  {
  //start serial & set pin to output

  Serial.begin(9600);
  pinMode(lightPin,OUTPUT);



}
void loop(){

  //read the sensor pin:
  int sensorValue = analogRead(sensorPin);

  //if light level low switch light on
  Serial.println(sensorValue);
  if(sensorValue < lowThreshold){

    digitalWrite(lightPin, HIGH); 

  }

  if (sensorValue > highThreshold)
    digitalWrite(lightPin, LOW);

}
I changed the calabration so would respond to my readings


here is little compiled video of experiments






Monday, September 15, 2014

This is my update....

Tried the multimeter.. got some readings but am still a bit murky on exactly how to make sence of it.

Would be great if you could do a demo in class.. The meter I got from Amazon is a bit different that the one shown in the lab.. Just would like to be clear on the differences and in general how it works and when is necessary to use. ( I know its explained but I think I need more real time example)

The first button lab went well.. Here is a little video:

The next three button lab was a little confusing, I followed the illustration for the breadboard
but there was no sample code. I looked on line and was not sure what to use.. so would be great if you could go over that as well. I will try to make a soft a switch and bring it in..
The readings were interesting. I liked Talk to me.. I do agree that the most complicated interactivity is not always the best choice and the focus when designing a project needs to be on how effective is the tool and its capacity to deliver its message with an integrated aesthetic... The rant was good .. as I agree that it is important to consider the whole body in terms of interactive access..

The cookbook was much too much material to absorb..Most of us have limited programing background .. I have a little and still all that material needs some practical reference to really understand.. I could not see any code that referenced the breadboard set-up in the second lab..I was not sure if I should add a wire to pin 13 from the led and to wire the switches to one pin or three..

So.. not that successful.  but I like making videos when things do work..

code for first button project

void setup() {
  pinMode(2, INPUT); //sets the switch to be an input
  pinMode(3, OUTPUT); // sets green led pin to be output
  pinMode(4,OUTPUT);  // sets the yellow led pin to be aan output
 
}

void loop() {
 
  if (digitalRead(2) == HIGH) {
   
    //if switch is closed:
   
    digitalWrite( 3, HIGH); // turn on green led
   
    digitalWrite(4,LOW); // turn yellow led on
  }
  else {
    //if the switch is open:
    digitalWrite(3, LOW);  //turn off green
   
    digitalWrite(4,HIGH); //turn on yellow
  }
   


}

I finally got the three button configuration to work..
found an adafruit tutorial that showed how the little button is wired..
that was whole issue..

here is a video that includes code for two versions


oops.. code doesn't read  so

#1
three button#1
three button #2





Monday, September 8, 2014

BLINK and MORE

This is a little clip of a blinking led.. a slight elaboration by connecting one leg to pin 13 and the other to ground .

Went through the other labs , watched the videos.. need to watch repeatedly.. but are great..

ready for next step..

I have encountered most of information before .. but needs to be burned into my brain so I can finally feel comfortable... 



I found the video on setting up a breadboard especially helpful. Although I thought I already knew how to do it , the explanation was very clear and I believe it will make my next project with a breadboard much cleaner and workable. It is great to have the experts at ITP provide this information. I am thrilled.The voltage regulator is still a little mysterious as I have never used one. I have used resistors and hooked up power supplies.. I did not know VR's were usually included. Perhaps we can clarify in next class.

 I am noticing a lot of the components are three pronged . It seems to mean power ,pin and ground.. How exactly to position 3 prongs in bread board is still a little fuzzy.. The transistors and their differences were explained in the video but their function was not demonstrated so am not so clear on how to use them. I just looked at the servo video and infered that if one was to use a separate power source in addition to the 5v of the arduino one would use a separate voltage regulator.. 

The soldering video from Adafruit was very informative.. I for one will get goggles as I am far sighted and take my glasses off for close work.. I do not like to take chances with my eyes.. Also as suggested I am getting a fume extractor.. not that I am paranoid.. but I've had friends get sick from art related health hazards.. The video is something again I will watch several times even though I solder fairly well.

I am hoping that this class will hone the few skills I have in Pcomp and greatly expand my abilities.. Motors have always been very mysterious and as an animator who wants to apply that sensibility to physical components, it seems to be necessary to have a clear understanding of,  which I hope this class will guide me towards. I am also very interested in how the many projects I admire by artists who use Pcomp not only achieve their technical mastery but also what are their theoretical and philosophical underpinnings. There are many other things I want to learn.. It probably is much more than one class can cover. I hope however we can talk about wearable and soft circuitry (something I have experimented with and am becoming obsessed by)...