Thursday, September 17, 2009

Introduction to Physical Computing - 2nd Class

During today's class covered the following content:
  1. Reviewed basic concepts and questions related to last week's lab.
  2. Learned how to set-up analog inputs and outputs on the Arduino.
  3. Held a discussion about our reading on interactivity.
Review of basic concepts and lab questions
All of the circuits that we will build in this class are Direct Current, DC, circuits. In these types of circuits electricity only flows in one direction (as opposed to Alternating Circuits, DC). There are a few important concepts related to the quantity and power of electricity that run through these circuits. These concepts are closely all linked.
  1. Current [I] refers to the amount of electricity that flows through a point in a circuit within a specific window of time. Current remains consistent throughout a circuit regardless of the resistance of the conductive materials of the circuit. Measured in Amps.
  2. Voltage [V] refers to the electrical force or pressure that flows through a circuit. Voltage, often called "potential", is always used up in-full when it flows through a circuit. Resistors and other components are used to convert or dissipate electricity (as heat, light, etc). Measured in Volts;
  3. Power [P] refers to the power provided by the combination of current and voltage. In a DC circuit power is measured in Watts and it is equal to the voltage multiplied by the current (P = V x I).
  4. Resistance [R] refers to friction that is created by any given conductive material. Resistance causes voltage to dissipate, which is why voltage is lower on the side of a resistor nearest to ground. Measured in Ohms.
Ohm’s Law defines the relationship between voltage, resistance and power. It states that voltage is equal to the current multiplied by the resistance (V = I x R). This made sense to me when I began to think about it in the following manner: the amount of voltage, or potential, dissipated by a resistor is determined by the current and the resistance. If a strong current meets high resistance it will dissipate more voltage.

Specifications - All electrical objects have voltage and current specifications. When these specs are not respected short circuits and explosions are possible outcomes. This was demonstrated in class by connecting a 2v LED directly to the 5v power source on the Arduino, which caused the LED light to burn out. Resistors play a key role in solving these types of circuit issues.

Resistors - We are once again back to resistors. Since our last class I have gained a much better understanding regarding the role of these crucial components. Resistors are used to manage the flow of electrical energy throughout a circuit. They are responsible for ensuring that electricity flows through a circuit properly, and that voltage is dissipated to protect components from burn-out.

A resistor can be placed anywhere in a circuit. Using the LED example that I brought up earlier, to keep the LED from burning out we could have added a resistor between the LED and either the power source or ground. The main concern is ensuring that all voltage can be appropriately used up. Therefore, as long as there are enough resistors in the circuit to dissipate the additional voltage it does not matter where they are located relation to the LED.

If two resistors with the same resistance are added to a circuit then the voltage dissipated (or consumed) by each can be calculated by dividing the total voltage between those two resistors equally. If they have different resistance then the distribution of the consumption is proportional to the resistance of each resistors (for example if you have one 1K resistor and one 10K resistor then the voltage in the first resistor will be 1/11 of the total voltage while the second would feature 10/11 of the total voltage.

Each resistor is identified by 4 color bands. The first three bands determine the Ohm value. The final band refers to the margin of error associated with the resistor. Here is a link to two downloadable tools for identifying the Ohm value of resistor based on the color bands: resistulator and seafoid. Of course, a multimeter can also be used to identify a resistor.

Multimeter Primer
A multimeter can be used to check voltage, current, resistance and continuity. To measure voltage and current the multimeter needs to be set to the appropriate mode and range, and then connected to two points on a live circuit. If you don't know what range to select then start with the setting at the high end of the spectrum and move down until you get a positive reading.

To measure resistance the process is similar to that described above. The only difference is that the resistor needs to be removed from the circuit to be measured separately. On the other hand, to measure continuity the multimeter can be connected directly to a circuit or to a standalone component. The continuity mode is demarcated by an icon that looks like a dot with audio waves.

Interesting switch ideas:
  • Using liquids or gels as part of a switch: Tom shared a past project where he used two copper screens that served as a switch activated by drops of water.
Analog Inputs and Outputs
Analog inputs - The ability to handle and process analog input and output signals is crucial to enable the creation of interactions that are richer and more complex than is possible with digital alone. There are many different types of analog inputs, including:
  • Potentiometer
  • Thermistor
  • Photo sensor/resistor
  • Stretch sensor/resistor
  • Force sensor/resistor
  • Flexibility sensor/resistor
Most analog inputs work by alternating resistance in response to physical stimuli (the potentiometer is the exception here). Standard analog input circuits are comprised of two resistors: a base resistor and and a dynamic resistor (the sensor). As the dynamic resistor changes it impacts the voltage distribution throughout the circuit. The Analog Digital Converter (ADC) on the Arduino converts the voltage reading into a number between 0 (0v) and 1024 (5v). These numbers can now be used for processing. It is important to select and pair appropriate resistors because this will impact the quality and accuracy of the readings by the ADC. More on this after I get some hands-on knowledge regarding this topic.

Potentiometers (aka Pot) - a potentiometer is a special type of analog sensor that is essentially an electricity divider. It is made of graphite, which is a resistor, and features three pins. The first is connected to the electricity source, the second to an analog input pin, and the last to ground. The way it works is that the middle pin can move back and forward between the two outer pins. As it does so it alternates the resistance between itself and those pins.

Potentiometers are referred to by their overall resistance value. For example, a 10K pot will at any point in time exert 10K of resistance between the two sides of the analog input pin. This means that if one side has a resistance of 3K resistance, then the other side must have a resistance of 7K.

Coding Analog Input and Output
When using analog inputs it is not necessary to define the pinMode because the analog input pins are not multifunction like the digital ones. It is only necessary to define the analog input pin number using the AnalogRead() function, which is able to return a value between 0 and 1023.

Only pins marked PWM are able to function as analog outputs. These pins can output an analog value between 0 and 254, when used with the function AnalogWrite(). This function requires two arguments: the output pin number and output value.

Since the analog input and output ranges differ, it is important that we find strategies to leverage these functions together. The simplest way is to just divide the input value by 4. However, a more powerful alternative is to use the Map() function. This method enables the mapping of a number from one range to another range. It requires the following 5 arguments: number to map, low value of "from" range, high value of "from" range, low value of "to" range, high value of "to" range. It returns the value mapped to the new range.

One thing to consider when using this function is that if the number to map exceeds the low or high range defined in the arguments then the returned value jumps to the top or bottom of the output range accordingly.

Discussion about Interactivity
Interactive Art - Our conversation regarding interactivity focused mostly on discussions regarding our experiences with, and understanding of, interactive art. We were all in agreement that a participant's active role in interactive art is its main distinguishing factor. The participant brings to bear new perspectives that are not present in non-interactive works, where the artist has more complete control.

Attributes of people's experiences with interactive art:
  • Pure creation
  • Moving physically
  • Visceral
  • Access and control
  • Ephemeral
  • Challenges assumptions
Error Handling - We also had a brief discussion regarding the importance of being able to handle errors in ways that are consistent with the user experience your system was designed to deliver. This is a similar consideration to a performer needing to learn how to deal with problems that arise during their performance.

Assignment for Next Week
Fantasy Machine/Project: Create an idea for a fantasy machine. Bring this idea to life using sketches, written scenarios or videos. The idea does not have to be physically or technologically possible to create or prototype. Think through how a person would interact, or experience, this device. A short presentation will be due next week.


devlo said...

Great notes Julio! Thanks for posting them online for the rest of us ITPers to share! ~cindy

tigoe said...

Yes, great notes. Good job!