Ge Stella Lab 2


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

The digitalWrite(pin, HIGH) line actually turns the LED on, and the digitalWrite(pin, LOW) turns it off, so you would need both if you actually wanted the LED to blink. You also need to edit the pin variable line (int led=pin#) if the pin # does not match up with the number it is plugged into on your circuit.

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

The delay(1000) determines the amount of the time between turning on and turning off, and therefore would change the rate of blinking.

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

The resistor prevents too much current from going through the circuit and possibly burning out parts or the 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?

Change ledPin variable line so that the pin number corresponds with the pin number on your circuit.

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.

I modified the circuit so that the button was connected to pin 2 and the LED was connected to pin 13, so that it went with the code, but the code stayed the same.

 

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?

You need to modify the line with the ledPin variable to match the pin the LED is plugged into on your circuit.

b) How would you change the rate of fading?

You can change the delay(30) in the fade in and fade out sections and increase the milliseconds in the parentheses of delay to fade more quickly or less quickly.

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?

Change this line:

for(int fadeValue = 0 ; fadeValue <= 255; fadeValue +=5) { 

fadeValue += (change this) to make the increment smaller? Not super sure.

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

Forward voltage drop = 3.2V

Max current = 30 mA

Voltage=5V-3.2V=1.8V

V=IR

1.8V=(0.03A)R

R=60 Ohms

The minimum is 60 Ohms.

2. Take apart


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

I chose a keyboard, so there is a microcontroller on the circuit board that has many pins and will take input from the keys pressed. The input is probably then sent to the computer through the USB that connects the keyboard to the actual computer so that the keys typed show up or have effects.

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

Yes! The different keys of the keyboard all have pressure sensors that will send a signal to the microcontroller when depressed. In this way, they could be considered to be switches. On my keyboard, there are plastic sheets with lines connecting to the larger keyboard pad. Each line on these sheets goes into a pin on another microprocessor or decoder and then are sent to the main microcontroller. I'm guessing that there's some kind of matrix configuration with the keys, and depending on the combination of which "line" on each of 2 sheets tells the microcontroller what key was pressed and then is sent to the computer which determines what the key pressed will do.

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?

It's connected via USB to a computer, which supplies 5V of power. Of course, there are many capacitators and resistors that moderate the amount of current that goes through the device. There are also power and ground pins on the microcontroller (I attached my LED and resistor combo to the power/ground pins, as seen in the video), and I would assume that the computer has the ability to choose whether to "register" the keyboard and can not give it power, effectively "turning it off".

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

It's an input device, so its primary function doesn't include data storage. As I explained earlier, it would definitely store the values of where in the matrix the key was pressed, but it then sends this to the computer to express the character or other effects. I think the in the main microcontroller (Alcor Micro au9410).

4. Build Light