Michelle Del Rosario: Difference between revisions

From Psych 221 Image Systems Engineering
Jump to navigation Jump to search
imported>Esotu
mNo edit summary
imported>Esotu
mNo edit summary
Line 116: Line 116:
== Conclusions ==
== Conclusions ==


Describe what you learned. What worked? What didn't? Why? What would you do if you kept working on the project?
Overall, I learned a lot about how to mix LEDs and produce color matching via Bob and Hiroshi's software. There was a lot of challenge in discovering new and novel ways to implement a scaled down version of an existing experimental research tool, the biggest being diffusing LEDs to mix colors and reducing complexity so anybody else could use it with little knowledge of how I set everything up.
 
Creating the circuits from my schematic worked very well.  I'm also pleased with how clean the shrinkwrapping and wire soldering resulted.  Despite the initial troubles with configuring the Arduino with Bob and Hiroshi's software, that worked out very well in the end after several hours of researching the appropriate way to interface them.
 
One of the major disappointments I experienced was placing the LEDs inside the flashlight lens and covering them with the cap diffuser.  I was slightly taken aback by the fact that they would not fit inside easily, and I think a better way to fix this would be to cut the opening a bit larger for each LED to slide in without much resistance (because I feared they might break after being under too much stress).
 
Another solution I had involved drilling holes in an angle into the flashlight lens such that each LED would point toward a central focus.  In this way the lights would combine even more effectively, but the challenges here are determining the appropriate angle for each LED, installing the LEDs such that they do not jostle out of place, and making the LEDs easy to replace should they need to be.
 
Personally, I am still working out a way to improve this design such that Bob and Hiroshi will have a fully polished Portalbe LED Flicker.  My next iteration will involve the aforementioned solution and a bigger carrying case as shown here [[https://lh5.googleusercontent.com/-jevK6n4gXfk/TfD32w7No9I/AAAAAAAABdg/KZs74TJToNk/s800/DSCI0009.JPG]].  Once I finish this, I will update this page accordingly, but for now the basic premise of my work and future directions are all here.


== References ==
== References ==
Line 161: Line 169:
  svn co https://white.stanford.edu/repos/vistadisp/trunk/ledFlicker/
  svn co https://white.stanford.edu/repos/vistadisp/trunk/ledFlicker/


Use subversion to download the ledFlicker files from Bob and Hiroshi's site.


====LED Flicker Schematics & Relevant Images ====
====LED Flicker Schematics & Relevant Images ====
[[https://lh6.googleusercontent.com/-lkkmIx0Jyns/TfD33XrESRI/AAAAAAAABdw/y0pEsAneRU0/s800/DSCI0013.JPG Initial Circuit Calculations]]
[[https://lh6.googleusercontent.com/-lkkmIx0Jyns/TfD33XrESRI/AAAAAAAABdw/y0pEsAneRU0/s800/DSCI0013.JPG Initial Circuit Calculations]]
This is an initial circuit calculation involving the V = IR equation.  There is also a simple schematic for hooking up a single LED.


[[https://lh4.googleusercontent.com/-GLIyLy-qxUk/TfD33uPRPwI/AAAAAAAABd4/ldUYfii7A3I/s800/DSCI0014.JPG Arduino Pin Setup and Resistor Values]]
[[https://lh4.googleusercontent.com/-GLIyLy-qxUk/TfD33uPRPwI/AAAAAAAABd4/ldUYfii7A3I/s800/DSCI0014.JPG Arduino Pin Setup and Resistor Values]]
Here is my entire calculation for the resistors needed for each LED.  Next to each LED, you will also see the nm wavelength range.


[[https://lh4.googleusercontent.com/-islaI5HKAoI/TfD33YUSlSI/AAAAAAAABd0/UOYQKodHrKw/s800/DSCI0012.JPG Color Mixing Diffuser Concept]]
[[https://lh4.googleusercontent.com/-islaI5HKAoI/TfD33YUSlSI/AAAAAAAABd0/UOYQKodHrKw/s800/DSCI0012.JPG Color Mixing Diffuser Concept]]
Initial sketches of my flashlight lens LED Flicker holder.  I originally thought about mimicking Hiroshi's fiber optics implementation, but I later decided against it due to reduction in complexity reasons.


[[https://lh5.googleusercontent.com/-o4LjmR-Qs-A/TfD33KOQoKI/AAAAAAAABds/3a1ZOommQNY/s800/DSCI0011.JPG LED Flicker Schematic]]
[[https://lh5.googleusercontent.com/-o4LjmR-Qs-A/TfD33KOQoKI/AAAAAAAABds/3a1ZOommQNY/s800/DSCI0011.JPG LED Flicker Schematic]]
This is my schematic for the LED flicker.  There is also an Arduino Mega on the left side to demonstrate how the circuit will tie into the physical device.


[[https://lh3.googleusercontent.com/-LQZaBiIyYD4/TfD33Bk-ySI/AAAAAAAABdk/Z9HMYhj0nks/s800/DSCI0010.JPG LED Flicker World View Representation]]
[[https://lh3.googleusercontent.com/-LQZaBiIyYD4/TfD33Bk-ySI/AAAAAAAABdk/Z9HMYhj0nks/s800/DSCI0010.JPG LED Flicker World View Representation]]
Another schematic view of the LED Flicker with even more World View representation diagrams.


[[https://lh5.googleusercontent.com/-jevK6n4gXfk/TfD32w7No9I/AAAAAAAABdg/KZs74TJToNk/s800/DSCI0009.JPG Scaling LED Flicker]]
[[https://lh5.googleusercontent.com/-jevK6n4gXfk/TfD32w7No9I/AAAAAAAABdg/KZs74TJToNk/s800/DSCI0009.JPG Scaling LED Flicker]]
This is my future iteration scaling project.  I want to use a larger flashlight holder to house the entire Arduino board and all of the LED components.  There is also plans to incorporate the diffusing film in two steps across the lens opening to maximize color mixing.  The flashlight top down view shows how the LEDs will be mounted in an angle to create the central focus point.


[[https://lh4.googleusercontent.com/-r-SZM-K_z2I/TfD31pnhnAI/AAAAAAAABcs/_XVyy--p2eg/s800/DSCI0002.JPG LED Flicker Components]]
[[https://lh4.googleusercontent.com/-r-SZM-K_z2I/TfD31pnhnAI/AAAAAAAABcs/_XVyy--p2eg/s800/DSCI0002.JPG LED Flicker Components]]
These are the current components to the LED flicker.  From left to right we have an Arduino Mega, soldered wires and resistors leading to individual LEDs, a flashlight lens, and a spray can diffuser cap.  The LEDs fit inside the flashlight lens and then the diffuser cap goes on top.  From there the Arduino is plugged into a computer's USB port and controlled via Serial Monitor on the computer.


[[https://lh4.googleusercontent.com/-1ufT4AUpqvg/TfD31rvlW-I/AAAAAAAABcw/ORMGNSA6S2I/s800/DSCI0003.JPG LED Flicker Activated]]
[[https://lh4.googleusercontent.com/-1ufT4AUpqvg/TfD31rvlW-I/AAAAAAAABcw/ORMGNSA6S2I/s800/DSCI0003.JPG LED Flicker Activated]]
Here you see the LEDs bundled outside of the flashlight lens.  As you can see, the lights mix somewhat but still have their own distinctive colors.


[[https://lh4.googleusercontent.com/-jcaW0HxnXCM/TfD32OuXgQI/AAAAAAAABc4/c_YXroRt6cU/s800/DSCI0004.JPG LED Flicker Initial Diffusion]]
[[https://lh4.googleusercontent.com/-jcaW0HxnXCM/TfD32OuXgQI/AAAAAAAABc4/c_YXroRt6cU/s800/DSCI0004.JPG LED Flicker Initial Diffusion]]
This is the LED Flicker inside the flashlight lens and diffuser cap.  You can see the beginnings of color mixing on the sides of the diffuser cap and partially in the front, but the lights are still somewhat isolated in some regions.


[[https://lh6.googleusercontent.com/-nFNuR-L_7b4/TfD32c74HXI/AAAAAAAABc0/rLZRfRPhjJg/s800/DSCI0005.JPG LED Flicker Second Diffusion]]
[[https://lh6.googleusercontent.com/-nFNuR-L_7b4/TfD32c74HXI/AAAAAAAABc0/rLZRfRPhjJg/s800/DSCI0005.JPG LED Flicker Second Diffusion]]
 
Finally, we have a second layer of diffusion with the Luminati Diffusion Film. This shows a drastic effect in color mixing capabilities.
 
 
Upload source code, some result images, etc, and give a description of each link. In some cases, your acquired data may be too large to store practically. In this case, use your judgement (or consult one of us) and only link the most relevant data. Be sure to describe the purpose of your code and to edit the code for clarity. The purpose of placing the code online is to allow others to verify your methods and to learn from your ideas. It should be possible for someone else to generate result images using your code.

Revision as of 20:31, 9 June 2011

Introduction

Though we may not perceive the variety of colors present in the world, our brains are remarkable structures that still sense these colors despite our inability to perceive them. Professor Bob Dougherty and Visiting Scholar Hiroshi Horiguchi have been studying this phenomenon using their own LED Flicker and fMRI scanning technology. However, their current hardware device is much too bulky to travel around with as they would like to display their experiment findings other fellow researchers. Given this constraint, I was asked to create a portable LED Flicker that mixes colors for the purpose of demonstrating their work at future conference events.

Professor Doughtery and Horiguchi's LED flicker currently relies on six LEDs, fiberoptic cables, diffuser lenses, and various electronic components (i.e., resistors, buckpucks, and heatsinks). In order to create a portable LED flicker, I focused on three main objectives the device had to fulfill:

1.) Small and robust enough to be transported with relative ease.

2.) Mix colors from LED channels that can be altered by computer interfacing.

3.) Minimize construction and maintenance complexity.

Methods

Reviewing Current Implementation

Before beginning the project, I met with Bob and Hiroshi to discuss what they had in mind for the deliverable. Based on our discussions, I had more or less complete freedom to implement the solution however I wanted and so I focused initially on recreating their device based on the documentation provided on their wiki page [[1]].


However, a lot of the additional components (buckpucks and heatsink among other lens couplers) on this page seemed unnecessary for the purpose of a smaller scale device whose intention is to simply demonstrate coloring mixing abilities via Bob and Hiroshi's software. So, upon several meetings with Hiroshi, I modified their template to work on LEDs, resistors, and my own hardware encapsulation to diffuse the colors.

Setting up Arduino Environment

From this understanding, I set up my Arduino environment[[2]] to run Bob and Hiroshi's firmware [[3]]. The computer I use runs off Windows 7, so I had to look for an appropriate driver [[4]]to update my computer with such that the USB connection would recognize the Arduino hardware. There were quite a few tricks to understand exactly how to install the drivers successfully, but the basic idea is as follows:


HOW TO INSTALL ARDUINO DRIVER IN WINDOWS

  1. Download appropriate driver and put it inside the Arduino drivers folder
  2. Open Device Manager (can be done by typing Device Manager in search bar under Home Button)
  3. Look for Ports in the drop down menu and right click on your Arduino USB connection
  4. Right click on your Arduino USB connection
  5. Select Update Drivers
  6. In the pop up window, choose Browse my Computer for Software Drivers
  7. Locate your drivers folder inside the Arduino folder
  8. Finish
  9. Windows should install the drivers based on the location you specified



From here, I had to configure my Arduino board and COM PORT inside the Arduino application. This is pretty simple, but below is the process to set it up yourself:


HOW TO CONFIGURE ARDUINO AND COM PORT

  1. Open Arduino.exe
  2. Click Tools
  3. From the drop down menu, click Board
  4. Another drop down menu appears; select the appropriate board you're using (in my case, an Arduino Mega ATMega1280)
  5. Go into Tools again and select Serial Port
  6. Choose the appropriate port that your Arduino is connected to (if there are multiple ports, pick one and see if your Arduino will be recognized upon hitting the upload button. The worst case scenario is the Arduino won't be able to read your board and you'll have to pick another port).


Understanding Basics of Software

Once I had the Arduino Environment set up, I ran a test from the Arduino examples page to make sure everything worked correctly. Upon success, I compiled Bob and Hiroshi's code and began reading through their implementation to understand how I should wire up the physical device based on their pin structures.


PIN STRUCTURES

  1. define PIN_LED1 11
  2. define PIN_LED2 12
  3. define PIN_LED3 13
  4. define PIN_LED4 2
  5. define PIN_LED5 3
  6. define PIN_LED6 5

The above Pin Structures code basically means I have to connect LEDs to pins 11, 12, 13, 2, 3, and 5. Because Bob and Hiroshi's code runs on Pulse Width Modulation, these pin numbers correspond to the PWM pins on the Arduino Mega. This is a very important distinction to follow otherwise the code will not run to produce the rapid flicker effect.

The actual order of the LEDs does not matter since they can be calibrated in an external software program from Bob and Hiroshi's download page. However, for my purposes, I set up the LEDs to be bundled as Red, Blue, Green and Orange, Cyan, Yellow. This way, I could keep my resistor values straight in my head as I began putting the electronic pieces together.


Drafting Hardware Structure

With a basic understanding of the underlying software, I prepared my hardware implementation process. The first step involved figuring out the necessary LEDs to include in the project. Bob and Hiroshi had provided me with six colors of their LEDs, so I calculated the corresponding resistance values to each LED via basic Electrical Engineering concept Voltage (V) = Current (I) * Resitance (R) [[5]]. Each LED package came with a max current and typical current reading, so using this knowledge and the V=IR equation, I computed the resistance values [[6]].

From these resistance values, I did a bit of resistance code reading [[7]] to select the appropriate resistors for each LED. Now that I had the LEDs and their resistors, I sketched out a schematic of how they should interface with the Arduino's pins [[8]]. To make things even easier for me, I also sketched a real world view of how the pins should look when connected to the Arduino [[9]].

In addition to the electrical side of this project, I also had to create a case to hold these LEDs. I drafted several ideas before I settled on a flashlight carrier case [[10]]. The idea here being the LEDs will fit inside the reflective nozzle of the flashlight and allow the stray rays to be reflected forward for maximum light preservation and mixing.

Building Initial Component

To build the LED Flicker, I used some wires that I soldered resistors to the base of the LEDs' ground wire (the shorter of the two legs on the LED). Because the wires are still somewhat free-flowing, there is a danger of them touching each other and mixing signals among potential damage to the entire structure. To prevent these mishaps, I wrapped each wire component with a heatshrink covering (these are the black "sleeves" on the wire in the picture [[11]]. I also applied heatshrink to the LEDs' legs because they also presented the same danger.

From here, I soldered the wires onto their respective pins on the Arduino shield board and applied the shield to the Arduino itself. All that remained to do was to slip each of the six LEDs inside the flashlight's case and put on a diffuser cap (the white spray can cap in the picture) [[12]].

Other initial diffuser options I debated on included glazed glass and ping pong balls. Another option, albeit time-consuming, was to sand each LED's surface such that the light diffused from the LED's plastic covering. The main reason I didn't choose to do this was because I wanted to switch the LEDs quickly and individual sanding may result in differences upon calibration.


Interfacing Hardware with Software

Combining the LED hardware with Bob and Hiroshi's software took some tweaking to get right. With the hardware built and the software coded, I hooked up the USB connector and configured my Arduino. Then I uploaded the software onto the Arduino board and opened the Serial Monitor once that was completed. In order to run the program in the serial monitor, I needed to change the BAUD rate to 57600 (as specified in their code). From there, I could type in some preset functions to display a help menu and alter the LED's flicker ratings.

Reviewing and Iterating on Device

One of the major challenges in this project was simply getting the colors to mix. The most straight-forward solution included bundling the LEDs together, but this would produce only slight color mixing as each LED's light would be overpowering and shine through as demonstrated in this picture [[13]].

The next solution involved diffusing the light via some opaque-ish medium. For this, I relied on a spray can bottle cap because it fit so nicely over the flashlight's lens cover. As you can see from this picture [[14]], the lights from the LEDs are mixing well on the sides, but still somewhat in isolation if you look directly at the light rays. So, I needed a better way to diffuse the lights even further.

As alluded to before, I looked up many ways to diffuse the light. Most sources suggested sanding plastic surfaces [[15]], using special materials like alabaster [[16]], or even using hot glue [[17]]. I asked Hiroshi for advice from his experience in building the original LED flicker and he explained to me how his device uses optic fibers to draw multiple LEDs into one cylinder then diffuses it with two layers of special diffusing film [[18]]. This film is somewhat pricey and very delicate. So, it is not to be handled with bare fingers else the surface could be ruined by the natural oils on our skin.

Hiroshi was generous to give me a sample of this film and I experimented to see how much more the light would diffuse if I placed the film in front of the light rays [[19]]. A much more noticeable improvement was had.


Results

LED Flicker Demo of color mixing:

http://www.youtube.com/watch?v=RFTjmqOYFqM

Here the LED Flicker mixes lights. I demonstrate each of the six LEDs separately first and then mix a few of them together to show the presence of color mixing. The commands are issued through the Arduino's Serial Port.

You'll notice that three of the LEDs seemed somewhat dim on the diffuser. This is because I could not place them entirely inside the flashlight's lens case since the other LEDs (red, green, and blue) took up quite a bit of space with their heatshrink wrappers, making it difficult to squeeze in anymore components.

Conclusions

Overall, I learned a lot about how to mix LEDs and produce color matching via Bob and Hiroshi's software. There was a lot of challenge in discovering new and novel ways to implement a scaled down version of an existing experimental research tool, the biggest being diffusing LEDs to mix colors and reducing complexity so anybody else could use it with little knowledge of how I set everything up.

Creating the circuits from my schematic worked very well. I'm also pleased with how clean the shrinkwrapping and wire soldering resulted. Despite the initial troubles with configuring the Arduino with Bob and Hiroshi's software, that worked out very well in the end after several hours of researching the appropriate way to interface them.

One of the major disappointments I experienced was placing the LEDs inside the flashlight lens and covering them with the cap diffuser. I was slightly taken aback by the fact that they would not fit inside easily, and I think a better way to fix this would be to cut the opening a bit larger for each LED to slide in without much resistance (because I feared they might break after being under too much stress).

Another solution I had involved drilling holes in an angle into the flashlight lens such that each LED would point toward a central focus. In this way the lights would combine even more effectively, but the challenges here are determining the appropriate angle for each LED, installing the LEDs such that they do not jostle out of place, and making the LEDs easy to replace should they need to be.

Personally, I am still working out a way to improve this design such that Bob and Hiroshi will have a fully polished Portalbe LED Flicker. My next iteration will involve the aforementioned solution and a bigger carrying case as shown here [[20]]. Once I finish this, I will update this page accordingly, but for now the basic premise of my work and future directions are all here.

References

LED Flicker background information

http://vistalab.stanford.edu/newlm/index.php/LedFlicker

http://c3012152.cdn.cloudfiles.rackspacecloud.com/110119eye.pdf

http://www.ncbi.nlm.nih.gov/pubmed/20375057

Electronic Construction resources

https://sites.google.com/site/hackingthingscourse/home/hardware-resources/circuits

http://protolab.pbworks.com/w/page/19403649/TutorialButtonsAndLeds

http://www.arduino.cc/playground/Code/LED

http://www.arduino.cc/en/Tutorial/VirtualColorMixer

http://www.arduino.cc/en/Tutorial/Dimmer

Color Mixing Diffusion inspiration

http://www.luminitco.com/

http://tobe.nimio.info/diy/pyramid/led/lamp

http://danjuliodesigns.com/sculptures/sculptures.html

http://www.instructables.com/id/Hot-Glue-LED-Diffusion/

http://www.instructables.com/id/Make-a-$200-%22tactical%22-flashlight-for-about-$15/

Arduino Setup

http://www.arduino.cc/en/Guide/Windows

http://www.ftdichip.com/Drivers/VCP.htm


Appendix I

Source Code

svn co https://white.stanford.edu/repos/vistadisp/trunk/ledFlicker/

Use subversion to download the ledFlicker files from Bob and Hiroshi's site.

LED Flicker Schematics & Relevant Images

[Initial Circuit Calculations] This is an initial circuit calculation involving the V = IR equation. There is also a simple schematic for hooking up a single LED.

[Arduino Pin Setup and Resistor Values] Here is my entire calculation for the resistors needed for each LED. Next to each LED, you will also see the nm wavelength range.

[Color Mixing Diffuser Concept] Initial sketches of my flashlight lens LED Flicker holder. I originally thought about mimicking Hiroshi's fiber optics implementation, but I later decided against it due to reduction in complexity reasons.

[LED Flicker Schematic] This is my schematic for the LED flicker. There is also an Arduino Mega on the left side to demonstrate how the circuit will tie into the physical device.

[LED Flicker World View Representation] Another schematic view of the LED Flicker with even more World View representation diagrams.

[Scaling LED Flicker] This is my future iteration scaling project. I want to use a larger flashlight holder to house the entire Arduino board and all of the LED components. There is also plans to incorporate the diffusing film in two steps across the lens opening to maximize color mixing. The flashlight top down view shows how the LEDs will be mounted in an angle to create the central focus point.

[LED Flicker Components] These are the current components to the LED flicker. From left to right we have an Arduino Mega, soldered wires and resistors leading to individual LEDs, a flashlight lens, and a spray can diffuser cap. The LEDs fit inside the flashlight lens and then the diffuser cap goes on top. From there the Arduino is plugged into a computer's USB port and controlled via Serial Monitor on the computer.

[LED Flicker Activated] Here you see the LEDs bundled outside of the flashlight lens. As you can see, the lights mix somewhat but still have their own distinctive colors.

[LED Flicker Initial Diffusion] This is the LED Flicker inside the flashlight lens and diffuser cap. You can see the beginnings of color mixing on the sides of the diffuser cap and partially in the front, but the lights are still somewhat isolated in some regions.

[LED Flicker Second Diffusion] Finally, we have a second layer of diffusion with the Luminati Diffusion Film. This shows a drastic effect in color mixing capabilities.