• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

• Browse and search Google Drive and Gmail attachments (plus Dropbox and Slack files) with a unified tool for working with your cloud files. Try Dokkio (from the makers of PBworks) for free. Now available on the web, Mac, Windows, and as a Chrome extension!

View

# Saket Bohania_Lab 2

last edited by 8 years ago

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)?

Ans: We do not need to change any lines of code which is provided in the the given example. We jsut need to make sure that the ledpin variable is connected

to pin 13 and is in the output state.

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

Ans: To change the rate of blinking we need to change the parameter in the delay function.

void loop() {

digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)

delay(500);               // wait for half a second

digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW

delay(500);               // wait for a second

}

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

Ans: To protect the board and LED we have to place a resistor. Suppose we are using a red LED whose forward voltage and current is 1.85 volts and 30 mA respectively.

So we need to use a resitance whose value is: R=V/I=(5-1.85)V/30mA= 105 ohms

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?

Ans:The initial variable assignments need to be modified. Pin 2 is already assigned we just need to change the pin number associated to the LED.

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

const int ledPin =  9;      // the number of the LED pin to whichit is connected.

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.

Ans: To make the LED glow only when the button is dpreesed we could either change the code or the circuit. For changes in the circuit we nned to interchange the

position of the 10k pot and the push button.

The changes in the code are as follows:

void loop(){

// read the state of the pushbutton value:

// check if the pushbutton is pressed.

// if it is, the buttonState is HIGH:

if (buttonState == LOW) {

// turn LED on when depressed:

digitalWrite(ledPin, HIGH);

}

else {

// turn LED off:

digitalWrite(ledPin, LOW);

}

}

3. Fading LEDs on andoff using Arduino Micro

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

Ans: We do not need to change any line of code as the LED is already assigned to pin 9.

b) How would you change the rate of fading?

Ans: We can change the rate of fading by either changing the incremenent or decrement value in the for loop or by changing the parameter in the delay function.

// sets the value (range from 0 to 255):

// wait for 30 milliseconds to see the dimming effect

delay(30);

}

OR

// sets the value (range from 0 to 255):

// wait for 100 milliseconds to see the dimming effect

delay(100);

}

✓ good!

c) (Extra) Since the human eye doesn't see increases in brightness linearly and the diode brightness is also nonlinear with voltage, how could you change the code to make the light appear to fade linearly?

Ans: To make the light appear fade linearly we should try multiplicative increments. But first we shoould change the datatype of fadeValue to float or double.

### 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.)

Ans: The minimum resistor size that could be used is:

R=V/I=(5-3.2)v/30mA= 60 ohms

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

The electronic device with me is a is a network camera running TCP/IP with built in Web server to be used with a Web-browser.

It is a camera connected directly to the network. It is a network camera that attaches directly to a network providing live video with a frame rate of up to 10 frames/second.

It has an ethernet cable attachment.

a. Is there computation in your device? Where is it? What do you think is happening inside the "computer?"

Ans: Yes there is a computing devic elocated in the board at the far end. Its called ETRAX-100 which is a series of CPU used in embedded sysytems.

It eliminates the time-consuming effort required for developing reliable system hardware and provides a stable hardware platform.

b. Are there sensors on your device? How do they work? How is the sensed information conveyed to other portions of the device?

Ans: Yes there is a push buttton which acts as a sensor. When the push button is pressed the circuit gets connected and the power is supplied to all the parts.

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?

Ans: The device is powered using a 3 volts battery. The power is regulated by a BCM5201 on board chip which helps in power management. The device can also be powered

using an adaptor. 3 volts is availbale through out the circuit with some voltage divider network to get desired voltage.

d. Is information stored in your device? Where? How?

Ans:the information is stored in the M29W160DT chip which has a 16 mbit of flash memory and stores the captured frames.

#### Vivien Tsao said

at 11:42 pm on Jul 14, 2013

Good job!

#### Vivien Tsao said

at 11:42 pm on Jul 14, 2013

Also, please remember to make your video public next time! I couldn't watch it.