Voice over laser

So now that I have the laser, I might as well try fun stuff out with it. Like modulating the beam. I know hams have experimented with long-range laser communication, so maybe it could even work.

So I built a poor girl's beam modulator. It is, in essence, a sophisticated optical apparatus which I call a "Laser". It consists of a piezo buzzer stolen from a defunct fire alarm, a piece of a makeup mirror I broke, and lots of Blu-Tack, among other things. The piezo buzzer is directly connected to my laptop's audio Line Out, so I can make it buzz arbitrary signals. The piezo makes the mirror vibrate, which causes deviations in the beam's direction. Kind of like a DMD, except not digital nor micro.

[Image: A mess of wires and components attached to a mint tin using blu-tack. A laser module is pointing at a piezzo buzzer at an acute angle. A piece of mirror is glued onto the piezo buzzer. The laser and piezzo buzzer are connected to wires that lead out of the picture.]

The receiver side is situated a short distance away. It is just a simple wide-spectrum photodiode. It connects to another sound card's Line In. When the beam deviates a little, it won't directly hit the diode any more, and this causes the diode voltage to fluctuate. This should allow us to send information over the channel.

[Image: A photodiode attached to a cassette case using blu-tack. A piece of paper is attached to the base of the diode, and a line of red laser light is visible on the paper, also hitting the diode.]

I found a piece of audio with a folk tune in the beginning followed by a lady reading out numbers. I applied a suppressed-carrier single-sideband modulation at 6 kHz, so as to avoid the hum caused by lighting in the room. It's painfully trivial using SoX and Perl, by the way:

open(S,"sox salakalastaja.wav -t .raw -e signed -|");
open(U,"|sox -b 16 -c 1 -e signed -t .raw -r 44100 ".
       "- ssb.wav sinc 6000 -n 4096");
 
while(not eof(S)) {
  read(S,$a,2);
  print U pack("s",unpack("s",$a) *
          cos(($n++ * 2 * 3.141592653589793 * 6000) / 44100);
}
 
close(U);
close(S);

I still need to make some amplifiers. The piezo could take a lot more voltage, but line level only goes so far. Also, the unamplified output of the photodiode is very weak at -90 dB, so we're almost hitting the 16-bit quantization floor. Here's a sine wave being transmitted over the laser:

[Image: Spectral power plot of three signals with no frequency scale. The blue signal has a single peak scaled as 0 dB. The red signal has a -90 dB peak at the same frequency. The green signal only has background noise. Noise floor in all three is at -120 dB.]

However, audio from initial crude testing is actually pretty intelligible. In the beginning, you can hear the 50 Hz buzz caused by flickering lamps, and then me tuning the heterodyne to 6.000 kHz. The noise mostly comes from 16-bit quantization/dithering.

The laser-equipped Lego train

In a previous post I was not very happy with the results of my opto-acoustic capture of the miniature gramophone record, so today I thought I'd try to illuminate the record surface more evenly.

Of course, the straightforward solution is to build a circular LEGO® railroad track around the record and have a laser-hauled train run around the track, illuminating the record surface with coherent light at a constant tangential angle, while a camera captures the image at long exposure.

[Image: A LEGO train engine chassis on a curved LEGO track, with a little laser pointer attached to it using blu-tack and cable ties. The laser is emitting red light.]

This time I didn't want to go through the trouble of positioning the high-resolution camera and only got this:

[Image: A vinyl record illuminated very unevenly with laser beams projected radially, towards the center.]

I learned that Lego is not very good for laser work in general; specifically the trains don't run very smoothly, as you can see in the above pic. Updates with audio will follow, anyway. In the meantime, here's a video.

Bonus points if you can hear what's happening in the background.

Update: I didn't post an audio update, because the audio was useless. And the whole laser thing was a dead end anyway. Instead, I edited the high-res photo I took earlier, removing the extreme shadows using Gimp's Dodge/Burn tool. Then changed my Perl code a bit so that it actually stays on track; the record turned out to contain two interleaved tracks. The result is this:

Now I can put the robot back together and close this case.

Update 7/2017: The saga continues in Gramophone audio from photograph, revisited.

Case modding, the polish way

If you're still using CD-Rs like me, and you store them in cardless "slim" jewel cases, you've probably noticed that text written on the spine is pretty invisible:

[Image: CD jewel cases with text labels hand-written on the backs but mostly invisible because of the lack of contrast between the black ink and the black plastic showing through the transparent case.]

But fortunately there's always that bright-colored nail polish you never actually use.

[Image: The above jewel case backs being painted on the inside with a pink glitter nail polish called 'Maybelline New York Mini Colorama 03 Tutti Frutti'.]

Text appears! It's magic!

[Image: All the jewel cases painted, with the text clearly showing against the now pink glittery background.

A science campus Marauder's Map

There are hundreds of Wi-Fi access points at our campus. They're constantly broadcasting a beacon signal that identifies each station by a MAC address. The signals can be passively received by any Wi-Fi equipped device. Exploiting this fact, I wrote a program to help locate lost students and staff wandering around the campus. I submitted it as a project for my positioning class.

[Image: An indoor map of a building titled 'Exactum K', made to look like the stereotypical 'treasure map' on old paper. Several rooms are labeled. Three placemarks with different colors, drawn in an anachronistically modern style, are labeled with online screen names.]

Before the positioning would work, I could be seen walking around with my computer and mapping the Wi-Fi signal at various places. I would stay in one place for several minutes and collect signal strengths of all devices in range. I would then take each pair of access points and calculate a power ratio every few seconds; then assume a normal distribution and fit a Gaussian curve onto it; and save the Gaussian parameters in a database along with discrete location information input manually. (Kjaergaard, M.B. "Hyperbolic Location Fingerprinting: A Calibration-Free Solution for Handling Differences in Signal Strength", Pervasive Computing and Communications, 2008, Sixth Annual IEEE International Conference on, pp. 110–116)

To determine the position of a computer, a script is run that lists all signal strengths of all stations in range. Again, power ratios are calculated, and the fitted Gaussians are compared to Gaussians saved in the database. A location with the highest probability is determined using Bayesian inference and plotted on a map inspired by the Harry Potter realm.

Hearing 40 APs
┌─────────────────────────────┐
│═                            │  9.417e-217  24 Haxxorointiluokka
│═════════════════════════════│  2.011e-207  28 Navetta
│══════════════════           │  2.607e-211  27 Gurulan sohva
│════                         │  8.437e-216  25 Gurulan pöytä
│═══════════════════          │  8.032e-211  25 Unicafe Exactum (Gurulan puoli)
│═══════════════              │  1.079e-212  25 CK112 takaosa
│══════════════════════       │  1.107e-209  25 CK112 keskiosa
│═════════════════            │  9.121e-212  25 CK112 etuosa
│════════════════             │  1.986e-212  24 Unicafe Exactum (Normaali puoli)
│                             │  0.000e+00    2 BK107
│═════════════                │  4.054e-214  27 D123
│═                            │  6.020e-218  18 C127
│                             │  0.000e+00   12 C222
│                             │  0.000e+00   10 D234
│                             │  0.000e+00    9 Linus Torvalds -auditorio
│                             │  0.000e+00    0 Liikuntakeskus
│                             │  0.000e+00    0 Unicafe Physicum
│                             │  0.000e+00    0 Chemicumin aula
│                             │  0.000e+00    2 Lars Ahlfors -auditorio
│                             │  0.000e+00    4 B221
│                             │  0.000e+00    0 Unicafe Protoni
│                             │  0.000e+00    0 Unicafe Neutroni
│                             │  0.000e+00    5 B222
│                             │  0.000e+00   12 C323
│══════                       │  8.308e-215  25 CK110   
│                             │  0.000e+00    0 Puutarha
│                             │  0.000e+00    0 Kirjasto: yläkerran lukumesta
│                             │  0.000e+00    0 Kirjasto: hiljainen lukusali
│                             │  0.000e+00    0 Kirjasto: alakerran lukumesta (ikk.)
│                             │  0.000e+00    0 Kirjasto: alakerran lukumesta
└─────────────────────────────┘

we're in: --> Navetta <--
done

This is fun but presents a few problems. To get low-level access to the Wi-Fi interface on Linux, iwlist wlan0 scan needs to be run as a privileged user (i.e. root). Also, the prerecorded model of signal strengths gets out of sync with the real world in a few weeks, probably because of minute changes in room interiors. The positioning still works, but room-level resolution is lost. An automatically updating model would be practical, since the manual recording phase is pretty tedious.

The Perl source is on GitHub [hox: for scientific interest only; it's not a complete, working program].

The Atomic-Powered Robot

[Image: A black toy robot standing next to a My Little Pony. The robot has golden ears and arms, a speaker on its chest, and a big round button on top of its head. On its belly, it has a symbol referring to nuclear power. Text around the robot says OMNI, 024-2931:1524, and 2 MODEL-B.]

This is my mechanical baby, Tommy. He's an atomic-powered [sic] robot that can talk and walk around the room. Born in 1984, he's been with me since the early 1990s, but for the last ten years he's been quite ill and not able to talk.

Today I finally fixed him. While doing that, I decided to do a full autopsy for the sake of science, as I've found his vocal cords especially intriguing. So please observe: Tommy's internals. (As with all medical imagery, it's not for the faint of heart.)

Tommy's belly is dominated by a pink-colored contraption that looks like it has a speaker on the front. The pink device gives Tommy his ability to utter the words "I am the atomic powered robot. Please give my best wishes to everybody!" and also make the sound of a laser gun. Below the sound player is the walking motor, which is quite simple and I'm not going to concentrate on it.

[Image: The robot opened up. A bunch of wires go from inside its head down to where its feet are, where some gears can also be seen. In the middle, a big pink box with a speaker in the front.]

Removing the cover of the pink device, we see a large funnel-shaped object that looks a bit like a speaker. It has a tense plastic membrane, like a drumhead.

[Image: Inside the pink box, a peculiar speaker with a translucent membrane.]

Now it gets really interesting. The speaker is resting on a tiny gramophone arm, which is playing a little vinyl record! There's even a simple electro-mechanical end-of-disc detection and arm-return mechanism. The vibrations of the needle are mechanically transferred to the speaker membrane; there's no electric amplification of any kind.

[Image: Still inside the speaker box, a slit reveals a little vinyl record underneath. A gramophone arm and needle are resting on it. Towards the end of the disc, there's a switch that seems to close an electronic circuit when the arm moves far enough.]

Could a gramophone record get any cuter?

[Image: Close-up of the disc being held in the author's hand, removed from the box. The disc is small enough to fit on the palm.]

And here's Tommy sending you his best wishes.

UPDATE: Okay, yeah, he's cute and all. But take another look at the above photo of the record. Don't you think it contains a lot of information about the recording? Perhaps you could even extract the audio from a good enough photograph. Just a silly thought.

Well, let's get to it.

First I'll need a good quality picture of the record's surface. My roommate lended me her expensive camera for this purpose. To get the rough surface evenly exposed, I used an exposure time of 10 seconds with an aperture of f/32. I circled a lamp around the record for 10 seconds and got this cool image.

[Image: A high-resolution photograph taken tangentially towards the record. Grooves are clearly visible as darker lines, and even the recorded signal can be seen as oscillations in the grooves. The end of the record seems to be silent.]

I'll hint the positions of the groove at every turn and then let Perl interpolate a smooth spiral:

[Image: Screenshot of Inkscape with the above image loaded and markers drawn on the spiral groove wherever it crosses the pi radians mark. Next to it, a computer-generated spiral with similar spacings.]

I'm going to read the record along the spiral at 360 RPM and just convert the pixel brightness at every point of the groove into PCM amplitude. This will probably result in something audible, although quite noisy. There appears to be two interleaved grooves: one for the speech, one for the laser sound. The groove gets randomly selected when the robot's head button is pressed, depending on where the needle happens to land. So I made a stereo sound file.

It's very noisy indeed and there's a lot of crosstalk, but something can be heard in the background. After edge detection on the image and some noise removal on the audio:

Update: Further studying of the record and better sound samples in "The laser-equipped Lego train".