Les Météores, René Descartes

I was hoping to find a copy of René Descartes treatment of rainbows as part of Project Gutenberg (hopefully in English) but no dice. It does appear that the Université de Québec has the work Les Météores as part of their online collection. It’s far too late for me to work on reading it (my French is pretty rusty, especially without my French dictionary) but I’ll have to have a look at it some other time.

Les classiques des sciences sociales: René Descartes, Les Météores (1637).

Somewhere… over the (simulated) rainbow…

A few days back, I simulated how light propagated in a single drop of water, but with a number of problems. First of all, it didn’t simulate the Fresnel equations, which describe how light is reflected and refracted at the interface between two media. This meant that in my simple model, no light is actually subject to total internal reflection, and no light was scattered back in the direction that the light originated. This is an important effect: without it, you cannot see rainbows. It also assumed a single index of refraction, so we couldn’t see how the reflection and refraction change as a function of wavelength.

So, I decided to fix both problems, and run a simulation to see if I could capture some interesting features of rainbows by direct simulation.

To keep you interested (if possible), I’ll merely give the picture, then explain it. (Click on it to view it full size).

Simulated rainbow reflection, light enters from left, goes to right

It’s hard to see the detail in the area of interest, so here’s a better version, zoomed in (click to view bigger):

This describes the distribution of light in each outgoing direction, assuming light coming in from the left. There are four different plots, ranging from the shortest wavelength (4047 Angstroms, or deep violet) to the longest (7065 Angstroms, or deep red). (Sadly, there isn’t any correlation between the plot color and the wavelength, you have to look at the legend to interpret things properly.) I got these plots by determining the index of water at each wavelength, and then simulating via Monte Carlo techniques the resulting outgoing distribution by tossing 10 million simulated photons at the drop. At each surface interaction, it determines what the ratio of reflected to refracted light could be, and then take one path or the other based upon a weighted coin flip. The final outgoing directions are binned, and we take the log of the count in each bin to produce the distance from the center in the polar plot.

This plot isn’t the most pretty thing you’ll ever see, but you’ll actually find a number of interesting things. First of all, you’ll see that there are two rainbows represented. The inner one is the brighter, and the outer one is significantly dimmer (you might estimate that it contains 1/10 as much energy, since it appears about 1 unit lower and I used log based 10). The inner bow has violet at the inner side, and red at the outer side while the outer bow is reversed (red on the inner radius and violet on the outer radius). There is also a distinct lack of light between the two bows. The amount of light reflected in between the two bows is less than that scattered outside them. This is a phenomenon called “Alexander’s band”.

I thought this was a fun experiment. I could work a bit harder and actually produce the appropriate colors and intensities by some more computer graphics magic. Perhaps that will wait for some other day.

APRS experiment: OpenTracker + Kenwood TH-D7A

On Saturday, I decided that the missus and I needed to do two things: get out of the house and get some exercise, and test my OpenTracker. So, I thought that we’d drive out to Mount Diablo, get a hike around, and then see how well the combination of my TH-D7A and the OpenTracker worked. For added difficulty, I set the TH-D7A to use the “EL” power setting, which is a very minimal 50mw, fed to the mag mount whip on the top of my Expedition.

Here’s the path it recorded:

OpenTracker, Kenwood TH-D7a at 50mw

It worked pretty well, which bodes well for the balloon launch. It suggests that power levels of a couple hundred mw would be entirely adequate for balloon launches.

Khan Academy

I’ve seen the Khan Academy listed a couple of times before, but never really bothered to look at it again until today. I was confused about a minor issue in linear algebra (hey, it’s been 25 years since I took linear algebra) so I surfed over and found the lecture on null subspaces to be clear and easy to follow. The Khan Academy has a huge number of lectures, covering mathematics, economics, physics, and lots of other good stuff. Bookmark it for future reference!

Khan Academy.

Hydropower generator

On hack-a-day today, I saw this interesting link to a small hydroelectric generator. I’ve been interested in DIY/non-centralized generation of electricity for quite a while (without actually developing any serious knowledge about it, mind you) so I found the idea rather interesting. Paul taps water from a stream and uses it to feed a 2 inch water pipe, which eventually gets split into four 1/2 outlets which spray water onto a turbine which drives a low-rpm alternator.

Hydropower generator – Hack a Day.

The hack-a-day article did make one claim which made me pause though: it said it could generate 56VDC at 10A. Really? That’s 560 watts, which seemed a lot. In watching the video, it shows that it can generate 56V (actually AC), but that is without any load. As soon as a load (such as a charge controller) is placed on the circuit the voltage will drop. I’ll work out the math a bit at lunch, but I’d be surprised if you could get much over 100 watts of power. Still, not inconsiderable, and if I had a shack in the woods, it would be a great way to keep the place lit.

It’s also interesting to figure out what the reliability of such a system can be. The turbine is constructed from PVC elbows, and it’s not clear to me how they would handle the stress in continuous duty.

Still, very cool.

iHAB Iowa High Altitude Balloon

I was on the #hamradio channel on IRC this morning where people were watghing the progress of the Iowa High Altitude Ballon (IHAB) operating with callsign W0OTM-4. We saw it drift up to an altitude of about 88K feet, before descending. They had a 20m beacon, an APRS beacon running on 2m, and a cellular telephone tracker. Very cool. Hopefully, they’ll have some photos soon.

iHAB Iowa High Altitude Balloon.

Addendum: Using aprs, i tracked both the balloon and the chase vehicle (callsign W0OTM-2) and showed the complete groundtrack of both. Pretty neat.

Red track is the balloon, Blue is the chase vehicle

On light in drops of water…

A couple of days ago, I linked to an article which talked about using a laser beam as a kind of microscopic projector. The collimated laser light passes into a small drop of water, and then casts the image of protozoa (or other small swimmers) onto the wall. Very cool, but I wasn’t entirely sure what was going on here. The actual physics of the image formation is remarkably complicated, so I thought I’d try to understand it more or less from first principles.

Warning: I could be totally wrong about this stuff. While I have all the right books to figure this stuff out, I haven’t dug them up or consulted them beyond some minor exploration of a couple of formulas.

I began by ignoring the wave theory of light entirely (which won’t get us very far, but it’s where I’m starting). What does the distribution of light look like when it is refracted through a spherical drop of water? I looked up the index of refraction for water (around 1.33) and wrote a simple 2D raytracer which uses Snell’s law to trace rays through a sphere. Here’s the result:

A collimated laser beam hitting a spherical drop...

A couple of things to notice: the beam doesn’t converge inside the water droplet: it is “focussed” in a region outside the sphere. It isn’t focused to a single point, it exhibits classic “spherical aberration”: the rays which hit the drop at different vertical positions cross the horizontal axis at different locations. This raytrace also implements what is known as “total internal reflection”: when a ray passes from a dense (say water) medium into a less dense medium, there is a critical angle where instead of refracting, the ray is reflected. It is a rather interesting quirk that this situation doesn’t occur in this hypothetical situation: all the rays hit the far side of the sphere at angles below the critical angle, and therefore exit the sphere after just two air/glass interactions.

If we zoom far back, we can see what the distributions of light should be:

Same diagram, zoomed way back...

The light is scattered in a smooth lobe out the far side of the laser. In Alan’s photos, you can see a very bright spot, which I suspect is caused largely by the fact that the droplets he was examining where very much smaller than the beamwidth of his laser, and you are simply seeing spillage around the laser light.

I was originally confused because I was thinking there simply had to be rays in this simple setup which would exhibit total internal reflection. My thinking was that rainbows appear opposite the sun in the sky, so there has to be a reflection to get light back into your eye. But the mechanism of this propagation isn’t by total internal reflection, it is governed by the Fresnel equations. Whenever light passes between two media which have differing refractive indices, both reflection and refraction may occur. The critical angle of Snell’s law is simply a subset of the behavior described by the Fresnel equations. Fresnel’s equations predict the reflectance and transmission at interfaces based upon the angles and media. Using this, you can determine that even at angles which are normal to the surface, you get some reflectance (in the case of air/water, about 2% of the light is bounced back). It is this Fresnel reflectance on the interior bounces which is apparently responsible for the appearance of rainbows.

(Of course, rainbows rely on the fact that the refractive index of a material is wavelength dependent. Our laser is essentially a single wavelength, so we won’t ponder it further now).

Anyway, back to the laser projector. It was apparent to me from the original video that there were significant diffraction patterns around each Protozoa, and Alan’s video (with much smaller critters) is primarilly full of diffraction patterns. It is my believe that most of the light passing through these drops is actually propagating via diffraction (much like Gabor’s inline holograms) rather than simple projection. The laser beam doesn’t form a small point inside the droplet, it is much closer to being a single collimated beam. This means that potentially the methods used for digital inline holography could be applied to this very simple experimental setup.

More thoughts on this as they occur.

Morning Commute with OpenTracker+

So, this morning I decided to give my OpenTracker another run, both to get a feel for how some of the parameters worked, as well as just trying to find out how complete the coverage is here in the Bay Area.

For this test, I first modified the APRS symbol to stop being the balloon that I had yesterday (symbol “/O”) and switched it instead to the car icon (symbol “/>”). I also turned on “smartbeaconing”, (described here) so that it would beacon more frequently as my speed increases, and also beacon when I made turns of more than 28 degrees. I then embarked upon my commute. It worked pretty well, with a few caveats.

On the main highway, coverage was in general excellent, but in the areas directly surrounding my home (which has quite a few hills) the coverage is much spottier. Even where coverage is good, most of the digipeaters here me are across the bay on San Francisco peninsula or are north, with distances that are quite large (and perhaps surprising, given the fact that I am transmitting with only 5w of output power). I’m wondering, is there some way to locate all the digipeaters that are active in a given geographic region? I’m interested in terms of my balloon planning: while I am going to be carrying an APRS equipped mobile rig in the chase vehicle, it would also be nice to know that our data has a good chance of making it to the APRS-IS network so that people could track it over the Internet, and to serve as a backup for our mobile operations.

Anyway… more on it all later.

A Project from the Past: My OpenTracker+

Over a year ago, I blogged that I had assembled a bit of amateur radio gear, the OpenTracker+. This little gadget has a couple of DB-9 ports on it. The first is used to connect to a GPS, and the other to a radio, such as my Kenwood TH-D7A. Together, they form a tracker: the gps provides positioning, which the OT1+ encodes into a packet radio signal and sends via the HT.

Back then, I had it roughly hooked to my Garmin GPS 18 LVC, but I didn’t do a lot of testing with it (I didn’t wire up the proper power supply cabling and the like), but lately I’m trying to get back onto the possibility of doing a high altitude balloon launch, so I dusted it off and decided to get it all working again. Since I built it, Argent Data Systems has begun to sell a nice little compact GPS, the ADS-GM1, which simply plugs into the open tracker, so I went ahead and ordered one, along with the radio/power cable designed to work with my Kenwood HT. I don’t really think that I am going to send this precise hardware into space (it’s rather bulky compared to what can be achieved now) but it will give me experience with the OpenTracker, which has a smaller SMT based version that I could use.

Stay tuned for some smoke testing later.

Addendum: It works! I hooked it up to my TH-D7A, and drove it around for bit. I didn’t bother to calibrate the audio levels very well, but it seems like it works pretty well. Here is a log of the packets received at findu.com for K6HX-9. The voltage varies as I start and stop my car, while the temperature (23C, or about 73F) stays pretty constant (it was a nice day today).

K6HX-9 on a trip to the frozen yogurt shop via my OpenTracker+

Old Glory, in Postscript

I needed a graphic of a flag that I could scale to whatever size I needed. About 10 minutes of Postscript hacking with the specifications in Wikipedia yielded the following results:

Sadly, the syntax highlighter that I have here doesn’t know about PostScript, so I’ll just have to add it here.

%!PS
%
%
% PostScript program for generating an image of the US Flag
% Generated by implementing the specifications which are listed on
% the wikipedia page:
%
% http://en.wikipedia.org/wiki/Flag_of_the_United_States#Specifications
%
% by Mark VandeWettering

/inch {72 mul} def

/Hoist 1.0 def
/Fly 1.9 def
/UnionHoist Hoist 7 mul 13 div def
/UnionFly Fly 2 mul 5 div def
/WidthStripe Hoist 13 div def
/F 0.054 def
/G 0.063 def

/StarDiameter 0.0616 def
/StarRadius StarDiameter 2 div def

% When a regular pentagon is inscribed in a circle with radius R, its
% edge length t is given by the expression:
% t = 2 R sin(pi / 5)
% PostScript does sin in degrees, so we need 180 instead...

/StarSide StarDiameter 36 sin mul def
/StarDiagonal StarSide 5 sqrt 1 add 2 div mul def

/white {1 1 1 setrgbcolor} def 
/red {0.698 .132 .203 setrgbcolor} def
/blue {0.234 0.233 0.430 setrgbcolor} def

% draw a star at the cursor position...

/stardiagonal {
	StarDiagonal 0 lineto
	currentpoint translate 
	-144 rotate
} def

/star {
	gsave
	exch StarDiagonal 2 div sub exch 
	StarRadius 18 sin mul add
	moveto currentpoint translate
	4 { stardiagonal } repeat closepath
	fill
	grestore
} def

% draw the border...
/Flag {
    gsave
    0.001 setlinewidth
    Fly 2 div neg Hoist 2 div neg translate
    0 0 Fly Hoist rectstroke
    % paint in the bg, just in case
    white
    0 0 Fly Hoist rectfill
    % paint in the red stripes...
    red
    1 2 13 { 
	1 sub
	WidthStripe mul 0 exch Fly WidthStripe rectfill
    } for
    % draw in the union...
    blue
    0 Hoist UnionHoist sub UnionFly UnionHoist rectfill

    % now, the stars, easiest to do in two passes.
    gsave
    0 Hoist UnionHoist sub translate
    white
    1 2 9 {
	/y exch def
	1 2 11 {
	    /x exch def
	    x G mul y F mul star
	} for
    } for 
    2 2 8 {
	/y exch def
	2 2 10 {
	    /x exch def
	    x G mul y F mul star
	} for
    } for 
    grestore

    grestore

} def

8.5 inch 2 div 11.0 inch 2 div translate 4 inch dup scale

Flag

showpage
quit

Enjoy.

Addendum:

Oh, incidently, you can use The Gimp to convert this from PostScript to a normal graphics format like the PNG file above. It will even do some antialiasing to make the jaggies look better. Very nice.

Pictures of the Blum Blum Shub Random number generator…

A couple of years ago, I did a post about the Blum Blum Shub random number generator. I was watching Psych, and bored, so I decided to just make a picture of the random bits generated when I generated two 50 digit primes. Without further ado, or explanation, check it:

There do indeed seem to be very little pattern in it. Although if you knew the two primes that I used, you could generate the value of not just any bit here, but any bit in the future too.

Time for bed.