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


Charles Wang - Lab 2

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

Charles Wang

29 June 2011



Lab 2 - Teensy LED & Frankenlight


Part A. Teensy LED!


1. Blinking LEDs with the Teensy

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

Change the numbers in pinMode & digitalWrite from 13 to 11.

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

Increase the delay time for a longer blink and decrease the time for a faster blink.

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

Add a resistor to make sure you don’t overpower the LED.


2. Toggle LEDs on and off using the Teensy

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

Make the buttonPin=2 & 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.


const int buttonPin = 2;

const int ledPin =  9;


int buttonState = 0;


void setup() {

  pinMode(ledPin, OUTPUT);     

  pinMode(buttonPin, INPUT);    



void loop(){

  buttonState = digitalRead(buttonPin);

  if (buttonState == LOW) {    

    digitalWrite(ledPin, HIGH); 


  else {

    digitalWrite(ledPin, LOW);




3. Fading LEDs on and off using the Teensy 

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

Make the ledPin=9.

     b. How would you change the rate of fading?

Increase the delay time for a longer fade and decrease the time for a faster fade. What do you mean by increasing the delay time? Maybe you can show the code next time? How about increasing the intensity faster by changing the fadeValue?


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

According to Ohm’s law, voltage = resistance * current which means that resistance = voltage / current.

The forward voltage drop of the superbright LED is 3.2V and there is 5V going into the circuit, therefore, the voltage dropped across the resistor must be 5V – 3.2V = 1.8V. For the superbright LED that has a maximum current of 30mA, which is equal to 0.03A, the resistance is 1.8V / 0.03A = 60Ω.


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

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

I examined my DVD remote. There is a microprocessor on the bottom end of the remote that is connected to the battery, all the buttons on the board and the infrared light that gives signals to a receiver. The microprocessor is probably something similar to the button code I was using for my Teensy board. If a connection is “HIGH” between a certain two pins, the microprocessor can determine what button is being pressed and send the correct pattern signal to the infrared sensor to send to the DVD player.

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

The remote has buttons that, when pressed down, complete a certain connection between the microprocessor which, depending on which two pins are being connected, tells the processor what to do. The buttons complete the circuit through the conductive pad on the bottom of each button.

     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 is powered using two double A batteries which provide 1.5V each for a total of 3V being used throughout the system.

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

There is information being stored in the remote such as the signal patterns to send to the infrared sensor based on the connections being made by the buttons. This information was most likely programmed and stored in the microprocessor.


3. Using your schematic, figure out where a good point would be to hijack your device and implant an LED.


     I decided to replace the infrared sensor with the red LED in my toolkit. I was worried that I      wouldn’t be able to see the LED light up because the signal patterns might be too fast for the      human eye to see but it turned out fine. Every button pressed seemed to give off the same      signal with no difference in pattern, just a flash every time I pressed a button. However, there      was probably a difference that was too fast for the human eye to catch.


Comments (1)

Benjamin Tee said

at 6:03 pm on Jul 24, 2011

Great job! Nice work hacking the remote control! Yes, there is a limitation to how fast the human eye can perceive a blinking led. Do you know what frequency it is? Try to find it out.

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