# Through the Keyhole and Into the Shire

Historically, one of the oldest references to a magical wand describes the supernatural item in the form of a staff. Staffs, if not too ornate, provide their owners with a lethal weapon that many observers would regard as an ordinary walking stick. For my final project, I have assembled a moonlight illuminating staff with the power to unlock a door. This idea of unlocking doors with moonlight stemmed in part from the wondrously entertaining, magical adventure novel, The Hobbit by Tolkien. In the story, the protagonists are given the following clue to enter the Lonely Mountain and reclaim their treasure from the treacherous dragon, Smaug: “’Stand by the grey stone when the thrush knocks’, read Elrond, ‘and the setting sun with the last light of Durin’s Day will shine upon the key-hole.’” The last light actually alludes to the setting sun in the book; the movie embellishes the riddle by declaring moonlight alone to be the last light of Durin’s Day.

Moonlight does, however, play a vital role in the novel, as Durin’s Day is, “when the last moon of Autumn and the sun are in the sky together.”
The technique chosen for developing a light source mimicking moonlight was to wire a multitude of colored LEDs together such that the number of each color was proportional to the relative intensity at that particular wavelength in the spectrum for moonlight. With only a finite number of different colors of LEDs in the circuit, the light source would serve as an approximation of moonlight. However, by inserting a sufficiently high number of LEDs into the circuit and extending the variety of colors fairly evenly across the visible region of the spectrum, this approximation should be sufficient. The spectrum that I used to determine the number of each color, originally from a paper by Ciocca & Wang, can be viewed at the following link:

http://physics.stackexchange.com/questions/244922/why-does-moonlight-have-a-lower-color-temperature

The Moon’s spectrum, shown as a blue line, was taken with the Moon at an altitude of 57 degrees. The red line on the diagram is the Sun’s spectrum at an altitude of 30 degrees. As seen, the two are markedly different over most of the visible spectrum. Six different colors of LEDs were placed in the circuit: blue at 467 nm, green at 522 nm, yellow at 592 nm, amber yellow at 595 nm, orange at 609 nm, and red at 660 nm. To develop my circuit, I first wrote down the signal strength for each of the colors from the spectrum. To the nearest tenth, I obtained: blue- 0.4, green- 0.9, yellow- 1.1, amber yellow- 1.1, orange- 1.1, and red- 1.0. Next, each of these numbers was multiplied by ten to yield the number of LEDs of each respective color; the total number of LEDs was thus 4+9+11+11+11+10 = 56. Since 56 is divisible by 4, I elected to set up the circuit with 14 parallel branches of 4 LEDs per branch. Desiring an even spread of the different colors to produce as monochromatic an appearance as possible, the process I used of arranging the locations of each LED was in no way random. Instead, I played a Sudoku-like game by requiring that each branch not contain more than one of each color, while limiting the number of same-color LEDs in each of the four rows to 3. To limit the current flowing through the LEDs, a 180 ohm resistor was positioned at the beginning of each branch. A 9 Volt battery and a 3 Volt battery pack were connected together in series to provide a total of 12 Volts to the circuit. Connected to the anode of the 3 Volt battery pack was a switch; the switch enables the wizard to easily turn on and off the LEDs by closing and opening the circuit. A picture of the complete circuit is illustrated below. The resistors and LEDs were all electrically connected by soldering on a RadioShack printed circuit board. For the body of my staff, I selected a six-foot tall cylindrical wooden pole. On top of this pole was mounted the assembled printed circuit board, along with the batteries. Over the LEDs a piece of plastic was taped down to diffuse the emanating light; a plastic bag was further placed over the board to help accomplish this task.

The door to be unlocked was a wooden circular one with a diameter of 4 inches. This door was part of a rectangular box, all six sides of which were laser cut and attached with Gorilla Glue. The box was designed in Onshape with grooves and protruding edges for the attachment. A picture of the design may be examined below. The shorter side that is visible on the right of the picture shows a large circular opening. After laser cutting all six sides I kept the cut-out circle from this piece to employ as the door. The shorter side not visible on the left is solid without a cut-out door. Notice also the small hole on the top piece. This is the entry point for light to enter the system. In my actual setup, I positioned this hole on the left side. I screwed on a hinge to the door and also attached a sliding lock to its interior side. On the front of the door, opposite the lock were four screws, one of which I attached to a bolt to form a door handle. The unlocking mechanism was a high-torque servo motor with a line of plastic tubing tied to the moving part of the lock. To digitally connect with the motor an Arduino Leonardo microcontroller board was used.

There exist a variety of methods of sensing light. One approach I strongly considered was to implement a Fast Fourier Transform on images of the light using Matlab. The Fourier Transform of a source of illumination reveals its spectrum. Below are images and corresponding shifted FFTs of both the light fixture atop my staff and an LED flashlight. Observing the differences in the two FFTs, it is clear that a comparator program would have distinguished between moonlight and sunlight in this case. Some of the challenges with this approach, however, are lag time of the computer for processing the images and running Matlab and Arduino software programs in concert. A simpler approach, and the one I implemented, is to exclusively use Arduino with photodetectors.

For the light sensor circuit, I considered photodiodes, phototransistors, and photocells for the light-detecting device. Connecting a photodiode in reverse-bias to a resistor without an operational amplifier in the circuit proved dreadful. The data received from the Arduino was intermittent; quite often the device would not output any signal unless I hovered a light source extremely close to it. I quickly came to the conclusion that an alternative device was necessary to obtain successful readings. Thus, I tested a 570 nm peak responsivity phototransitor. This worked remarkably well, as ambient lighting yielded a low analog reading in comparison to my moonlight staff. Furthermore, when I switched from the staff to a bright LED, I witnessed an order of magnitude increase in the value. The values read for different light sources with photocells were more uniform; however, photocells excelled at reproducing the same value for a given light source. My final system features a phototransitor in the configuration drawn below with a 10 kilo-ohm resistor.

In my program, I use a digital bandpass filter to declare moonlight to be identified when my given value (analog read signal multiplied by one million) is between 650 million and 750 million. Under that condition, the servo activates to unlock the door. The following video features me testing a variety of light sources in addition to my staff. Notice that before testing begins, I tilt the box to the right to lock it. If, for whatever reason, I am unable to open the door, I can manually tilt the box to the left to slide the lock back towards the center of the door; this prevented me from being permanently locked out. As shown in the video, when the moonlight illuminated staff is placed over the keyhole, the arm on the servo motor rotates and the door unlocks. Upon entering through the door that resembles that of a Hobbit’s home, one can view the electronic devices- Arduino Leonardo, breadboard with components, and servo motor- and associated wiring that enable the system to function.

The moonlight illuminated staff I created fits well as a natural model. Just as the Sun is far brighter than the Moon, the colored LEDs on my staff produce light of a lesser intensity than bright LEDs. I have thoroughly enjoyed the liberation to explore a topic that intrigued me greatly after reading Tolkien’s works. In the process, I have learned a great bit of science, especially regarding astronomy, as well as the magical significance of moonlight as a trigger.

# Moonlight over the Doors of Durin

As an admirer of J.R.R. Tolkien’s Middle-Earth, I strove to replicate his hidden message on the Doors of Durin, which is the western entrance to the Dwarven city of Khazad-dûm.  These Doors were only visible with starlight and moonlight, and so could not be seen by sunlight during the day.  To generate moonlight I implemented a materials-based approach.  My rationale for this was due to the fact that moonlight has a spectral signature not limited to a single wavelength.  This is quite logical, as moonlight is largely reflected sunlight off the Moon’s surface, and sunlight extends over the entire electromagnetic spectrum. In 1929, French astronomer Bernard Lyot made a volcanic ash mixture with identical optical characteristics as the lunar rocks.  Specifically, he illustrated a near-perfect match of light polarization among the two materials over all phase angles.

I made a model of the Moon by gluing volcanic ashes from St. Helena on a green Styrofoam sphere with a spray adhesive.  The circumference of the sphere prior to applying the ashes was approximately 31 centimeters; after gluing the ashes, the circumference increased to 33 centimeters.  Therefore, on average, the thickness of the ash layer on my model Moon is 2 centimeters.  To elevate the Moon over a surface, I stuck one end of a wooden dowel through part of the Styrofoam, such that my model looked like a lollipop.  The other end of the dowel was put into a green Styrofoam rectangular prism that rested on the table.  Below is a picture of this constructed model.

To compare my model with the actual Moon, I determined the intrinsic brightness of both objects using the equation:

Here, A is the albedo (which is the fraction of incident light reflected off the Moon), H is the absolute magnitude (the brightness of the Moon if positioned one astronomical unit away; this distance is about the distance from the Earth to the Sun: 1 AU = 149,597,870,700 meters), and D is the Moon’s diameter in kilometers.  The Moon’s albedo is approximately 12 percent.  Substituting this value into the above equation and calculating the diameter by dividing the circumference by pi and converting to kilometers (D = 1.0504 x 10-4 km), the absolute magnitude for my model Moon is H = 37.8129.  The absolute magnitude for the real Moon is quoted as HMoon = 0.25.  Objects that are intrinsically brighter than others have a lower absolute magnitude; the absolute magnitude can even be a negative quantity for very bright materials.  It is evident from the above equation that the diameter and absolute magnitude are related in a logarithmic fashion.  To find how many times brighter the model Moon is than the actual Moon, simply take the fifth root of 100

and raise it to the power of the positive difference between the absolute magnitudes.  Thus, the Moon is

≈ 1.06145×1015 times brighter than my sphere made with volcanic ash.

To produce an ink that was invisible under illumination by sunlight but visible under moonlight, I resorted to a contrast scheme.  That is, I applied ink of nearly identical color as the parchment I wrote on.  The catch is that the ink needed to be slightly different than the paper with an additional color component to differentiate between the Sun and Moons’ spectra.  Sunlight consists of equal parts of red, green, and blue components.  Moonlight, however, possesses a noticeably stronger red component and a weaker blue component.  Many people are oblivious of this fact; the reasoning deals with the Purkinje effect, which makes objects in darker settings appear bluer to us, as a result of the rods in human eyes.

Knowing that the Purkinje effect would not prove a significant issue with a light source positioned near my Moon to brightly reflect on my parchment, I tried two different contrast schemes.  One used blue paper with a blue ink that had a tinge of black added.  The second used black paper with black ink that had a tinge of red added.  The inks were mixed and applied using a paintbrush.  Upon writing with the inks, I quickly realized that they had a different color than their corresponding parchments even before the mixing of a secondary color.  Thus, testing was performed to make inks of exactly the same colors as the blue and black parchments.  I began with a rough test, simply adding spoonfuls of primary ink to dabs of secondary ink.  After doing this, I recognized that a stricter method was necessary.  My first attempt to yield a more precise test was to use eye droppers and simply count the number of drops I added of each color.  This plan was squashed, however, upon noticing that the ink was too viscous to exit the droppers.  My alternative approach made use of a scale to weigh quantities of the primary colors; below is a picture of the scale measuring one gram of blue ink.

As mixing a quantity of the secondary color that was undetectable with the scale with several grams of the primary color went very far in changing the resultant color, and understanding that I did not want to devote an umpteen number of grams of primary ink for each trial, I carefully made depressions with a chopstick for my measure of the secondary ink.  Shown below are typical quantities of the two inks; notice the three depressions of the black ink.

Pictures of the ink tests are shown below.  The first picture shows the rough test performed with spoonfuls of blue ink and large dabs of black ink.  All the character sets are labels, each written with one spoonful of blue ink: B is blue (no black), 1W is one spoonful of blue ink mixed with one dab of white ink, 2W has two dabs of white ink,…, 4B has two dabs of black ink, and 5B has 5 dabs of black ink.  Don’t be fooled by the apparent disappearance of the 4W and 5W in the photo.  From the proper viewing angle, they both are quite bright, and clearly not the same color as the parchment.  The second picture validates this assertion.  Notice how bright the 4W and 5W are here.  This picture contains additional tests.  The W on the top right denotes plain white ink, clearly visible in comparison to all other colors.  Looking closely at the middle of the page, one can spot the character sets 1g, 2g, 3g.  These represent grams of blue ink mixed with exactly 10 depressions of black ink.  By my inspection, I determined that the 3g appeared the least noticeable.  Therefore, I used the recipe of 3 grams blue ink mixed with 10 chopstick depressions of black ink to write the hidden message.  The third picture shows testing done with the black ink.  This was less extensive for two reasons.  One, the black ink more closely matched the black parchment to begin with.  And two, by the time I began testing on the black parchment, I had already performed extensive testing with the blue parchment, so I proceeded directly with using the scale.  The code on this sheet is: B- black ink only, 1gB3R- 1 gram black ink and 3 depressions of red ink, and 1gB4R- 1 gram black ink and 4 depressions of red ink.  To write the hidden message, I chose 1gB3R as my recipe, as the extra amount of red in 1gB4R resulted in an ink that appeared more visible in ordinary light, without any noticeable improvement under moonlight.

The secret message I wrote on both the blue and black parchments is the same one that appears on the Doors of Durin.  It is written in the language of the Elves.

Ennyn Durin Aran Moria.

Pedro mellon a Minno.

Im Narvi hain echant.

Celebrimbor o Eregion tethant i thiw hin.

This translates in English as

The Doors of Durin, Lord of Moria.

Speak, friend, and enter.

Celebrimbor of Hollin drew these signs.

Below are pictures of this message written in Elvish on both colored parchments.

To represent the Sun, I employed an LED flashlight with a luminous flux of 37 lumens.  The Sun has a luminous flux of 3.6×1028 lumens; that is on the order of 10 thousand yottalumens (Ylm).  Given that the distance from the Moon to the Sun ranges from about 147 million kilometers to 152 million kilometers, thereby taking a rough average of 150 million kilometers, in order for the ratio of luminous flux to distance to be equivalent for my contrived system, the LED flashlight must be placed approximately 1.5417×10-16 meters from the model Moon.  This is quite fascinating but hardly an issue, as the light loss over reasonable distances of several meters is minimal.

By turning each parchment at an angle with respect to the flashlight, the writing appeared invisible.  Examine the three pictures below for the blue and black parchments to verify this.

To produce moonlight the flashlight was shined on the volcanic ash sphere.  For the effect to be astounding, one should already place the parchment at a viewing angle such that it is invisible with the flashlight shining on it, and merely move the Moon into the light path without shifting the parchment at all.  The two pictures below were taken exercising this approach; the first is the blue parchment and the second is the black parchment, both under moonlight.  Observe that since the Moon I constructed is small in relation to the parchment, the message is not entirely visible.  One must shift the paper towards the Moon to read content on the right-hand side.  Nevertheless, you can still pretend to be Gandalf.

The challenge, of course, is to develop an ink that is invisible under sunlight for all viewing angles, not just a restricted angular range, and that is also clearly seen under moonlight.  I will endeavor to rectify this problem for my final project.

# Deceptive Jail

Webcams give the delusion of transporting a viewer to a new location by displaying a site in real-time with high-resolution and continuous motion.  When examining a site in person, however, a viewer expects to smell the surrounding airs.  Unfortunately, webcams by themselves do not provide this immersive experience.  As a means to both tackle this challenge of heightening sensations with webcams and devise a system to fool criminals, I built a small jail cell that included both visual and olfactory perceptions.  The intent is to constantly change a prisoner’s apparent location, making the prisoner disoriented and confused.  Guards may move the prisoner from the cell to a motion simulator for a multitude of hours to trick that prisoner into believing that travel is occurring.  Under fatigue, prisoners are more likely to be cooperative and divulge information concerning the truths about crimes they committed or the whereabouts/upcoming plans of their criminal partners.  As a last measure, guards could use a webcam of the prisoner’s home, accompanied with appropriate smells, and say to the prisoner, “Tell us everything you know, and we’ll let you go home.”  Having tricked the prisoner into believing the deception, the presentation of the homeland will evoke powerful emotions that will further break that prisoner down.

The jail was built out of nine jigsaw-shaped exercise mats that fitted together nicely on the sides.  A picture of the constructed cell is shown below.  Two holes were cut on one of the mats.  The larger hole was a 25 cm by 15 cm rectangle, sized for my computer screen, in which the webcam would be shown.  To give the appearance of a jail, I cut out some of the mat material and made three short bars and spread these out over this viewing window.  The smaller hole was a thin 16 cm by 3 cm rectangle for the odors to travel through.  Additionally, I positioned a small wooden dowel rod for support on the top mat and also taped down some of the outside connected sections with silver duct tape to prohibit the mats from sliding apart.

To funnel scents through the small hole, I heated water with a Vick’s humidifier and placed several drops of fragrances in the humidifier’s basin.  Steam then rose from the humidifier with the odor of the fragrance.  I was fortunate to find a tall metal piece in the garbage, which was employed as a funnel.  I connected a section of a pizza box to the bottom of this funnel with silver duct tape, applying tape across the entire section to shield it from the moist steam of the humidifier.  A hole the size of the humidifier’s opening was cut out on the pizza box section for the steam to exit.  The system was constructed in the room seen in the above picture.  The measurements were taken such that the humidifier rested on the remainder of the pizza box to prop the funnel up high enough to reach the small hole, as shown below.

For completeness, the entire system, both the jail cell on the left and the humidifier/funnel sub-system on the right, is pictured below.  Notice also the laptop computer with its screen flipped around slid against the viewing window to display the webcam.

Two different sites were tested with appropriate fragrances; one was a forest scene and the other was an ocean scene.  The link for the webcam of the forest scene is:

http://www.bear.org/website/live-cameras/live-cameras/nabc-webcam.html

The link for the webcam of the ocean scene is:

http://www.mamasbeachcam.com/

For the forest scene, a Eucalyptus fragrance was placed in the humidifier’s basin.  For the ocean scene, the fragrance added was Waikiki Beach Coconut.  The picture below shows the two fragrances; Eucalyptus is on the left and Waikiki Beach Coconut is on the right.

The next two pictures show webcam images inside the jail of the two scenes; the first is the forest scene and the second is the ocean scene.

Additionally, I took video recordings of the process of applying the fragrances and watching the webcams.  The forest webcam is fairly static, but while watching the ocean webcam, one can clearly see the waves moving continuously.  The first video below shows the forest scene and the second shows the ocean scene.

A large challenge while testing my system was the excessive moisture buildup from the humidifier, especially around my laptop.  This issue was remedied by applying paper towels and aluminum foil under my laptop for protection.  However, the wall of the cell became sufficiently drenched after about ten minutes of operation.  One possible improvement of the system is to concoct my own fragrances to make the smells as realistic as possible.  For example, for the scent associated with the ocean, I might blend together the juices from canned tuna fish together with salt and sand.  It would certainly prove quite torturous for a prisoner to suffer through this magical potion.

# Pepper’s Ghost

One of the most alluring pieces of equipment I have ever encountered is the phoropter, which is used by optometrists during eye exams to assess a subject’s vision and ascertain that subject’s eyeglass prescription.  The following link offers a description of phoropters, accompanied with pictures: https://en.wikipedia.org/wiki/Phoropter.  As a young child, I recall being pleasantly intrigued by watching my optometrist whirl the lenses and prisms in the device around with ease to alter my view; the swift changes seemed somewhat magical to me.  During eye exams, optometrists place a phoropter over a subject’s eyes and ask the subject to read a series of letters both close up and far away.  They iteratively change the lenses and other optics in the device to deduce the optimal prescription of the subject.  However, to my knowledge, optometrists have not yet implemented the Pepper’s Ghost illusion in conjunction with phoropters.  Since the ghost image is fainter than the object itself, a Pepper’s Ghost eye exam would be more challenging than the traditional one.  This would prove especially valuable for accessing candidates to jobs with strict vision requirements, such as astronauts.

I made a basic phoropter using two circular cut-out pieces of white cardboard and four pairs of lenses.  The lenses are displayed and labeled in the picture below.  As distinguishable from the labels, the types of lenses used were thick positive spherical, spherical meniscus, meniscus, and thin positive spherical.  An interesting aside fact I learned after reading about lenses is that plus lenses are synonymous with convex lenses, whereas minus lenses are synonymous with concave lenses.  Plus lenses are prescribed to fix farsightedness and minus lenses are prescribed to fix nearsightedness.  The two thick positive spherical lenses shown on the far left side of the image refract incident light appreciably, and thus when looking through them, the view appears quite blurry.  I was able to see clearly through the other three pairs, so the thick positive spherical lens pair served as an outlier case.

I traced out the shape of each of the lenses onto the two cardboard wheels with a pencil, such that the center of each lens was 4 centimeters from the rim of the wheel.  Shown below is a picture of my tracings on the wheels.  Scissors were used to pierce through the center of these marked regions and cut the shapes out.  Additionally, I cut out the shape of the largest of my lenses, the spherical meniscus, in two locations on a cardboard box for viewing windows of the ghost image.

Prior to fixing the lenses in place, I cleaned them with rubbing alcohol, rinsed them off with water, and then dried them with wipers.  A hot glue gun was used to securely mount the lenses on the wheels.  A picture of the two wheels with lenses attached is given below.

With the phoropter constructed, I next needed to make the Pepper’s Ghost illusion and position the wheels around the viewing windows I established.  I used a cardboard box to house the object and piece of acrylic needed for the illusion.  Two small holes were cut through the box in the locations where the center of each wheel was to be placed; small holes were also cut through the center of each wheel, as seen in the above picture of the wheels with lenses glued on.  Two large screws were pushed through the small holes on the box and the wheels.  Below is a picture of the phoropter mounted to the box.

Duct tape held the acrylic piece steady inside the box.  The object selected to produce the ghost image was a desk clock.  A clock was chosen because it provided the subject a means of discerning information.  The visual challenge was to look through the phoropter at the ghost image and tell the time, based on the locations of the second, minute, and hour hands of the clock.  The overhead view of the components inside the box is seen below.

In order to clearly see Pepper’s Ghost with my system, the lights were turned off and an LED light bulb was placed overhead the piece of acrylic as an illumination source.  Two shots through two different lens pairs are illustrated below.  The first is through the thick positive spherical lenses and appears blurry and unclear; the view through the right lens is the actual clock.  The second is through the spherical meniscus lenses, and the ghost image of the clock is discernible through the left lens.  The time on the actual clock is 11:01 with the red second hand on second 42; of course, since the ghost image is a reflection, it is inverted to look like the time is 12:59 with the second hand on second 18.

# Visual Effects

By recording video in the overhead camera position, also referred to as the bird’s-eye view, I achieved a visual illusion featuring two actors who seem to defy gravity and temporarily float in air.  The video is shown below.

The video features two wizards dueling with magical wands.  Throughout the action sequence, both wizards perform a levitation spell that portrays his opponent to be suspended in mid-air with his feet removed from the apparent ground.  In actuality, the actors are laying on the floor with their feet against a wall (the apparent ground), allowing each to simply remove his feet from the wall when his opponent launches a successful attack.  A camera operator is standing on top of a tall ladder, approximately six feet from the ground to film the overhead view.  The height from which the scene was filmed was a crucial aspect, as beginning film takes demonstrated that shorter ladders, such as those only two or three feet tall, did not enable a large enough space to be visible with the camera.

Avidemux was used for video editing and Kdenlive was just used to add audio to the edited video.  I carried out editing with two separate programs because for some odd reason Avidemux did not allow me to insert audio; although, Avidemux has the capability of running audio and video together.  During filming, there was a point in which the wizard on the right-hand side pushed his feet off against the wall in a jumping motion.  He then rose from the ground and walked over to the left side of his opponent, laying down again in an upside down fashion with respect to the camera’s view, before casting a final levitation spell.  Editing with Avidemux was done to facilitate the appearance of a surprise attack.  After the jumping motion, I removed video content up to the point in which the wizard on the right-hand side was completely off the screen.  I then kept eight frames of the wizard off screen; when watched right after the jumping motion, it appears that the wizard has vanished.  I then cut out all video content from that point to the point in which the wizard has established his new position behind his foe, so that it appears that the wizard vanishes and instantly reappears ready to attack.  With Kdenlive I added music played with a harp to complement the gentle nature of levitation.

Having never directed a video before, I became aware that it is quite difficult to verbally communicate an action sequence in a way that everyone involved can fully understand.  Although I had written out a script, it was suggested to me that I make a series of drawings to distinctly highlight each individual step in the sequence.  Implementing this new approach proved successful and enabled the actors to practice the choreography in a less hesitant manner.

# Artificial Moonlight

Inspiration for this work came from reading the fantastical books by J.R.R. Tolkien. In several of these books, including The Hobbit and The Lord of the Rings: The Fellowship of the Ring, moonlight reveals hidden doors that are not visible with ordinary sunlight. Thus, I desired to discover how moonlight was physically distinct from sunlight. Literature concerning this topic describes that moonlight consists largely of sunlight reflected off the Moon’s surface, in addition to some minor sources like starlight. It has a lower intensity than sunlight and looks bluish to humans; the blue hue is attributed to the Purkinje effect. To gain insight into how to reproduce moonlight artificially, I implemented a twofold approach. The first part dealt with creating a software program that applied image processing on an input image of an outdoor scene cast in natural sunlight to produce an output image of the same scene in moonlight. In the second part, I built a rudimentary LED flashlight with a moonlight mode using a function generator.

Photographers are able to manipulate their camera settings to make images taken in natural sunlight exhibit the appearance of moonlit scenes. Utilizing many of these same techniques, I wrote a program in Matlab to accomplish this goal. The code for this program can be found at the following link (open with Notepad to see it easily):

https://www.dropbox.com/s/6anvqehn9rx8tio/Moonlight.m?dl=0

First, the images were white balanced; this affected the warmth and coolness of colors in the image. Next, the saturation was decreased to half of its original value, as moonlit scenes are less bright than sunlit ones. Finally, the contrast was increased to widen the difference between low and high pixel intensities. Using the default values for white balancing, calculated from averaging the RGB values, the resultant images were too bright. To remedy this, the white balancing was decreased. Two pairs of images in sunlight (original) and moonlight (calculated from program) are given below. The first pair shows an outdoor scene with a far depth of field, while the second has a near depth of field.

Many LED flashlights have a moonlight setting that is noticeably dimmer than the normal bright mode. I made my own form of this type of light source using a 10V peak-to-peak function generator and a strip of 12V LEDs. I set the frequency to 1 kHz and selected the square wave option. To start, I applied a high peak-to-peak voltage of approximately 9.4V to simulate sunlight. Next, I gradually decreased the voltage on the function generator, dimming the LEDs. Comparing a photograph of moonlight with the intensity of the LED strips, it was determined that a peak-to-peak voltage of 7.2V yielded a luster akin to moonlight. Photographs of the LEDs with an applied voltage of 9.4V peak-to peak (top) and an applied voltage of 7.2V peak-to-peak (bottom) are illustrated below.

# Trick++: Mixed-reality illusion

The illusion I created relied on apparent motion using video. Originally, I applied the technique known as stop motion on a decorative object. Two pieces of tape were put in a cross pattern on a desk to mark the location for the object to be set. With the object positioned on the desk, I took a picture of the scene. Next, I very slightly turned the object clockwise, making sure that it retained its place on the tape, and took another picture. This process of rotating the object incrementally and snapping a picture was repeated until one complete revolution was made. In total, 71 images were taken. A program called 3DRT took these input images and created a GIF file that cycled through them at a rapid rate; this rate was so high that we perceive the succession of images as continuous motion. An online converter changed the GIF file into an MP4 file, which is shown below.

To improve this trick, I sought a means to shed doubt on the implementation of stop motion. My inclination was to insert a second object into the scene and have it appear to move due to gravity. After all, had I resorted to stop motion alone to capture these two movements, I would have needed to take a burst of shots for each position of the rotating object on the desk, and then match each appropriate rotating/falling pair to assemble the video frames; this would be an exceedingly laborious process. I accomplished the introduction of a second object, as a dark orange ball, digitally with the aid of a program called Blender. Using Blender, I imported my MP4 file of the rotating object, created an orange sphere, put the MP4 file and sphere on a timeline, and inserted a series of LocRotScale keyframes while changing the timeline marker and sphere position between subsequent keyframes. I used an Alpha Under blend for the MP4 file and an Alpha Over blend for the sphere. In order to provide a convincing visual appearance of the two objects merged together in the scene, I had the table act as an interaction platform. That is, the ball fell from a high height and appeared to make contact with the table, after which it bounced back to a lesser height before falling once more. A video of the resulting blended scene is shown below.

# Magic in the Wild

At a local video game store, I found the Xbox 360 game “Lego Harry Potter: Years 1-4.”  Here, the displayed message connects the concept of the Harry Potter stories as a world of wizards and witches with the experience one attains by constructing a fantastical world with Legos.