Generating Data – Lab 5

In this lab session, we discussed our plans for the midterm project. I personally plan on using the data collected from Swiftkey, a virtual keyboard, to be used as a part of my midterm. The data shows me which key I use the most whenever I’m on my mobile. However, as shown here, the data is visualised in terms of opacity. I plan on using photoshop’s dropper tool to see where in the RGB spectrum does the colour falls. If the eye dropper shows a colour that falls on the lower part of the RGB spectrum, it means the colour is darker and it means I’ve used the key rather frequently and vice versa.

typing_heatmap

I’m also considering using another data from Swiftkey, that is the kind of emoji I used very often. I plan on comparing the scale of the visualisation above to get the quantitative data of the Top Emojis.

screenshot_2016-09-30-19-36-18-507_com-touchtype-swiftkey

I look forward to using Adobe Photoshop to work on analysing and visualising the data above.

Video Games, Week 4: Proteus Review

The discussion about video games as art takes an interesting turn after playing the game Proteus. The game Proteus is artistic in many aspects, as it offers the player an interesting musical and visual experience as one plays it. However, the game really isn’t much more than that,  causing some critics to refuse to call Proteus a game at all.

The beginning of the game is interesting. The player’s eye opens, revealing an endless sea and a vague vision of an island in the distance. And so, the player heads towards the Island. Upon arrival the player is immersed in a world were every tree, stone, and flower they interact with make noise. The player explores the island, and in doing so hears the combined noises emanated from all the island’s biotic and abiotic elements. As the day turns to night, the music changes, and stars emerge, dancing and growing as the night goes on. Them, the night turns to day again, and the player can start all over. When the player is done playing the eye closes, and the game ends.

While Proteus is ultimately an interesting experience, I understand the criticism against calling it a game. There are no mechanics to play by, no courses of action that the player can pursue. The game itself is merely a small “open world” game, where the player just moves around aimlessly. The most game-like aspect to Proteus was when I chased rabbits or birds around the Island. That isn’t to say that Proteus doesn’t have merits as it is a fascinating experience. Ultimately, I can accept Proteus as an artistic endeavor in video game form.

Lab 4/Distance sensor and Led/ Wenyi(Jenny) Liu/Daniel

Name:Wenyi(Jenny) Liu

Instructor:Dan

Date:30th Sept

Project: using the data from the distance sensor to control the led

Materials: Led, Wires, Resistor, Breadboard, Arduino

Fist I borrowed the sensor and connected to my Arduino with the guidence online and then copied its sample code making the Arduino read its number. Then I pluged it in and found it working.

Then I moved on to the actuator part in which the distence controls the led whether is on or not.

I added a if conditionals into the loop. Since recently I’ve been learning stuff about Processing, it really took me some time to realise that its format is quite is slightly different and I had to declare its pin and digital or analog read and write. Then I made the cuicurt on the board. I first shortcircuited the led and corrected it right after Richard pointing it out and then it worked but not as I expected. I mean my code was to let the led on when I was near enough. However it went the opposite way.

void setup () {

Serial.begin (9600);

pinMode (A0, INPUT);

}

void loop () {

uint16_t value = analogRead (A0);

// uint16_t range = get_gp2d12 (value);

Serial.println (value);

//Serial.print (range);

Serial.println (” mm”);

Serial.println ();

delay (30);

int led = 9;//led is attached to 9

pinMode (led, OUTPUT);

if (value<=40) {

digitalWrite(led, HIGH);

} else {digitalWrite (led, LOW);

}}

uint16_t get_gp2d12 (uint16_t value) {

if (value < 10) value = 10;

return ((67870.0 / (value – 3.0)) – 40.0);

}

To solve this problem in the easiest way which was also the IMA way as Richard said, I just change value<=40 into>=40, and it went perfectly fine. Yeah, I got what I wanted.

Lab4-Ultrasonic sensor test

img_0072image

This time, I pick the ultrasonic sensor to play with.

The problem we met here was the wiki page was down and the code found online was not valid.

But the solution was quite easy also: we just used the ‘ping’ example in Arduino software. So this time I learnt that it is basic and effective to apply the original examples.

 

unsigned long echo = 0;
int ultraSoundSignal = 9; // Ultrasound signal pin
unsigned long ultrasoundValue = 0;

void setup()
{
  Serial.begin(9600);
  pinMode(ultraSoundSignal,OUTPUT);
}

unsigned long ping()
{ 
  pinMode(ultraSoundSignal, OUTPUT); // Switch signalpin to output
  digitalWrite(ultraSoundSignal, LOW); // Send low pulse 
  delayMicroseconds(2); // Wait for 2 microseconds
  digitalWrite(ultraSoundSignal, HIGH); // Send high pulse
  delayMicroseconds(5); // Wait for 5 microseconds
  digitalWrite(ultraSoundSignal, LOW); // Holdoff
  pinMode(ultraSoundSignal, INPUT); // Switch signalpin to input
  digitalWrite(ultraSoundSignal, HIGH); // Turn on pullup resistor
  // please note that pulseIn has a 1sec timeout, which may
  // not be desirable. Depending on your sensor specs, you
  // can likely bound the time like this -- marcmerlin
  // echo = pulseIn(ultraSoundSignal, HIGH, 38000)
  echo = pulseIn(ultraSoundSignal, HIGH); //Listen for echo
  ultrasoundValue = (echo / 58.138) * .39; //convert to CM then to inches
  return ultrasoundValue;
}

void loop()
{
  int x = 0;
  x = ping();
  Serial.println(x);
  delay(250); //delay 1/4 seconds.
}

Lab Arduino Control–Louise Cai & ZZ

Today we used Arduino to test the moisture level of soil.

We also used the relay circuit to turn on and off the LED with a certain frequency.

Then we used the relay circuit to build a time controller of an extension cord, which we took off a certain part of the wrap from and then cut one of the wires, and added relay two bridge two ends. We then tested with a 220v red+blue light bulb. It worked out well.

Here’s the code:

Week 4 Lab 4 Ultrasonic sensor

Today, I chose ultrasonic sensor and my intention was to make it buzz when some obstacles existed in front of the ultrasonic sensor. After I copied the code from the example, the serial monitor does not work as expected. I find out that the output pin was connected to the wrong number of the output. What`s more, I also connected another wire on the NC part. After I detected those errors, the serial monitor shows the exact distance between ultrasonic sensor.

Later, I connected the buzzer on the breadboard and it does not buzz as expected. I then switched to LED light and connected with a resistor. The LED light up when anything is too close to the ultrasonic sensor.

wechatimg2 wechatimg3

I still need to figure out how to use the buzzer successfully.

Soil Testing #2 – Jimmy

Last weekend, my friends and I visited the Shengsi Islands off the coast of Shanghai and I decided to gather my soil sample from near the beaches (not sand). The soil was very rocky and looked like it did not have any nutrients. When I came back and tested the soil, the results were the following:

ph – 7.5

Phosphorus – depleted

nitrogen – depleted

Potash – adequate

The test results confirmed my initial guesses. The soil lacked nutrients for proper plant growth. I was surprised because the islands were remote and far from human urban development; frankly, I expected the soil to be more fertile because of the rural aspect of the whole region. 56

 

[Ix Lab AW] Lab 4 Linda Yao

  • Lab Date: 9/30/2016
  • Documentation Date: 9/30/16
  • Documented by: Linda Yao
  • Instructor: Antonius Wiriadjaja
  • Partner: Harrison Chen

Ultrasonic Range Finder

The range finder basically tracks the distance using using ultrasonic pulses. We begun the lab by learning more about our tool finding a image and code that would allow us to use the finder. Since the website that was given wasn’t working then we found our own site.

How to Set Up an Ultrasonic Range Finder on an Arduino

Then we used the picture given and connected our ardunio to the tracker.

The process was fairly simple but the image’s label was different from our tracker so we had to test the positions.

image

Video of process: img_3802

We later used ardunio’s set code which I have attached below.

Video of result: img_3805

From the video, we can see that when we move an object from the tracker our distance also changes. This was really interesting because I could see how I can use it for my project. For example, the tracker can show when someone is in front of an object and can act like a on switch without actually touching anything.

/* Ping))) Sensor

   This sketch reads a PING))) ultrasonic rangefinder and returns the
   distance to the closest object in range. To do this, it sends a pulse
   to the sensor to initiate a reading, then listens for a pulse
   to return.  The length of the returning pulse is proportional to
   the distance of the object from the sensor.

   The circuit:
	* +V connection of the PING))) attached to +5V
	* GND connection of the PING))) attached to ground
	* SIG connection of the PING))) attached to digital pin 7

   http://www.arduino.cc/en/Tutorial/Ping

   created 3 Nov 2008
   by David A. Mellis
   modified 30 Aug 2011
   by Tom Igoe

   This example code is in the public domain.

 */

// this constant won't change.  It's the pin number
// of the sensor's output:
const int pingPin = 7;

void setup() {
  // initialize serial communication:
  Serial.begin(9600);
}

void loop() {
  // establish variables for duration of the ping,
  // and the distance result in inches and centimeters:
  long duration, inches, cm;

  // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
  // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
  pinMode(pingPin, OUTPUT);
  digitalWrite(pingPin, LOW);
  delayMicroseconds(2);
  digitalWrite(pingPin, HIGH);
  delayMicroseconds(5);
  digitalWrite(pingPin, LOW);

  // The same pin is used to read the signal from the PING))): a HIGH
  // pulse whose duration is the time (in microseconds) from the sending
  // of the ping to the reception of its echo off of an object.
  pinMode(pingPin, INPUT);
  duration = pulseIn(pingPin, HIGH);

  // convert the time into a distance
  inches = microsecondsToInches(duration);
  cm = microsecondsToCentimeters(duration);

  Serial.print(inches);
  Serial.print("in, ");
  Serial.print(cm);
  Serial.print("cm");
  Serial.println();

  delay(100);
}

long microsecondsToInches(long microseconds) {
  // According to Parallax's datasheet for the PING))), there are
  // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per
  // second).  This gives the distance travelled by the ping, outbound
  // and return, so we divide by 2 to get the distance of the obstacle.
  // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf
  return microseconds / 74 / 2;
}

long microsecondsToCentimeters(long microseconds) {
  // The speed of sound is 340 m/s or 29 microseconds per centimeter.
  // The ping travels out and back, so to find the distance of the
  // object we take half of the distance travelled.
  return microseconds / 29 / 2;
}