Lorta_Lab 2: Make Your Own LED Light


Part B. Arduino micro LED!

 

1. Blinking LEDs with Arduino Micro

a. What line(s) of code do you need to change to make the LED blink (like, at all)?

When I connected my external LED to pin 9, I needed to change line 10 in the Blink program from “int led = 13;” to “int led = 9;”.

b. What line(s) of code do you need to change to change the rate of blinking?

The rate of blinking is controlled by the delay(var) function, where “var” is in milliseconds.

c. What circuit element would you want to add to protect the board and LED?

We need to add a resistor in order to protect the board and LED.

 

2. Toggle LEDs on and off using Arduino Micro

a. Which lines do you need to modify to correspond with your button and LED pins?

I needed to modify line 30 in the Button program from “const int ledPin =  13;” to “const int ledPin =  9;”.

b. Modify the code or the circuit so that the LED lights only while the button is depressed. Include your code in your lab write-up.

 

// constants won't change. They're used here to

// set pin numbers:

const int buttonPin = 2;     // the number of the pushbutton pin

const int ledPin =  9;      // the number of the LED pin

 

// variables will change:

int buttonState = 0;         // variable for reading the pushbutton status

 

void setup() {

 // initialize the LED pin as an output:

 pinMode(ledPin, OUTPUT);

 // initialize the pushbutton pin as an input:

 pinMode(buttonPin, INPUT);

}

 

void loop() {

 // read the state of the pushbutton value:

 buttonState = digitalRead(buttonPin);

 

 // check if the pushbutton is pressed.

 // if it is, the buttonState is HIGH:

 if (buttonState == HIGH) {

   // turn LED on:

   digitalWrite(ledPin, HIGH);

 }

 else {

   // turn LED off:

   digitalWrite(ledPin, LOW);

 }

}

3. Fading LEDs on and off using Arduino Micro

a) Which line(s) of code do you need to modify to correspond with your LED pin?

None, I connected my external LED to pin 9 on the Arduino which corresponded to the correct pin number in the program.

b) How would you change the rate of fading?

Change the increment/decrement of the fadeValue variable to an integer greater than or less than +/- 5.

 

Part C. Frankenlight

 

1. Super bright LEDs

a. What is the minimum resistor size that should be used with these LEDs? (Hint: think about your voltage supply and what the diode voltage drop means.)

Vt = Vin - Vf = 5V - 3.2V = 1.8V

R = Vt/I = 1.8/.03 = 60 ohms

2. Take apart your electronic device, and draw a schematic of what is inside.

Before I "hijacked" the existing leads:


 

And after:

a. Is there computation in your device? Where is it? What do you think is happening inside the "computer?" There seemed to be no computation unit inside my device.

b. Are there sensors on your device? How do they work? How is the sensed information conveyed to other portions of the device? There’s a switch inside my device. It open/closes the device’s circuit when pressed. This turns the light on and off.

c. How is the device powered? Is there any transformation or regulation of the power? How is that done? What voltages are used throughout the system?

The device was meant to be powered via four triple A batteries. The batteries seem to be wired in series, therefore, the voltage would have been approximately 6V before hitting the incandescent light bulb and then would have dropped according to the forward voltage of the bulb. There were no visible components which seemed to regulate power.

d. Is information stored in your device? Where? How? There is no information stored on my device. It originally was a lamp light with one switch before I transformed it into a strobe light.

 

Fliqz has shut down their service. To access this video, email support with this video id: 0acfba70bb9a417eb681787adb57107d