Lab 3 – 3 Potentiometers to Control 3 LEDs

Description

I used an Arduino-Uno as a microprocessor to control the brightness of three LED lights, realized through three different rates, which are translated from data fed in from three different potentiometers.

Components

  • 1 Arduino Uno
  • 1 Breadboard
  • 3 LEDs (red, green, and blue)
  • 3 Resistor (220Ω)
  • 3 Potentiometers
  • 1 USB Cable
  • 21 Jumper Wires
  • 1 Laptop

Code

int sensorPin1 = A0; // select the input pin for the potentiometer
int sensorPin2 = A1; // select the input pin for the potentiometer
int sensorPin3 = A2; // select the input pin for the potentiometer
int ledPin1 = 9; // select the pin for the LED
int ledPin2 = 10; // select the pin for the LED
int ledPin3 = 11; // select the pin for the LED

int sensorValue1 = 0; // variable to store the value coming from the sensor
int sensorValue2 = 0; // variable to store the value coming from the sensor
int sensorValue3 = 0; // variable to store the value coming from the sensor

void setup() {
 // declare the ledPin as an OUTPUT:
 pinMode(ledPin1, OUTPUT);
 pinMode(ledPin2, OUTPUT);
 pinMode(ledPin3, OUTPUT);
 Serial.begin(5600);

}

void loop() {
 // read the value from the sensor:
 sensorValue1 = analogRead(sensorPin1);
 sensorValue2 = analogRead(sensorPin2);
 sensorValue3 = analogRead(sensorPin3);

 // turn the ledPin on
 analogWrite(ledPin1, sensorValue1/5);
 analogWrite(ledPin2, sensorValue2/5);
 analogWrite(ledPin3, sensorValue3/5);
}

Photo

IMG_0677

LED Light Mixer with Origami Lamp Diffuser

Introduction

For this project, I got very interested in creating a paper origami lamp as the diffuser, and got interested in how to create a mixed color of purple, orange, yellow out of the R, G, B LED lights we have in our kit.

I compared a series of paper origami lamps online and tried one which turned out to be too long in scale for our mini LED lights. So the one I used in this project is my second attempt, which matches the scale of the LED lights, yay! :p

For the color mixing part, I used Adobe Illustrator to figure out the basic RGB values for color mixing patterns for purple, orange and yellow, and it turned out to be quite interesting. So for purple, in my code, I use equal brightness of red light and blue light and turn the brightness of green light to 0; for yellow, it’s similarly mixed via equal brightness of red and green; while for orange, it requires the green light to have half or even lower brightness when compared to the red light.

Components

  • 1x Arduino Uno
  • 1x Breadboard
  • 3x Jumper Wires
  • 3x LEDs (R/G/B)
  • 3x 220Ω Resistors
  • 1x USB Cable
  • 1x Macbook Pro
  • 1x Paper
  • 1x Double-Sided Tape

Code
/* Safei modified version
* Serial RGB LED
* —————
* Serial commands control the brightness of R,G,B LEDs
*
* Command structure is “<colorCode><colorVal>”, where “colorCode” is
* one of “r”,”g”,or “b” and “colorVal” is a number 0 to 255.
* E.g. “r0” turns the red LED off.
* “g127” turns the green LED to half brightness
* “b64” turns the blue LED to 1/4 brightness
*
* Created 18 October 2006
* copyleft 2006 Tod E. Kurt <tod@todbot.com
* http://todbot.com/
*/

char serInString[100]; // array that will hold the different bytes of the string. 100=100characters;
// ->you must state how long the array will be else it won’t work properly
char colorCode;
int colorVal;
int colorVal2;

int redPin = 9; // Red LED, connected to digital pin 9
int greenPin = 10; // Green LED, connected to digital pin 10
int bluePin = 11; // Blue LED, connected to digital pin 11

void setup() {
pinMode(redPin, OUTPUT); // sets the pins as output
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);
Serial.begin(9600);
analogWrite(redPin, 0); // set them all to mid brightness
analogWrite(greenPin, 0); // set them all to mid brightness
analogWrite(bluePin, 0); // set them all to mid brightness
Serial.println(“enter color command (e.g. you can press up to 10 times of the initial letter of 6 different colors – r, g, b, o (for orange), p (for purple), y (for yellow), the brightness of the color will increase 20% by one letter input) :”);
}

void loop () {
// clear the string
memset(serInString, 0, 100);
//read the serial port and create a string out of what you read
readSerialString(serInString);

colorCode = serInString[0];
if( colorCode == ‘r’ || colorCode == ‘g’ || colorCode == ‘b’ || colorCode == ‘o’ || colorCode == ‘p’ || colorCode == ‘y’ ) {
//colorVal = atoi(serInString+1);
colorVal = 0;
for (int i=0; i<strlen(serInString); i++) {
if( colorCode == ‘r’ || colorCode == ‘g’ || colorCode == ‘b’ || colorCode == ‘o’ || colorCode == ‘p’ || colorCode == ‘y’ )
{
colorVal += 1;
}
}
if (strlen(serInString) > 10){
colorVal = 0;
}

//colorVal = strlen(serInString);
colorVal = colorVal*25.5;
colorVal2 = colorVal/2;
Serial.print(“setting color “);
Serial.print(colorCode);
Serial.print(” to “);
Serial.print(colorVal);
Serial.println();
serInString[0] = 0; // indicates we’ve used this string
if(colorCode == ‘r’) {
analogWrite(redPin, colorVal);
analogWrite(greenPin, 0);
analogWrite(bluePin, 0);}
else if(colorCode == ‘g’) {
analogWrite(greenPin, colorVal);
analogWrite(bluePin, 0);
analogWrite(redPin, 0);}
else if(colorCode == ‘b’) {
analogWrite(bluePin, colorVal);
analogWrite(greenPin, 0);
analogWrite(redPin, 0);}
else if(colorCode == ‘o’) {
analogWrite(redPin, colorVal);
analogWrite(greenPin, colorVal2);
analogWrite(bluePin, 0);}
else if(colorCode == ‘y’) {
analogWrite(redPin, colorVal);
analogWrite(greenPin, colorVal);
analogWrite(bluePin, 0);}
else if(colorCode == ‘p’) {
analogWrite(redPin, colorVal);
analogWrite(bluePin, colorVal);
analogWrite(greenPin, 0);}
}

delay(100); // wait a bit, for serial data
}

//read a string from the serial and store it in an array
//you must supply the array variable
void readSerialString (char *strArray) {
int i = 0;
if(!Serial.available()) {
return;
}
while (Serial.available()) {
strArray[i] = Serial.read();
i++;
}
}

Photos + Video

https://youtu.be/8syuyGd4WX8

IMG_0553 IMG_0561 IMG_0555

Siri, Voice UI, Mind UI and to Be Continued…

McCullough argued that “the computer is inherently a tool for the mind and not for the hands.” And 20 years after, we can add on to his argument by saying that natural interface can be as close to our mind as our hands do.

Thinking about Siri as an example. We don’t necessarily need to use our hands in the middle of our interaction with Siri, because it is based on another part of our body, which is voice, not hand-based interaction. It’s created beyond the gesture-based conceptual constraints of touch screen, by strengthening a long-existing interaction paradigm – voice input based on natural language. We don’t need to translate our mind signals to hand to interact with Siri’s UI, but we can simply think out loud, and read or listen to what Siri outputs, and interact with Siri similarly again.

Besides Siri, an even more extreme example which also aligns with the illustration of Siri is mind UI, where your neural signals can be literally translated as electronic signals to give an interaction system inputs.

Now imaging 10 years after, what if Siri could talk to you as naturally as your classmates could in TUI? Then probably we can push McCullough’s argument even further, by arguing that the computer is inherently a mimic system of human mind, built in the way that could logically think and communicate with its users, which are us, human beings. At the end, there is no boundary in terms of the great potentials of technology, we simply need to take the belief.

imgres

Arduino – 2 LED Lights Blinking in Turns

Description:

I used Arduino with a blue LED first, and customized its blinking rate. Based on that, I added another circuit loop for a green LED light. And for the coding part, I changed the code further to make the two LED lights blink in turns at a customized rate. A full loop will be like that LED A blinks once for 1 second, LED B blinks twice for 0.5 second each, and then LED B blinks once for 1 second, LED A blinks twice for 0.5 second each.

Components:

  • 2 LED
  • 2 Resistors (220Ω)
  • 6 Jumper wires
  • 1 Macbook Pro
  • 1 Arduino
  • 1 Breadboard
  • 1 USB cable

Code:

void setup() {
// initialize digital pin 13 as an output.
pinMode(13, OUTPUT);
pinMode(12, OUTPUT);
}

// the loop function runs over and over again forever
void loop() {
digitalWrite(13, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(12, HIGH); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
digitalWrite(12, HIGH); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second

digitalWrite(12, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(12, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
digitalWrite(13, HIGH); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
digitalWrite(13, HIGH); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
digitalWrite(13, LOW); // turn the LED off by making the voltage LOW
delay(500); // wait for 0.5 second
}

Comment:

I love it! It’s fun to experiment with Arduino :p

Photos:

IMG_0540 IMG_0541 IMG_0542 IMG_0543

 

 

Uber UI

I love to use Uber app not only because it makes calling a car to travel so easy, but also because the UI is very useful and effective from the perspective of the Activity Theory.

When I use Uber to call a nearby car, I notice it simplify the user’s goal by one goal at a time. For example, when I’m moving the pin to my current location in the map view, the App will hide the Uber type options, Car vs. Eat option, and the hamburger menu, and after I finalized the pin’s location, it will make the UI focusing on getting my destination address.

Such easiness and smoothness of using the App makes it more successful to help me achieve my goal, which is to travel to a destination from my current location. And from the perspective of the Activity Theory, because of this easiness, it has helped me internalize the interaction with the UI to a level close to unconsciousness after I got familiar with the whole user flow after several trips. Besides, the easiness of using Uber app to call a nearby car also aligns with the Object-Orientedness of the Activity Theory.

Moreover, such easiness and smoothness of using Uber app also represents a unity between consciousness and human activity, from the perspective of the Activity Theory. When it becomes so helpful and so easy to do it successfully, the Uber UI can also be analogized to an extension of our human body, which responds to our consciousness to perform certain task as we wish.

From another perspective, the design of the Uber app has also casted impact on the environment, as a way to reflect our spiritual relation to the cosmos, according to the Activity Theory. The most obvious feature of Uber that has this effect is Uber Pool, through which up-to-3 riders can share a car at the same time to save gas and be more environmentally friendly.