Recitation 2: Arduino Basics(Alex Wang)

In week 2 recitation we are tasked with building basic circuits just like week 1 recitation, but this time we included the use of Arduino code. Specifically an automated fading led, an music player, and a led racing game with the optional improvement for adding multiplayer.(Schematics below)

Process:

For this weeks recitation I haven’t ran into any problems, we built the circuits and ran the code, everything went smoothly. We are also extra careful during the process and made sure no connection was loose, unplug power source when editing circuit, etc. I was able to complete the optional circuit fairly quickly too, we left our LED racing circuit as it is, and added another groups circuit to our initial circuit. instead of the pins assigned from the original code, I attached the buttons to `5 and `6 and the LEDs to 12 and 13 on the Arduino, and then modified the code to match the pin slots as well as adding win conditions and variables for the newly added player3 and player4(Hand Drawn diagram and video of working circuit below).

9

10

Modified code:

//led race game modified for 4 players
int buzzerPin = 8;
int button1 = 11;
int button2 = 10;
int button3 = 5;
int button4 = 6;
int led1 = 3;
int led2 = 2;
int led3 = 13;
int led4 = 12;

int goal = 10;
int buttonState1 = LOW;
int previousState1 = LOW;
int buttonState2 = LOW;
int previousState2 = LOW;
int buttonState3 = LOW;
int previousState3 = LOW;
int buttonState4 = LOW;
int previousState4 = LOW;

int counter1 = 0;
int counter2 = 0;
int counter3 = 0;
int counter4 = 0;
boolean winner1 = false;
boolean winner2 = false;
boolean winner3 = false;
boolean winner4 = false;

// the follow variables are long's because the time, measured in miliseconds,
// will quickly become a bigger number than can be stored in an int.
long time = 0; // the last time the output pin was toggled
long debounce = 200; // the debounce time, increase if the output flickers

void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(buzzerPin, OUTPUT);
pinMode(button1, INPUT);
pinMode(button2, INPUT);
pinMode(button3, INPUT);
pinMode(button4, INPUT);
pinMode(led1, OUTPUT);
pinMode(led2, OUTPUT);
pinMode(led3, OUTPUT);
pinMode(led4, OUTPUT);
Serial.println("******************* RACE THE LED *******************");
delay(1000);
Serial.println("READY");
delay(1000);
Serial.println("SET");
delay(1500);
Serial.println("GO!!!!!!!!!!!!!!!!");

}

void loop() {
// put your main code here, to run repeatedly:
buttonState1 = digitalRead(button1);
buttonState2 = digitalRead(button2);
buttonState3 = digitalRead(button3);
buttonState4 = digitalRead(button4);
//Serial.println(buttonState1);

//this checks the times player 01 has pressed the button
if (counter1 < goal && winner2 == false && winner3 == false && winner4 == false) {
if (buttonState1 != previousState1 && millis() - time > debounce) {
if (buttonState1 == HIGH) {
counter1++;
Serial.print("player 01: ");
Serial.println(counter1);
time = millis();
}
}
previousState1 = buttonState1;
if (counter1 == goal && winner2 == false && winner3 == false && winner4 == false) {
winner1 = true;
digitalWrite(led1, HIGH);
Serial.println("PLAYER 01 WINS");
playMelody();
}
}

//this checks the times player 02 has pressed the button

if (counter2 < goal && winner1 == false && winner3 == false && winner4 == false) {
if (buttonState2 != previousState2 && millis() - time > debounce) {
if (buttonState2 == HIGH) {
counter2++;
Serial.print("player 02: ");
Serial.println(counter2);
time = millis();
}
}
previousState2 = buttonState2;
if (counter2 == goal && winner2 == false && winner1 == false && winner3 == false && winner4 == false) {
winner2 = true;
digitalWrite(led2, HIGH);
Serial.println("PLAYER 02 WINS");
playMelody();
}
}

//for player 3
if (counter3 < goal && winner1 == false && winner3 == false && winner4 == false) {
if (buttonState3 != previousState3 && millis() - time > debounce) {
if (buttonState3 == HIGH) {
counter3++;
Serial.print("player 03: ");
Serial.println(counter3);
time = millis();
}
}
previousState3 = buttonState3;
if (counter3 == goal && winner3 == false && winner1 == false && winner2 == false && winner4 == false) {
winner3 = true;
digitalWrite(led3, HIGH);
Serial.println("PLAYER 03 WINS");
playMelody();
}
}
//for player 4
if (counter4 < goal && winner1 == false && winner3 == false && winner4 == false) {
if (buttonState4 != previousState4 && millis() - time > debounce) {
if (buttonState4 == HIGH) {
counter4++;
Serial.print("player 04: ");
Serial.println(counter4);
time = millis();
}
}
previousState4 = buttonState4;
if (counter4 == goal && winner4 == false && winner1 == false && winner3 == false && winner2 == false) {
winner4 = true;
digitalWrite(led4, HIGH);
Serial.println("PLAYER 04 WINS");
playMelody();
}
}

}

void playFreq(double freqHz, int durationMs) {
//Calculate the period in microseconds
int periodMicro = int((1 / freqHz) * 1000000);
int halfPeriod = periodMicro / 2;

//store start time
int startTime = millis();

//(millis() - startTime) is elapsed play time
while ((millis() - startTime) < durationMs) {
digitalWrite(buzzerPin, HIGH);
delayMicroseconds(halfPeriod);
digitalWrite(buzzerPin, LOW);
delayMicroseconds(halfPeriod);
}
}

void playMelody() {

playFreq(262, 100);
playFreq(294, 100);
playFreq(349, 100);
playFreq(294, 100);
playFreq(440, 200);
delay(100);
playFreq(440, 400);
playFreq(392, 400);
delay(300);
playFreq(262, 100);
playFreq(294, 100);
playFreq(349, 100);
playFreq(294, 100);
playFreq(392, 200);
delay(100);
playFreq(392, 400);
playFreq(349, 400);

}

Reflection:

I really liked this weeks recitation. Since I have previous experiences in coding, I was able to complete the tasks very smoothly. Learning form last weeks mistakes, I am now always extra careful during the construction to make sure that the connections are all secured, cause as the circuits that I am making gets more and more complex, it gets harder to keep track of every single thing, and as long as one part of the connection is not done properly, the whole thing stops working. I feel like building a circuit is very similar to coding, one part goes wrong and you have to spend a long time trying to find where the error is.

Documentation Questions:

Q1:Reflect how you use technology in your daily life and on the circuits you just built. Use the text Physical Computing and your own observations to define interaction.

I believe that technology plays a great role in my daily life, either for communication or transportation or even for entertainment. I guess for this weeks LED racing game, it would be for the entertainment for users. Just like how I would play video games on my computer. As for defining interaction, I agree with Chris Crawford on how the computers have similar phases of interaction just like humans: listening, thinking, and speaking. But unlike humans, computers use sensors to listen, CPU to think, and some kind of output to “speak” back to us.

Q2:If you have 100,000 LEDs of any brightness and color at your disposal, what would you make and where would you put it?

If I have 100,000 LEDs, I will probably create a huge art project with it. to build a huge screen of lights and display images through these LEDs.

Karen Zhang – Documentation – Recitation 1: Electronics & Soldering

For last week’s recitation, students were expected to build three different circuits and learn how to solder. Here is a list of components we used in the circuits.

Components :

Breadboard: it provides a base for making electronic connections

LM7805 Voltage Regulator: it is designed to automatically maintain a constant voltage level

Buzzer: when it is connected, it can make a buzzing noise

Button: it is used to interrupt or connect the flow of current through a circuit

220 ohm Resistor: it can add resistance to the circuit to decrease the voltage
LED: it lights when it is connected!

100 nF (0.1uF) Capacitor: used to stabilize and smooth the flow of electricity

Barrel Jack: it connects the power supply with the breadboard.

10K ohm Variable Resistor (Potentiometer): its resistance can change


Multimeter: it can measure electric current, voltage, and resistance. And we use it to measure the resistance.

Several Jumper Cables (Hook-up Wires): it is used to connect different electrical components.

Circuit 1

I think it takes me a long time to figure out how to build the first circuit. The first part we get confused is how to use the breadboard. After being taught by instructors, this problem was soon solved, and my partner and I started to build the circuit.
For Circuit 1, we connected all the necessary components, but the bell did not ring. We guessed that there was something wrong with the capacitor since that is the last part we put on the breadboard. By examing the circuit again, we found out that we did not need so many wires to connect, just directly connect the capacitor on the left side of the breadboard, the problem is solved! Also, the lesson I learned from this failure is that do not use so many wires! It could make your work more complicated and much harder to find out what was wrong.

 

Circuit 2

 Making the second circuit is much smoother than the first one. However, when I pressed the button, the lamp did not light. We could not find the reason why. After checking the circuit again and again, we believed that we perfectly connected each component. Then, another instructor pointed out our problem, why don’t you guys check the LED again? And we just realized we connected the LED is an opposite direction. The longer leg should be connected to the resister, and the shorter leg should be connected to the switch. 

Circuit 3

Based on the previous lessons we had, the third circuit is finished one time. We used the variable resistor to adjust the brightness of the light. 

Then my partner and I went to soldering stations to learn how to solder. We need to connect two wires with the switch together. Tan the tip, then melt and put solder into the joint, the solar having a lower melting point than the adjoining metal. We waited for it to cool down, so the wires and switch could tightly connect. Overall, it is an easy task. However, it could be tricky at first to put the melting solar to the right position precisely at the joint.

On the left of this picture, it is the new switch we made by soldering the wires

Answers to Questions

Question 1:
After reading The Art of Interactive Design, the circuits we built all include interactivity. In my opinion, there are two actors in the interaction. The circuits are built to illustrate the interactivity between what we built and us. It acts like communication that we have. As I press the button or turn the variable resistor, the lamp and bell respond to me. The ringing of the bell and the lighting of the lamp both show the interactivity.

Question 2:
From Zack Lieberman’s video, I think that adding physical computing technologies to art can actually make drawing more interesting and interactive. Lieberman presents three examples in the video and shows us how interactive art is created by computing and design. I am particularly interested in the third example. He used the simple eye-tracking system and allowed disabled artists to draw graffiti using their eyes. And it all relied on the technology(physical computing), which makes it all happen.

Recitation 1: Electronic & Soldiering by Anna

Exercises

#1 Doorbell

doorbell

Capacitor: It stores up electricity while current is flowing into it and releases the energy when the incoming current is removed. It creates a bypass capacity to keep the circuit stable. 

Ground: The negative electrode. Connecting the circuit to ground prevents ekectric leakage. 

Power: It provides electrical power to run the circuit. 

Resistor: It resists but does not block the flow of current. It protects components by controlling the flow of current. 

Speaker: The component that makes sound. It acts as the “bell”. 

Switch: It controls the flow of current through a junction in a circuit. It controls whether the doorbell goes off by opening and closing. 

Voltage Regulator: It automatically maintains a constant voltage level. It stabilize the voltage used by processor component (the speaker). 

Photo of doorbell circuit

#2 Lamp

lamp

Capacitor: It stores up electricity while current is flowing into it and releases the energy when the incoming current is removed. It creates a bypass capacity to keep the circuit stable. 

Ground: The negative electrode. Connecting the circuit to ground prevents ekectric leakage. 

LED: A diode that emits light when current flows throughs it. It acts as the lamp. 

Power: It provides electrical power to run the circuit. 

Resistor: It resists but does not block the flow of current. It protects components by controlling the flow of current. 

Switch: It controls the flow of current through a junction in a circuit. It controls whether the LED lights up by opening and closing. 

Voltage Regulator: It automatically maintains a constant voltage level. It stabilize the voltage used by processor component (the lamp). 

Photo of lamp circuit

#3 Dimmable Lamp

dimmable light

Capacitor: It stores up electricity while current is flowing into it and releases the energy when the incoming current is removed. It creates a bypass capacity to keep the circuit stable. 

Ground: The negative electrode. Connecting the circuit to ground prevents ekectric leakage. 

LED: A diode that emits light when current flows throughs it. It acts as the lamp. 

Potentiometer: A variable resistor. It controls the dimming of the light by controlling the flow of current. 

Power: It provides electrical power to run the circuit. 

Resistor: It resists but does not block the flow of current. It protects components by controlling the flow of current. 

Switch: It controls the flow of current through a junction in a circuit. It controls whether the LED lights up by opening and closing. 

Voltage Regulator: It automatically maintains a constant voltage level. It stabilize the voltage used by processor component (the lamp). 

Reflection

Since it was my first try to build a circuit, the process of building did not go very smoothly. The first problem I encountered with was how to use the breadboard, namely understanding how are the plugs connected/disconnected. 

When reading the diagram, I was confused by the capacitor and the voltage regulator part: What are their functions? How are they connected in the circuit? 

Fortunately, I figured out these problems with the help of our faculty and managed to build the doorbell circuit. With this experience, it was easier to build the second one. But when I tested the lamp circuit, I found the LED did not light up. After examination, it turned out that I had connected the LED backwards. The circuit eventually ran after I cleared the mistakes. 

Questions

Question 1: After reading The Art of Interactive Design, in what way do you think that the circuits you built today include interactivity?

I think these circuits only include a low level of interactivity according to Crawford’s definition. Information delivered in both input and output in the process of running the circuit are simple: Is the switch on/off? Does the doorbell/lamp goes of? Though there is some reaction between me and the circuit, the information exchanged is not complex and entertaining enough to reach the height of interactivity. 

Question 2: How can Interaction Design and Physical Computing be used to create Interactive Art?

Computers can serve as an amplifier of human motions and a converter of art forms, just like the projects introduced in Lieberman’s video. For example, computers can simultaneously project the creating of a graffiti in light forms. Interaction design and computing can function as a new, unprecedently powerful art form, because the unparalleled capacity in processing information of computers. More over, the translation and ampfication of human acts through designing and computing itself can arouse a particular interest in the audience. 

Interaction Lab — Recitation 1

Tasks:

  1. Build three circuits, which are Door Bell, Lamp, and Dimmable Lamp
  2. Solder long wires to an arcade button and replace the push button switch with the soldered arcade button.

Circuit 1: Door Bell

Components:

  • 1*Breadboard
    • A base for holding and connecting the components
  • 1*LM7805 Voltage regulator
    • To maintain a constant voltage level. In this circuit, it is used for converting 12V into 5V.
  • 1*100 nF Capacitor
    • To store electrical energy in an electric field.
  • 1*Switch
    • Control the flow of circuit. When pressed, it connects the circuit; when released, it disconnects the circuit.
  • 1*12volt power supply
    • Power source which provide 12V power for this circuit.
  • Jumper cables
    • To connect the components in the circuit.
  • 1*Barrel jack
    • An electrical connector for supplying direct current (DC) power.
  • 1*Buzzer
    • Creates sound when the circuit is connected

Diagram:

Video:

Process:

Since this recitation was our very first class for interaction lab, my partner and I both had a very limited knowledge about building a circuit. At first, we thought the circuit would work as long as we follow the diagram, so we just kept arranging the components in different formats that ‘looked like’ the one in the diagram. However, the buzzer didn’t make any sound, so we decided to ask one of the assistants, Jingyi for help. Before we asked for help, we lacked lot of knowledge about how the breadboard work, which now I think was a very crucial problem, since all of the components need to be connected on the breadboard. Later on, Jingyi taught us how the holes on the breadboard are connected and which parts are supposed to be the ground and the power supply. Furthermore, she also told us that the legs of the switch are self-connected diagonally, so we need to be careful that we shouldn’t connect two legs from the same side. Eventually, we rebuilt the circuit, which worked successfully in the end.

Circuit 2: Lamp

Components:

  • 1*220ohm Resistor
    • To create resistance in the flow of electric current
  • 1*LED
    • Emits light when the circuit is connected
  • 1*Multimeter (missed)
    • Used to measure resistance.
  • 1*Breadboard
    • A base for holding and connecting the components
  • 1*LM7805 Voltage regulator
    • To maintain a constant voltage level. In this circuit, it is used for converting 12V into 5V.
  • 1*100 nF Capacitor
    • To store electrical energy in an electric field.
  • 1*Switch
    • Control the flow of circuit. When pressed, it connects the circuit; when released, it disconnects the circuit.
  • 1*12volt power supply
    • Power source which provide 12V power for this circuit.
  • Jumper cables
    • To connect the components in the circuit.
  • 1*Barrel jack
    • An electrical connector for supplying direct current (DC) power.

Diagram:

Video:

Process:

After we built the first circuit, my partner and I had better understandings on the functions of the components. Since the assigned circuits were pretty similar to each other, we only changed the part that need to be changed. Therefore, we replaced the speaker with the LED and resistor, and keep the remained the other components in the same position. During building this circuit, we didn’t encounter any difficulty, and it worked successfully in our first attempt. However, there is one thing need to be mentioned. Because we were only focusing on the diagram, we forgot to connect the multimeter, which is not shown in the diagram. Thus, next time I will make sure that we didn’t miss any step before we move on to the next task.

Circuit 3: Dimmable Lamp

Components:

  • 1*10K ohm Variable Resistor (Potentiometer)
    • To create resistance in the flow of electric current and being used for changing the brightness of the LED in this circuit.
  • 1*Breadboard
    • A base for holding and connecting the components
  • 1*LM7805 Voltage regulator
    • To maintain a constant voltage level. In this circuit, it is used for converting 12V into 5V.
  • 1*100 nF Capacitor
    • To store electrical energy in an electric field.
  • 1*Switch
    • Control the flow of circuit. When pressed, it connects the circuit; when released, it disconnects the circuit.
  • 1*12volt power supply
    • Power source which provide 12V power for this circuit.
  • Jumper cables
    • To connect the components in the circuit.
  • 1*Barrel jack
    • An electrical connector for supplying direct current (DC) power.

Diagram:

Video:

Process:

Since everything went smoothly when we were completing the second circuit, we use the same method to build the third circuit. We disconnect the LED and the resistor, and connect the variable resistor in between them. However, the circuit didn’t work because the lightness of the lamp didn’t change while we rotated the variable resistor. We thoroughly checked the connections between the components. Later on, we then found out that we connected the resistor and the variable resistor incorrectly. According to the picture, the resistor should be connected to the middle branch of variable resistor, but we connected it with the right branch instead. We fixed the mistake and right after that, the brightness of the lamp are able to changed as we rotated the variable resistor.

After we finished with building the last circuit, we both forgot the second task, which is switching the push button switch with the soldered arcade button. Therefore, this mistake again remind me that, for the next lab, I should double check everything before moving to the next step.

Although we didn’t do the task, but to replace the push button, I think we can just take the switch off and connect the jumper cables with the arcade button by setting them in the same row.

Reflection

At the beginning of the recitation, my partner and I had a hard time on trying to figure out how to connect the components. But after the assistant provided clear explanations of the functions of the components, we were able to build the circuits in a short time. Therefore, it is really important to be familiar with the components before doing the task. Also, as I mentioned, my partner and I both forgot to do some parts of the lab, so next time I should read the instructions more thoroughly and have a better time management, so that we won’t be skipping any step again.

Questions

After reading The Art of Interactive Design, in what way do you think that the circuits you built today include interactivity? Please explain your answer.

The circuits which we built in the recitation do include interactivity. When we pressed the button, the LED light and buzzer gave feedbacks by making signals. However, in “The Art of Interactive Design”, the author states, the case like light lighting up in a fridge is an example of a low level of interactivity. Therefore, although the circuits we built do include interactivity, I think it only include a really small extent of interactivity. Comparing all of the circuit,s the last circuit is the one with the highest level of interactivity, since we can control the level of brightness by rotating the variable resistor.

How can Interaction Design and Physical Computing be used to create Interactive Art? You can reference Zack Lieberman’s video or any other artist that you know.

Both interaction design and physical computing can be used as tools to create interactive art. For example, The EyeWriter in Zach Lieberman: Interactive Art, enable Tony, a graffiti writer who is paralyzed, to draw digital images with movement of his eyes. The Eyewriter allows Tony to be able to interact with his environment. Therefore, I think it is a great example that reveals how physical computing can create tools that allow humans to interact with the environment.

Week 1: Recitation Documentation – Qianyue Fan (Eric)

Partner: Gloria (Yixuan Liu)

Date: 15th February

Circuit 1: Door Bell

Components:

Breadboard: Providing a platform to connect all the components

12 volt power supply: Providing electrical power for the components

Buzzer: Buzzing when the circuit is connected correctly and the switch is pressed

Push-Button Switch: Cutting or maintaining the current flow in the circuit

100 nF (0.1uF) Capacitor: Storing and releasing electrical energy and stabilizing the current flow

LM7805 Voltage Regulator: Maintaining a constant voltage level in the circuit

circuit 1
circuit 1 diagram
circuit 1 photo
circuit 1 photo

Process: 

Although it was the first time I used the breadboard, we managed to figure out how it worked using the knowledge mentioned in the lecture. However, we could not use the voltage regulator correctly and we consulted the instructor, who taught us how to identify its three feet. Also, we learned a simpler way to connect the capacitor in the circuit with fewer wires. Besides, we were not sure how the switch was connected inside itself, and the instructor showed us how to find this out using the multimeter.

After solving all these problems, the circuit worked.

Circuit 2: Lamp

Components:

Breadboard: Providing a platform to connect all the components

12 volt power supply: Providing electrical power for the components

LED: Emitting light when the circuit is connected correctly and the switch is pressed

220 Ω Resistor: Resisting and controlling the flow of electricity

Push-Button Switch: Cutting or maintaining the current flow in the circuit

100 nF (0.1uF) Capacitor: Storing and releasing electrical energy and stabilizing the current flow

LM7805 Voltage Regulator: Maintaining a constant voltage level in the circuit

circuit 2 diagram
circuit 2 diagram
circuit 2 photo
circuit 2 photo

Process:

Applying what we learned just now, we finished this one quickly without much trouble. The only problem was that we did not realize its similarity to the previous circuit and just connected every component for the very beginning.

Circuit 3: Dimmable Lamp

Components:

Breadboard: Providing a platform to connect all the components

12 volt power supply: Providing electrical power for the components

LED: Emitting light when the circuit is connected correctly and the switch is pressed

220 Ω Resistor: Resisting and controlling the flow of electricity

10 KΩ Variable Resistor: Changing the amount of resistance of electricity in the circuit

Push-Button Switch: Cutting or maintaining the current flow in the circuit

100 nF (0.1uF) Capacitor: Storing and releasing electrical energy and stabilizing the current flow

LM7805 Voltage Regulator: Maintaining a constant voltage level in the circuit

circuit 3 diagram
circuit 3 diagram
circuit 3 photo
circuit 3 photo

Process:

This time we thought it would be easier to make, for we only needed to add a variable resistor. However, just like the problem we encountered in the first circuit, we finally turned to an instructor for help to connect the three feet of the variable resistor into the circuit. This reminds us of the importance of learning about the details of components in advance. It took much longer time than we expected but we stayed after class and finally had a thorough understanding of this circuit.

Soldering: Switch the Switches

Process:

We had some difficulty using the equipment to hold the button and the wires in place and asked for help. Apart from this, everything went on smoothly. However, we were not sure what to do when going to soldering stations and were in a hurry finishing the circuits. Next time we will be more careful when reading the recitation instructions.

soldered button and wires
soldered button and wires

Question 1:

After reading The Art of Interactive Design, in what way do you think that the circuits you built today include interactivity? Please explain your answer.

According to Crawford, interaction is a cyclic process that involves two actors. From my point of view, in the recitation, the two actors are the circuit and the person who uses it. When the person presses the button, it is a kind of input and the circuit gives feedback by buzzing or emitting light. The outcome of interacting with the button then is received by the person who may take more action based on the feedback.

Question 2:

How can Interaction Design and Physical Computing be used to create Interactive Art? You can reference Zack Lieberman’s video or any other artist that you know.

What is interesting in Interactive Art is how it surprises common by using sensors and other components. When Interaction Design and Physical Computing are used in art, they should be inspiring and creative, making people aware of their potential in art when they do simple things like drawing and moving the body. These technologies can be used to discover how amazing the human body is, and our every move may bring about unexpected amazing outcome in Interactive Art.