Friday, December 14, 2018

Random Notes from Semester

Arduino Notes
  • Early 2000s in Ivrea, Italy
    • Design school that wanted to encourage interdisciplinary practice between designers and engineers. 
  • Regent is root word for Arduino.
    • Arduino is open sourced. When the company went down the plans became open sourced.
    • You can still buy genuine Arduino boards.
  • Input (sensor) -> Programming/Computing/Processing -> Output (physical)
  • Anolog IN
    • On board bottom left: A0->A5 = Anolog
  • Power
    • VIN = Voltage in, unregulated voltage
    • RES = Reset
  • TX = transmit
  • RX = receive
  • Digital PWN
  • AREF = what voltage is coming in/ground state A Reference
  • Serial communication pins
  • Arduino Preferences:
    • Need to change root folder
      • Removable hard drive for root folder
      • Volumes on computer under Macintosh HD
        • Arduino->preferences->browse->mac->volumes->save location
      • Turn on Display Line numbers. Enable Code folding and use external editor are turned off
      • Square end is USB B, regular flat is USB A
      • Tools->Port
      • Tools->Arudiuno
  • Pseudocode: in english what you want to do with code
  • pinMode(address, INPUT/OUTPUT); was placed in setup
  • digitalWrite(address, HIGH/LOW); was placed in loop, turn on/off.
    • high/low is a "constant"
    • digitalWrite written in camel hump; the capitalizations

  • delay(number); measured in milliseconds
  • verify = compile
  • About 30 milliAmps is max from ports
  • pulse width modulation-pwm = ~
  • http://osoyoo.com/2017/07/24/arduino-lesson-obstacle-avoidance-sensor/ 
Cyborgs and Space Discussion 
  • Cybernetics-known as artificial intelligence; studies of systems and how they auto-regulate and make decisions.
  • Homeostasis; cybernetics developed out of attempts to create a better defense mechanism.
  • Cyborg-robot like problems set to take care of themselves so that humans can explore and do more.
  • Man become a slave to the machine when it has to continuously stop and attend to remedial tasks that technology should be able to take care of.
  • Implants and mergers of machines in our bodies.
  • cochlear implant-stimulate the auditory nerve
  • Signless magnitude change
  • Temperature IR readings
  • Test cold objects
  • Test different temperature conditions
  • The loop keeps repeating, so the initial beginning sensor reading would continue to change and not be reliable if the object stopped moving.
  • What can I do with a temperature IR sensor as far as a new project, and how would i program the lights and buzzer to this new idea
  • Setting a threshold value
  • proximity
  • ultrasonic

Week Fifteen Experience Documentation

Reflection
  • I then built the head piece for my project. I used:
    • 8 and 12 gauge wire.
    • hot glue
    • an adjustable face shield, but removed the shield
  • The order I made the project was:
    • I secured the sensors to the head piece.
    • I connected all of the power and ground wires from the sensors to one power and ground wire, which got glued underneath the head piece.
    • I forcefully bent the metal around the head piece in the shape I wanted, and then wrapped it around where the black piece for tightening meets the head piece. I then tightened the black pieces to secure the wire.
    • I soldered the capacitor and resistor to the LED strip.
    • I glued the LED strip to the 12 gauge metal.
    • I glued pieces of 8 gauge metal on the back of the arduino, and then looped a piece underneath.
    • I made a necklace shape, and then a simple hooking mechanism by bending the wire.
    • I placed the arduino loop onto the necklace shape, creating an arduino necklace.
    • I measure the lengths of all the wires to the arduino while wearing the head piece.
    • I braided and heat shrink wrap around the wires to the arduino.
    • I placed a battery on the back of the arduino.
  • Ta-dah. For more information, the method was described in detail in my instructables found in another blog post.
Overall, I learned a lot this semester. As a reflection, this semester was a struggle as far as making sure I had the right parts and objects, since most of what I wanted to use either had technicalities I didn't know how to overcome or simply didn't work as I was hoping. But overall, I persisted, and with the help of Thomas and my peers, as well as my own randomness and research, I managed to come up with a new idea for the parts I had available. While I probably could have started earlier on the actual building of some of my projects, I felt that I had a good schedule as far as how I handed the electronic portion of the class. If I ever came back to the Noise Project and this final project, now that I know how the electronics work, I would think more seriously about what interface I'd like to use. However, I'm glad that at the very least my electronics have continued to work as I needed them to this semester, and I enjoyed working with LEDs, since it provided a way for me to immediately see the effects of my program and soldering. 

Week Fourteen Experience Documentation

Reflection
Monday
  • On Monday, I created both a program and system that utilized four proximity sensors and four LEDs.
  • First, I wired one sensor to the board using the online example from: Arduino Lesson for sensor
    • I noticed that there was not a large distance range, and I tried tweaking the sensor with a small screw driver to make the range a little larger.
    • After getting the sensor to work, I initialized 3 other sensors so that I knew all three worked and all three were set to the same range.
  • Next, I wired a setup on the bread board that would allow me to test all four sensors for proximity distance, and i wired four LEDs on the board so that one LED would correlate to one sensor.
    • The sensors were wired from ports 2-5, named in the order yellow, green, purple, and brown, based off of the color of the output port on the sensor.
    • The LEDs were wired from ports 9-12, with 12 being yellow, down to 9 being brown.
    • All LEDs were wired from their specific ports, and all the ends of the LEDs led to the same ground port, which tied into the arduino.
    • All of the sensors shared the same vcc/power port, and the same ground. However, their output was plugged into specific ports on the arduino.
  • After this was completed, a test was run to see if I could use anolog readings to determine distance, but the range was so limited that it was not possible. I will be changing my design to react simply to something being in front of the sensor in relation to and LED rather than having varying reactions in accordance to the distance of an object from my sensor.
  • Someone told me about two good forums to look at if I had issues:
  • This is the tutorial I was looking over that Thomas suggested that talks about how to program LEDs: Neopixel Guide.
  • The programs for testing one sensor and testing four sensors can be found below.
  • The video for testing four sensors can be seen below the two programs in figure 1.
--------------------------------------------------------------------------------------------------------------------------
Code for testing one sensor:
int LED = 13; // Use the onboard Uno LED
int isObstaclePin = 2;  // This is our input pin
int isObstacle = HIGH;  // HIGH MEANS NO OBSTACLE

void setup() {
  pinMode(LED, OUTPUT);
  pinMode(isObstaclePin, INPUT);
  Serial.begin(9600);  
}

void loop() {
  isObstacle = digitalRead(isObstaclePin);
  if (isObstacle == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!!");
    digitalWrite(LED, HIGH);
  }
  else
  {
    Serial.println("clear");
    digitalWrite(LED, LOW);
  }
  delay(200);
}

--------------------------------------------------------------------------------------------------------------------------

Code for testing four sensors:

int yLED = 12; // Use the onboard Uno LED
int gLED = 11; //LED
int pLED = 10; //led
int bLED = 9; //led

int yellowObst = 2;  // Sensor 1
int isYellow = HIGH; // HIGH MEANS NO OBSTACLE FOR SENSOR 1

int greenObst = 3; //sensor 2
int isGreen = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 2

int purpleObst = 4; //sensor 3
int isPurple = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 3

int brownObst = 5; //sensor 4
int isBrown = HIGH;  // HIGH MEANS NO OBSTACLE FOR SENSOR 4

void setup() {
  //led outputs
  pinMode(yLED, OUTPUT);
  pinMode(gLED, OUTPUT);
  pinMode(pLED, OUTPUT);
  pinMode(bLED, OUTPUT);
  //end led outputs
  
  //sensor inputs
  pinMode(isYellow, INPUT);
  pinMode(isGreen, INPUT);
  pinMode(isPurple, INPUT);
  pinMode(isBrown, INPUT);
  //end sensor outputs
  
  Serial.begin(9600);  
}

void loop() {

//DECLARE IF SENSOR 1 (YELLOW) IS ACTIVE
  isYellow = digitalRead(yellowObst);
  if (isYellow == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");
    digitalWrite(yLED, HIGH);
  }
    else
  {
    //Serial.println("clear");
    digitalWrite(yLED, LOW);
  }
  //delay(200);

//END SENSOR 1 READING

//DECLARE IF SENSOR 2 (GREEN) IS ACTIVE
  isGreen = digitalRead(greenObst);
  if (isGreen == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 2 (green)");
    digitalWrite(gLED, HIGH);
  }
    else
  {
    //Serial.println("clear");
    digitalWrite(gLED, LOW);
  }
  //delay(200);

//END SENSOR 2

//DECLARE IF SENSOR 3 (PURPLE) IS ACTIVE
  isPurple = digitalRead(purpleObst);
  if (isPurple == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 3 (purple)");
    digitalWrite(pLED, HIGH);
  }
    else
  {
    //Serial.println("clear");
    digitalWrite(pLED, LOW);
  }
  //delay(200);

//END SENSOR 3 READING

//DECLARE IF SENSOR 4 (BROWN) IS ACTIVE
  isBrown = digitalRead(brownObst);
  if (isBrown == LOW)
  {
    Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 4 (brown)");
    digitalWrite(bLED, HIGH);
  }
    else
  {
    //Serial.println("clear");
    digitalWrite(bLED, LOW);
  }
  //delay(200);

//END SENSOR 4 READING
  /*
  else
  {
    Serial.println("clear");
    digitalWrite(LED, LOW);
  }*/
  delay(200);
}

--------------------------------------------------------------------------------------------------------------------------

Figure 1. Test for sensors.


Wednesday
  • On Wednesday, Thomas and I tried to get the Neopixels that I ordered from Amazon working, but there seemed to be some sort of issue with the wiring that did not work well with any of the programs provided by Adafruit or otherwise. We tried a fastled library, as well as a Neopixel library.
    • While not useful for this project, the LEDs I ordered come with a sound sensor that allows me to have the lights change color automatically, although I don't know how to change them to fit my wants.
  • Thomas loaned me an LED strip, which we then tested with the Adafruit programs. It worked fine, proving that there was either an issue or some unclear formatting with the pixels I ordered. After running the initial coding and ensuring that the strip worked properly, I went through and edited the code to change according to the sensor input.
  • My sensors remained wired to pins 2-5, while the led strip was wired to pin 6. LEDs 0-2 were linked to sensor 1, LEDs 3-5 were linked to sensor 2, LEDs 6-8 were linked to sensor 3, and LEDs 9-11 were linked to sensor 4. 
    • The numbering used, 0-11, corresponds to the physical LED positions on the strip, 1-12.
  • So, while all remain green when clear, when the corresponding sensor is activated, the 3 sensors linked to a specific sensor turn red. 
  • The program for this can be found below.
  • The test for this can be seen below the code, in figure 2.
--------------------------------------------------------------------------------------------------------------------------
Code for testing LED strip:

// NeoPixel Ring simple sketch (c) 2013 Shae Erisson
// released under the GPLv3 license to match the rest of the AdaFruit NeoPixel library

//DECLARE SENSORS
int yellowObst = 2;  // Sensor 1
int isYellow = HIGH; // HIGH MEANS NO OBSTACLE FOR SENSOR 1

int greenObst = 3; //sensor 2
int isGreen = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 2

int purpleObst = 4; //sensor 3
int isPurple = HIGH; //HIGH MEANS NO OBSTACLE FOR SENSOR 3

int brownObst = 5; //sensor 4
int isBrown = HIGH;  // HIGH MEANS NO OBSTACLE FOR SENSOR 4
//END DECLARE SENSORS


#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
  #include <avr/power.h>
#endif

// Which pin on the Arduino is connected to the NeoPixels?
// On a Trinket or Gemma we suggest changing this to 1
#define PIN            6

// How many NeoPixels are attached to the Arduino?
#define NUMPIXELS      12

// When we setup the NeoPixel library, we tell it how many pixels, and which pin to use to send signals.
// Note that for older NeoPixel strips you might need to change the third parameter--see the strandtest
// example for more information on possible values.
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

int delayval = 5; // delay for half a second

void setup() {
  // This is for Trinket 5V 16MHz, you can remove these three lines if you are not using a Trinket
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
  // End of trinket special code

  pixels.begin(); // This initializes the NeoPixel library.

  //LED STRIP
  //pinMode(PIN, OUTPUT);
  //END LED STRIP
  
  //sensor inputs
  pinMode(isYellow, INPUT);
  pinMode(isGreen, INPUT);
  pinMode(isPurple, INPUT);
  pinMode(isBrown, INPUT);
  //end sensor outputs

  Serial.begin(9600); 
}

void loop() {

  // For a set of NeoPixels the first NeoPixel is 0, second is 1, all the way up to the count of pixels minus one.

//DECLARE IF SENSOR 1 (YELLOW) IS ACTIVE
  isYellow = digitalRead(yellowObst);
  if (isYellow == LOW)
  {
    //Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");
    for(int i=0;i<3;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
    }
    else
  {
    //Serial.println("clear");
    for(int i=0;i<3;i++){
      // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
  }
//END SENSOR 1 READING

//DECLARE IF SENSOR 2 (GREEN) IS ACTIVE
  isGreen = digitalRead(greenObst);
  if (isGreen == LOW)
  {
    //Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");
    for(int i=3;i<6;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
    }
    else
  {
    //Serial.println("clear");
    for(int i=3;i<6;i++){
      // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
  }
//END SENSOR 2 READING

//DECLARE IF SENSOR 3 (PURPLE) IS ACTIVE
  isPurple = digitalRead(purpleObst);
  if (isPurple == LOW)
  {
    //Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");
    for(int i=6;i<9;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
    }
    else
  {
    //Serial.println("clear");
    for(int i=6;i<9;i++){
      // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
  }
//END SENSOR 3 READING

 //DECLARE IF SENSOR 4 (BROWN) IS ACTIVE
  isBrown = digitalRead(brownObst);
  if (isBrown == LOW)
  {
    //Serial.println("OBSTACLE!!, OBSTACLE!! on Sensor 1 (yellow)");
    for(int i=9;i<=12;i++){

    // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(25,0,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
    }
    else
  {
    //Serial.println("clear");
    for(int i=9;i<=12;i++){
      // pixels.Color takes RGB values, from 0,0,0 up to 255,255,255
    pixels.setPixelColor(i, pixels.Color(0,25,0)); // Moderately bright green color.

    pixels.show(); // This sends the updated pixel color to the hardware.

    delay(delayval); // Delay for a period of time (in milliseconds).
  }
  }
//END SENSOR 4 READING

}

----------------------------------------------------------------------------------------------

Figure 2. Test for LED strip.



Week Thirteen Experience Documentation

Reflection

  • Class was optional on Monday, and class was cancelled on Wednesday for Thanksgiving.
  • Nothing really happened this week other than the proximity sensors I ordered being delivered. 

Week Twelve Experience Documentation

Reflection

Week Eleven Experience Documentation

Reflection
  • On Wednesday, our class had a critique where we looked at everyone's sensor prototype. The sensor merely needed to read a value, and we had to have some kind of system that illustrated an output dependent on the readings from the sensor.
  • My overall sensor, program, and system worked fine, but Thomas and I discussed that my sensor may not work very well for my project. More information on the prototype can be found in another post.
    • While I was programming it to work as a proximity sensor, he was saying that there was no definite link between ambient and relative temperature, and therefore may pose a problem in measure distance if the ambient temperature was extremely hot or cold and influenced the readings of the sensor. 
  • My partner and I created our bullet-list of information from chapters 7 and 8 of Natural Born Cyborgs.