Electronics Lab [ sep 28 2010 ]

This week’s lab we went over a few concepts that deal with resistance, voltage, and current of a circuit that is in series or in parallel.

If components in a circuit are …

in series

Total Resistance = the sum of the resistors from all parts of the circuit
R = r1 + r2 + r3
Current = constant through out the circuit
I = i1 = i2 = i3
Voltage = the sum of all voltage from all parts of the circuit
V = v1 + v2 + v3

In the image below we have two LEDs in series with a resistor. This means that the total resistance in this circuit is equal to the resistance from the resistor, LED1 and LED 2. Likewise the total voltage is also divided amongst its components, so it is equal to the voltage from the resistor and the two LEDs. The current remains the same with each component.

Image of circuit with components in series to explain voltage and resistance divide

in parallel

Total Resistance = constant throughout the circuit
R = 1/r1 =1/r2 = 1/r3
Current = the sum of the current from all parts of the circuit
I = i1 + i2 + i3
Voltage = constant throughout the circuit
V = v1 + v2 = v3

The components in the picture below are in parallel circuits. This means that the voltage remains the same with each component, while the total current is equal to the sum of the current from each component.

circuit in parallel with bubbles showing that the resistor and voltage

Posted: September 28th, 2010
Categories: Uncategorized
Comments: No Comments.

Analog Lab [ sep 21 2010 ]

For this week’s lab, we experimented with the analog outputs and the PWMs (Pulse Width Modulation) outputs on the Arduino board.PWM pins are digital pins, but because it causes the LED to blink on and off so quickly, you only see a gradual change of brightness.

In the setup above, if a person presses hard on the pressure variable resistor, the LED would dim its light, and returning to the original brightness once released. The code below programs both LEDs to react to its respective resistors.

int potPin1=0; // Assigns var potPin1 = 0
int potPin2=1; // Assigns var potPin2 = 1

int sensorValue1= 0; // sets up variable sensorValue1
int sensorValue2=0;// sets up variable sensorValue2
int led = 9; // var led is set to pin 9
int ledd = 10;// var ledd is set to pin 10

void setup(){
  Serial.begin(9600);// initialize serial communications at 9600 bps:
  pinMode(led,OUTPUT);//led from pin 9 is set as an output
  pinMode(ledd,OUTPUT);//ledd from pin 10 is set as an output

void loop(){
  sensorValue1=analogRead(potPin1); // Read analog value of analog pins 0 (potPin1 = 0)
  sensorValue2=analogRead(potPin2); // and pin 1 (potPin2=1)
  int brightness1= map(sensorValue1, 400,900,0,255);// var brightness pas the value of sensorValue1 and sensorValue 2
  int brightness2= map(sensorValue2, 400,900,0,255);// to digital range between 0 and 255

  analogWrite(led,brightness1);// set the led brightness1 with the result
  Serial.println(sensorValue1);// print the pot value back to the debugger pane
  delay(10);//wait 10 secs before starting loop again

  analogWrite(ledd,brightness2);// set  the ledd brightness 2 with the result in digital range
  Serial.println(sensorValue2);// print the pot value back to debugger pane
  delay(10); wait 10 secs before starting loop again

Initially the code was not working properly, and both LEDs were reacting to only one pressure variable resistor. I had mistakenly  set potPin1 and potPin2 both to 0 (zero), this resulted later in subsequent lines a analog read from the same analog pin 0. To fix this, I set the latter potPin 2 to 1. Thus one line of code performed an analogRead of potPin1 or analog input pin 0, and the other on potPin2 or analog input pin 1.

Posted: September 22nd, 2010
Categories: Arduino, Physical Computing
Comments: No Comments.

Hello Arduino! [ sep 14 2010 ]

Successfully completed my first Arduino lab.  When you press the button, the other green LED lights up. When you release it, the red one is lit.

My version of the lab is shown in the video below.
Essentially it is exactly the same wiring as the previous example, except now instead of a button, the fruit (in foil) and the foil on the table is connecting the circuitry.

Posted: September 14th, 2010
Categories: Arduino, Physical Computing
Comments: No Comments.