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

  • Get control of your email attachments. Connect all your Gmail accounts and in less than 2 minutes, Dokkio will automatically organize your file attachments. You can also connect Dokkio to Drive, Dropbox, and Slack. Sign up for free.

View
 

EE47 Lab 2: Make Your Own LED Light

Page history last edited by xyyue@... 4 years, 12 months ago

Neil Barot

Home Lab: Monday OHs

Lab 2

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

 

Well, using the blink program, the  onboard LED that is hardwired to pin 13 blinks as soon as I upload the file. So to make that blink at all, I really don’t have to change anything.

 

 

 

However, to make the external LED blink, I need to change the first arguments in pinMode() and digitalWrite() to pin 9, where the external LED is connected.

 

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

 

To change the rate of blinking, I just need to adjust the argument of delay. Let’s say I were to adjust the loop() method to have a delay of 2000ms between on and off.

 

 

This would make the LED blink at a slower rate—twice as slow.

 

If I were to change the rate of blinking to 500ms instead,

 

 

It would make the LED blink twice as fast as the original blink.

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

To protect the board and the LED, I would add a resistor to the circuit.

 

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?

 

Because the LED is already set up on pin 9, I would only need to change the integer variable ledPin from 13 to 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.

I simply made it so that when the buttonState is HIGH, the LED pin is LOW (off), and when the buttonState is LOW, the LED pin in HIGH (off).

 

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?

Just as I did before, I would only need to change the integer variable ledPin to match the pin my LED is connected to. In this case, since my LED is still at 9, the variable needs to be:

 

b) How would you change the rate of fading?

Changing the rate of fading is similar to changing the rate of blinking. You just change the argument in delay()!

 

At the given example state, we have a delay of 30ms:

 

 

If we bump the delay up to 60ms, it will fade twice as slow:

 

 

If we drop the delay down to 15ms, it will fade twice as fast:

 

 

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?

 

Since our eye does not see increases in brightness linearly, we would need to adjust our code to essentially counteract the differences!

 

Source: HP Led Shield WordPress

 

Based on the curve, we can deduce that there would need to find, test and calculate a logarithmic equation that would provide us with a factor we could use to calculate the exact power output required to have a perceived linear increase. I would build a curve using a few test equations, and then scale the above curve with respect to a direct power from analog brightness curve, and then match the best fit with the equation-factored logarithmic curve I previous calculated. Probably, along the way, I'd make some adjustments, but I believe that a procedure like that would allow me to make the light appear to fade linearly. 

 

 

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

 

LED Color: Super Bright

 

To calculate the resistance, we use Ohm’s law: Resistance = Voltage/Current (R = V/I)

 

Step 1: Convert the Units of Current from mA to A

 

Step 2: Calculate the Voltage

 

The typical forward voltage of a Super Bright LED is given at approximately 3.2V. For the sake of calculations, we will stick with 3.2V exactly.

 

To calculate the voltage for Ohm’s law, I must not only utilize the voltage I am using from my power source (the Arduino Micro in this case), but also account for the forward voltage drop of the Super Bright LED. I can do this by taking the voltage from the power supply and subtracting the typical forward voltage.

 

 

Step 3: Calculate the Resistance

 

By plugging the values previously calculated into Ohm’s law, I will find the minimum resistance needed for the Super Bright LED.

 

correct 

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

 

correct 

 

 

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

 

Yes, there is computation in my device. There is a microcontroller that processes when the switch is pressed and determines which mode is selected, thereby transmitting the correct frequency to the IR lights at the top of the remote. 

correct 

 

 

b. 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 on my remote. The key one being the buttons! If you were to look closely at the board, where the buttons would be, there is a sort of finger-like circuit. On the back of the button is a silicone padding that acts as a conductor. When you push down on the button, the silicone touches the fingers and essentially connects them. After this point, I assume the information is processed by the micro controller and then sent to the appropriate on board LED and the IR lights.

correct 

 

 

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 by two sets of AAA batteries. Each set has two AAA batteries which are in series. The sets are parallel to each other. There is no regulation of power as, ideally, the full 3V from the AAA batteries should be flowing through the entire board. Obviously, after use of the batteries, the voltage drops--but the value still remains uniform when tested across the board.

 

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

There is information stored in the device is in the microcontroller:

- the current setting of the remote (TV, SAT, AUX, or VCR mode)

- the frequency to send to the IR lights to turn on devices

correct 

 

 

4. Build your light!

correct 

 

 

 

Comments (1)

zahraa@... said

at 2:05 pm on Jul 14, 2015

great job

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