Saturday, October 15, 2011

Lab #1: CIRC-01: Blinking LED

Purpose: To emit light and produce a pleasant blinking effect using a LED and a 330 Ohm resistor.

 
Equipment(s):

-CIRC-01 Breadboard Sheet x1
-2 Pin Header x4
-5mm Yellow LED x1
-Wire
-330 Ohm Resistor (Orange-Orange-Brown) x1
Program Details:

         In this lab, the main component that was used is LED(Light Emitting Diode) that emits light when a small current is passed through it. This light emits in only one direction. The LED looks like a small light bulb. It has 2 leads; the longer lead is positive and the shorter is negative. One 330 Ohm Resistor (Orange-Orange-Brown) was also used along with 3 wires. The resistor restricts the amount of current that can flow through a circuit. It looks like a cylinder with wires extending from either end. The value is displayed using a colour coding system. In this case, the tolerance of the resistor is 20% according to the resistor colour code. Resistors are very fragile so you have to be extra carefull and delicate while using them.

       At the start of this lab, I was a little nervous because I had no previous experience with circuits. However, the lab was fairly easy and simple. At first, me and my partner read though the first pages in order to get familiar with the parts and to know its functions. We read the lab, understood it and got the parts required to create the circuit. Then, we built the circuit, analyzed the code and typed it up from the booklet excluding the comments. Lastly, we uploaded the code by connecting the USB to the computer and Arduino.

Time to Complete: 20mins

Results:

      Unfortunately, when we were uploading the program, it didn’t upload properly and the LED did not light up. We knew that LEDs only works in one direction so we tried taking it out and twisting it 180 degrees but it still didn't work. A moment later, we realized that there is no problem with the LED; there was a conflict uploading the program because we forgot to change our serial port from COM1 to COM5. Thus, we changed the serial port and, watched the LED turn on for one second, then turn off for one second, repeatedly.

Photo(s) of Project:

Blinking LED :)

Tips:

        Although, this lab is easy and simple to accomplish if you have no previous experience with Arduino then you might feel challenged. That’s why, I can advise all the starters to browse through the booklet, get familiar with the Arduino parts, understand the labs/projects and its expected outcome. This way, you can accomplish your goal easily and efficiently.

Further Work:

       If you want to make your project better and take it to the next level then you can try to do the following four things:

1)     Change the pin: -Plug in wire into any pin of your choice from pin 0-13 or analog 0-5.  -Change the code line and assign the new pin number to the ledPin variable.

2)     Change the blink time: Modify the delay time.

3)     Control the brightness: -Change the LED to pin9 (int ledPin = 9 ;)
                                           -Also change the wire)
                                                 -Replace the code inside the {}’s of loop ( ) with this:
                                                  analogWrite(ledPin, new number);
                                                  (new number) = any number between 0 and 225.
                                                  0 = off, 255 = on, in between = different brightness.

4)     Fading: -Go to File>Examples> 3.Analog>Fading
                -Upload it to your board

Program Modifications:  This program is the same as the one from the following link.
                                                           CLICK ME and I'll take you to the link!

Program with comments:

/*
  *Blink
  *Turns on an LED on for one second, then off for one second, repeatedly.
  *The circuit:
  * LED connected from digital pin 13 to ground.
  * Note: On most Arduino boards, there is already an LED on the board
  * connected to pin 13, so you don’t need any extra components for this example.

  *Created 1 June 2005
  *By David Cuartielles
  *http://arduino.cc/en/Tutorial/Blink
  *based on an orginal by H. Barragan for the Wiring i/o board
*/

int ledPin =  13;    // LED connected to digital pin 13

// The setup() method runs once, when the sketch starts

void setup()   {        
  // initialize the digital pin as an output:
  pinMode(ledPin, OUTPUT);
}

// the loop() method runs over and over again,
// as long as the Arduino has power

void loop()            
{
  digitalWrite(ledPin, HIGH);   // set the LED on
  delay(1000);                  // wait for a second
  digitalWrite(ledPin, LOW);    // set the LED off
  delay(1000);                  // wait for a second
}

No comments:

Post a Comment