Megapixel images from an analog SEM

I recently posted my first batch of photos from Milly. While I am happy with her beam performance, I was dissatisfied with the digital photo quality.

Until now:

It's amazing what a difference a $0.50 cable and some math can make!
It’s amazing what a difference a cheap cable and some math can make! Click the image for full resolution.

The inset NTSC image was taken with a USB frame grabber on the CRT port. The bigger image was taken not with a $1k data acquisition module, but with an audio cable, a resistor, and a sound card.

Analog to digital

Milly is a JEOL JSM-6320F, an instrument from another era. That F is important. It means she uses a field emission gun rather than a thermionic filament (like Meryl). This gives you significantly more control over the beam current, and ultimately, brighter pictures at deeper magnification.

But Milly is predominantly an analog device.  While she sports “digital storage”, the on-board memory can only hold four frames, which are lost when the scope is powered off. There is a SCSI option for a 30MB hard drive, but I haven’t had any luck getting it to recognize a drive. According to one forum post I found from 1993, the files would be in an “obscure and difficult” format even if I could read them.

So to get digital photos from her, I could either take crappy pictures of the screen, or put a cheap NTSC frame grabber on her CRT mirror port (tip of the hat to Glen MacDonald from that same post for pointing out which port to use!)  This makes taking photos really easy, but it limits the resolution to NTSC (about 500 lines).

At first I took the second route, and ended up with a bunch of pretty (but tiny) screen captures. There had to be a better way.

Hard Copy

Her intended output device is a Polaroid camera attached to a CRT. You put in a sheet of film and set the scope to do a time exposure, and it scans the film one line at a time. The Polaroid adapter is the little black box on the right of the main console:

No school like the old school, I guess...
No school like the old school.

Even if I could find the proper film, I would end up with a useless hard copy. I would then need to scan it right back in so I can share it online. That way lies madness.

While the NTSC frame grabber can’t cope with the signal on the photo CRT, I could always sample it with a “scientific” data acquisition device. These modules are designed to minimize latency and artifacts, to produce the most accurate possible representation. This is critical for manufacturing and scientific applications, where a difference of a few nanometers can make or break a project. But if I just want nicer photos, the cost of these beasts ($1k and up) is out of the question.

Slow down there, pixel clock

According to the manual, the  film is scanned at up to 1940 lines of resolution, in a programmable period of up to 320 seconds. What would it take to sample that directly, assuming a 4:3 aspect ratio? Let’s do some pixel math:

1940 lines * 4/3 = 2587 pixels wide
1940 * 2587 * 1/320 fps = 15,684 pixels/second

Only 15.6 kHz? Really? A sound card can sample that a couple of times over at 24 bpp without breaking a sweat. Contrast that with NTSC and its 30 Hz refresh rate:

525 lines * 4/3 = 700 pixels wide
525 * 700 * 30 fps = 11,025,000 pixels/second

Even though it’s a much smaller frame, the 30 Hz refresh rate pushes the pixel clock up over 11 MHz. No way a sound card can keep up with that, which is why faster ADCs exist for video sampling.

Audio to Video

So I dug into the old box of audio cables and found a 3.5mm to RCA cable. I had a bunch left over from my bullet time camera rig project (one came free with each camera).

I connected the photo signal to the left channel and the horizontal sync signal to the right. I also added a couple of high-value resistors to limit the current and hopefully avoid damaging the scope. Then I hit the PHOTO button, and made a WAV file recording at 48 kHz.

I ended up with a 50MB WAV file full of data.

I had to turn the gain way down to avoid clipping. Adding a potentiometer to tone down the input volume would probably be a good thing.

You might dig the sound, if you're into relentlessly repetitive industrial.
Ah, the sound of boron. You might dig it, if you’re into relentlessly repetitive unbalanced industrial music.

The next step was to turn it back into a picture. I used numpy, audiolabtifffile, and about 4 lines of python.

Here is the shot as captured with the NTSC frame grabber:

Boron x2200, NTSC quality.
Boron x2200, NTSC quality.

And here is my first attempt at wav2tiff:

My first attempt. Terrible, no?
My first attempt. Awful, isn’t it?

There are so many problems! The aspect ratio is wrong. The sync wanders all over the place. I’m missing half of the contrast depth. And what is all of that extra junk on the right?

Fortunately, these are all software problems. I added a few more lines of python, scaled and cropped it appropriately in Photoshop, and ended up with this:

Much, much better.
Ohai, boron!

Much cleaner! That’s a 3.4 megapixel image, scaled to fit on this web page. Click it to zoom all the way in.

I believe the black streaking effect is due to poor brightness and contrast settings. Since this is a time exposure, there is a lot more charge on the sample, making it brighter and a little overcharged. While the settings were fine for the NTSC fast scan, they’re too bright for a 320 second exposure.

You can see a similar effect on my earlier shots of pollen taken with the NTSC grabber. I think I simply need to turn the brightness down.

I’ll post more shots (and code) soon.

Big SEM: online

I recently got Milly the big SEM online. She had a ton off issues that I’ll chronicle in future posts. But rather than dwell on her past, let’s see what she can do.

Remember that 2mm stainless screw?  Here it is again, with my finger for scale:


And here is the gap between two threads, up close and personal:

Extreme closeup!

Here are some more samples. We’ll look at the stuff on the right-hand strip for now:

Eight samples for Milly. We'll look at the ones on the right for now.

They are (from top to bottom):

  1. Pollen from a random tree (not sure of the species). Those pods contain the pollen; the actual pollen is too small to see in that shot.
  2. dandelion seed. The SEM photos are of the bushy head and a single fiber.
  3. Highly ordered pyrolytic graphite (which we’ll skip for now)
  4. Crystalline boron


pollen, x450

pollen, x1200



Dandelion seed head



Dandelion seed fiber







Crystalline boron







I’m still learning how to use Milly as a camera (so many variables!) but I’m really pleased with this first batch of shots.

Getting better contrast on organics will be a lot easier once I get the sputter coater online. There are a bunch more photos (including hematite and more) in the gallery.


Laser HV repair

I’m in the process of upgrading the brain in the laser from a cheap (and recently deceased) Chinese special to a new design based on the open source Lasersaur. More on that later.

I was right in the middle of testing my new design when the laser suddenly stopped firing. Apparently it was time for the HV supply to pack it in. The cause? A dead thermistor.

Can you spot the trouble?
Can you spot the trouble?

It looks like this one was being used to limit the inrush current at the bridge rectifier. Apparently it died a sudden and spectacular death.

I took a look around the shop and happened to find an old junked server supply with a very similar looking thermistor in it.

Could this part do the job?
Could this part do the job?

After finding the datasheets for the dead 5D-13 and the spare 15SP M005, it turned out that they were largely compatible.

5 Ohms at 25C is good enough for me.
5 Ohms at 25C is good enough for me.

So I swapped in the 15SP and fired up the supply.

The question is, do we have a charge?
But more importantly, did we get a charge?

Success! We have sparks. Now to reinstall it and resume robot brain surgery.

The real question is, why did it fail? I think some research into the switching frequency of the Lasersaur and the capability of this cheap supply are in order.

Tomorrow we bake

Milly is coming along nicely.

I believe we’re over the vacuum difficulties. She’s buzzing along at a nice deep vacuum in the SPEC, INT, and GUN chambers. Last night the computer finally booted up without the dreaded CHECK VACUUM alert.

Finally, a new and excitingly different error message!
Finally, a new and excitingly different error message!

Next up will be an extended 30 hour bake session to try to revive the emitter. I don’t trust her to run the heater unattended, so I’ll be staying over at the shop to keep an eye on things.

This is the specimen chamber pressure. The gun is all the way down to 5e-11, pre-bake!
This is the specimen chamber pressure. The gun is all the way down to 5e-11 kPa, pre-bake!

Keep your fingers crossed. With any luck I might have some images to post on Sunday evening!

SEM FTW: Meryl lives again

Happy Holidays!

Here is a 2mm stainless steel screw. It’s sitting on a standard, non-shrunken quarter for scale.

This screw is just 2mm across, and is about as long as the LIBERTY on a quarter.
This screw is just 2mm across, and is about as long as the LIBERTY on a quarter.

Here it is under Meryl’s beam at the lowest possible magnification.

2mm screw at 35x. The bar scale at the bottom shows a reference line 0.5 mm long.
2mm screw at 35x. The bar scale at the bottom shows a reference line 0.5 mm long.

Those threads are barely visible to the naked eye, but even at low magnification the stainless shows signs of galling.

Let’s enhance.

The tip of each thread is just over .06mm, but the edges have obvious surface variation.
The tip of each thread is just over .06mm, but the edges have obvious surface variation.

At this magnification, the tip of the thread looks a bit like lumpy clay.

Can we get closer? Of course.

At 1100x, a single thread on this tiny screw looks like a vast chasm.
At 1100x, a single thread on this tiny screw looks like a vast chasm.

Steel is a decent electrical conductor, so it’s relatively easy to image. Insulators (like most organic matter) are a lot tougher to shoot without special processing (such as sputter coating).

Here is a seashell:

I bet this little creature never expected to be shot with an electron beam. That's life, I guess.
I bet this little creature never expected to be shot with an electron beam. That’s life, I guess.

Here is the same shell at low magnification:

At low magnification, the shell resembles a diabolical, Giger-esque landscape.
At low magnification, the shell resembles a diabolical, Giger-esque landscape.

See the jets of “water” shooting off of the spikes to the left? That’s not photoshop, that’s physics.

As the electron beam scans the surface, the shell (being a poor conductor) accumulates charge. Over time the shell becomes more negatively charged. Like charges repel, so the electron beam is deflected.

The field in the shell will be strongest in the places with the strongest curvature (the tips of those spines). Since we’re using the beam to make the image itself, that’s exactly where the image will be the most distorted.

Apparently this shell has the ability to warp spacetime. Maybe I'd better back off...
Apparently this shell has the ability to warp spacetime. Maybe I’d better back off…

At higher magnification the problem only becomes worse.

I’m glad Meryl is finally taking decent (if not quite breathtaking) photos. If you could look at whatever you wanted under an SEM, what would it be?

Next project: a DIY sputter coater!

More SEM photos

Resurrecting a roughing pump

Meryl was a little disheveled when she arrived at the shop. She had been in storage for a few years, and while mostly complete, she looked a little ragged around the edges.

Where do all the wires go?
Where do all those wires go?

Fortunately she arrived with a full set of schematics and manuals. Less fortunately, they look like 5th generation faxes and are written in a charming Japanese-English patois.

Do not adopt an unreasonable posture when reading this documentation.
Do not adopt an unreasonable posture when reading this documentation.

The first order of business was getting the column connected to the main console. I was extremely fortunate that the cable ends were meticulously labeled, so this was mostly a matter of plugging the proper connector into the proper board.

Dozens of twisted pair, ground strap, and coaxial connections later, I finally ran out of things to plug in. The umbilical cord connecting the two consoles was getting to be pretty impressive.

I guess Wi-Fi wasn't an option on this scope.
I guess Wi-Fi wasn’t an option on this scope.

With everything connected and tidy, I was finally ready to power her up for the first time.

As I made connection after connection, I was humming 'Daisy Bell' to myself... backwards.
As I made connection after connection, I was humming ‘Daisy Bell‘ to myself… backwards.


I carefully adjusted the variac to 100V and threw the main breaker. The lights dimmed, and a satisfying hum came from the machine.  She lived!

And 20 minutes later, she died. The Vent and EVAC lights were flashing, meaning that a rough vacuum could not be drawn down to the point that the diffusion pump would take over.

Time to debug.

A poor vacuum could be due to a bad seal. But there were dozens of seals to check, and disturbing a perfectly working vacuum seal is just asking for trouble. At this point, I wasn’t even sure if the roughing pump was working as well as it should. I decided to start there.

Vacuum pumps really suck. But how much?

Meryl’s roughing pump is an oil-sealed rotary vane pump. It’s a pretty simple device, essentially a motor connected to rotor in an oil-filled chamber. The rotor has a series of vanes that grab a little bit of air at a time and compress it towards a discharge port. When the pressure is high enough, a valve opens and releases it to the atmosphere.

Roughing pumps like it rough and covered in oil.
Rotary vane pumps like it rough and covered in oil.

This pump was already leaking a little oil out of the bottom, but it seemed to run well enough. But was that well enough? I didn’t have a proper vacuum gauge handy, so I had to get creative to see if the pump was the source of the problem.

Experiment #1: vapor pressure of water

One simple test of the vacuum would be to see if I could boil water at room temperature. The vapor pressure of water at room temperature is around 17 Torr (regular atmosphere is around 760 Torr). If the pump could evacuate a chamber with a little water in the bottom and cause it to boil, then the vacuum must be at least that strong.

It was.

Boiling water at room temperature. Don't ask about the bottle.
Boiling water at room temperature. It boiled vigorously just after I snapped this photo.Yes, we were wearing safety glasses. Don’t ask about the bottle.

So the pump could make it down to < 17 Torr. But how much less? And would it be enough for the diffusion pump?

Experiment #2: use your brain

After some reflection, it occurred to me that I did in fact have a vacuum gauge handy– the Pirani gauge on Meryl herself!

By a stroke of luck, the gauge fit neatly inside the vacuum hose on the pump.

Gauge, meet pump.
Gauge, meet pump.

By connecting the gauge directly to the pump, I could bypass the entire microscope (with all of its potentially leaky seals) and see if the pump could pull hard enough to make the system happy.

It couldn’t.

Test point #3: Pirani gauge output.
Test point #3: Pirani gauge output.

The ever-polite and inscrutable manual informed me that TP#3 would show the voltage reading of the Pirani gauge… But what was the expected range? No word on that.

Digging through the schematics, I miraculously found a sticky note with some voltages scrawled in pencil indicating that the diffusion pump wouldn’t be happy until the Pirani read 2.5 volts or higher.

The pump could only pull it up to 1.8V.

Problem identified!

Time for an oil change

Reasoning that the pump had sat for quite a while, it was probably long overdue for an oil change. But what kind of oil?

It had come with a mostly empty jar of TKO-19 Ultra Vacuum Pump Oil. Sounds expensive, no?

A quick Google around showed that it was not only expensive, it was discontinued. A couple of forum posts suggested replacing it with a more recent, equally expensive formulation.

A little more digging around turned up the MSDS sheet for TKO-19 Ultra Vacuum Pump Oil. Contents: ~100% mineral oil, < .001% vitamin E.

Ten dollars and a quick trip to Wallgreens later, and I had my pump oil.

Clever, but would it do the trick?

It did.

2.566 Volts! Even better than 1.21 Gigawatts!
2.566 Volts! Even better than 1.21 Gigawatts!

I reconnected the pump to the rest of the system, fired it up, and it pulled down to a nice deep vacuum. 20 minutes later the diffusion pump kicked in, and it pulled down even further.

20 minutes after that, I had my first electrons on the screen!

A bit like staring into an abyss. Get used to that feeling, it's a long way from power-up to imaging...
A bit like staring into an abyss. Get used to that feeling, it’s a long way from power-up to imaging…

Surely with the vacuum system repaired I was well on my way to taking stunning SEM photos. Even if all I could see at the moment was vague static.


I still had yet to reckon with Windows NT 4 and the dreaded frame grabber from Hell.

A tale of two microscopes

I recently became the proud owner of a couple of discarded JEOL scanning electron microscopes. The big one (“Milly“) is a JSM-6320F from the early 1990s. The little one (“Meryl“) is a JSM-5600 from the early 2000s.

Milly the SEM.
This is Milly. She’s large and in charge.
This is Meryl. She may be small, but I wouldn't cross her.
This is Meryl. She may be small, but don’t let that fool you. She’s plenty of trouble.

They sat in storage for about five years, and the previous owner had a lot of trouble getting them running again. That trouble has now passed on to me, and I’m in the process of restoring them to their former glory.

Where to begin

Of the two, Milly is a lot more technically interesting. She uses an FEG emitter (requiring an ultra-high vacuum to operate). She has an SEI imager and an X-ray backscatter detector, and was once capable of producing extremely impressive images at about 1nm resolution.

On the downside, she’s a little complicated. Her vacuum system uses two roughing pumps (not supplied), two diffusion pumps, and three ion pumps. Getting the vacuum down below 10-9 Torr requires perfect seals and a finicky bake-out process. Her power requirements are a little fancy. And being late 1990s technology, her “computer” looks like something used on one of the Apollo missions.

Old console is old.
This console features not two, but three CRTs (counting the Polaroid film scanner tube).

In addition to these challenges, I’ve never actually used (let alone worked on) an SEM. While Milly might eventually take stunning images, I have a feeling that the road to getting there may be a long one.

Lucky for me, Milly has a little sister.

And then there’s Meryl

Meryl is a much simpler SEM. She uses a thermionic emitter (a simple tungsten filament) rather than an FEG. She doesn’t require UHV, so her seals are simply rubber gaskets. There is only one roughing pump (provided!) and a single diffusion pump. She only needs 100V AC, which is easily converted from standard 110 with a supplied variac. She only takes up about half the space of her big sister. Best of all, she even came with a few spare parts, which considering my inexperience, I fully expect to install.

Oscilloscope says... not enough vacuum.
Does the patient have a pulse? Pirani gauge says… not yet.

Watch this space for updates as the great microscope adventure unfolds.