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

  • Stop wasting time looking for files and revisions. Connect your Gmail, DriveDropbox, and Slack accounts and in less than 2 minutes, Dokkio will automatically organize all your file attachments. Learn more and claim your free account.

View
 

Lab Report 2 - Sylvie

Page history last edited by Benjamin Tee 8 years, 2 months ago

EE 47 Lab 2: Teensy LED & Frankenlight

 

Part B – Teensy LED

 

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

 

You can change the LED Number to anything other than 11, which is the pin location that the LED is hardwired to.  You can also just delete the digitalWrite(led, HIGH); line, which basically turns the LED on.

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

 

You need to change the number in the delay command, which signifies duration in milliseconds.

 

digitalWrite(led, HIGH);  

  delay(200);                              <--Determines the duration of the LED being on

  digitalWrite(led, LOW);  

  delay(200);                              <--Determines the duration of the LED being off

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

 

A resistor to control the current thru the board so that it doesn’t overheat and destroy the LED.

 

Yellow LED max forward current 25 mA; Forward voltage 2.0-2.4V

5V-2V – 3V = (0.025A) x R

R = 120 Ohms

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

 

const int buttonPin = 2;    

const int ledPin =  9;

2b. 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.

 

if (buttonState == HIGH) {   

    // turn LED on:   

    digitalWrite(ledPin, LOW);    <-- changed from HIGH

  }

  else {

    // turn LED off:

    digitalWrite(ledPin, HIGH);   <-- changed from LOW

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

 

int ledPin = 9;

3b. How would you change the rate of fading?

 

Change the milliseconds in the delay command.  The first delay controls the duration in between the loop where the LED brightens or dims.  Higher milliseconds = slower.

You can also change the fade value to a higher (=faster) or lower number (=slower).

 

void loop()  {

  // fade in from min to max in increments of 5 points:

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

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

    analogWrite(ledPin, fadeValue);        

    // wait for 30 milliseconds to see the dimming effect   

    delay(30);                           

  }

 

  // fade out from max to min in increments of 5 points:

  for(int fadeValue = 255 ; fadeValue >= 0; fadeValue -=5) {

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

    analogWrite(ledPin, fadeValue);        

    // wait for 30 milliseconds to see the dimming effect   

    delay(200);                                   

3c. (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?

 

Understand how the human eye sees brightness linearly and make the code reflect this.

✔ Give it a shot by implementing the code :)

 

Part C – Frankenlight

 

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

 

For superbright clear LEDs:  ~3.2V forward drop, Max current 30mA

 

The minimum resistor size:

For 5V supply, 5-3.2V = 1.8V = (0.030A) x R

R = 60 Ohms

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

 

Yes, it is probably a little microcontroller underneath the circuit board covered with a black epoxy blob.  When a key is pressed, a circuit completes and that signal travels to the microcontroller, where the identity of the key is compared against some character map, and matched, and then a subsequent signal is then sent to the computer via cable.

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

 

Yes, there are sensors.  Underneath each key are two layers of plastic that have metal strips of coating, connecting back to the circuit board and hence controller.  The two layers have a plastic sheet that separates them, with holes underneath each key such that when the key is pressed, a hard plastic knob presses the plastic sheet on top will push down thru the hole and touch the bottom sheet and complete the circuit.

2c. 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?

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

 

The device is powered via USB cable.  It is 5V (as tested via multimeter).   Resistors regulated the power thru the circuit.  The USB cord regulates the power coming from the computer.

 

Yes there is information stored in the device under the black epoxy blob, in or next to the microcontroller, storing a character map of what each key corresponds to, in order to send this signal to the computer.

4. Please post a short video of your frankenlight to your lab report page. Include any schematics as well.

 

An LED was connected to the circuit board of a computer keyboard.  The LED is connected to the CAPS lock LED light, in series with another LED, then to ground.  There were two LED's in series in order to drop the voltage since the voltage difference in the CAPS lock LED when the CAPS lock was on vs off was only around 2V, whereas the forward voltage drop for the LED was around 3.2V.  So, the LED would not light since the LED required >2V forward voltage and hence this needed to be decreased.

Video of Frankenlight using keyboard:

http://youtu.be/McIDAqQjIds

 

Comments (0)

You don't have permission to comment on this page.