Tuesday, March 23, 2010

Looking closely at CDs

I've always been intrigued by the dividing line between the written and unwritten areas on a CD-R. All CD-R formats begin writing in a spiral track starting at the inner radius of the disc and proceeds to the outer radius, so the inner area is written data, while the outer area is still blank. The inner area usually looks lighter in color.

I first placed the CD-R on the microscope stage, bottom-up. This worked at "medium power" 10x, but I could not focus at 40x because the thickness of the CD itself did not permit focusing the 40x objective. Instead, I scratched off a little of the protective coating on the CD top surface, then inspected it from the top.

This is a very old Memorex CD-R. Green-blue dye with a gold top-layer. I lit the CD-R from below with the microscope's built-in light. The image was pretty dark, but by setting the camera exposure to 3 sec, the final image looks great.

Here's a shot of the dividing line between the data area (upper half) of the disk and the blank unused portion of the disc (lower half). The length scale is approximate.



Here is a %100 crop from my camera. The length scale is approximate and computed by dividing the frame height of my camera (13mm) by the microscope objective's magnification (40x), then scaling in GIMP to make the bar an appropriate size for the crop. I checked Wikipedia, and it appears the track spacing for a CD-ROM is 1.6um, so I wasn't too far off.

Sunday, March 21, 2010

Photomicography (microphotography) with Lumix GH1

UPDATE:
I bought a 2x achromatic objective for the microscope and also discovered that positioning the camera closer to the objective by removing microscope parts will increase the field of view (lower magnification). This is very useful since the 4x and even the 2x objective have too much magnification for large insects and similarly-sized objects.

I added photos of a large orb-weaver spider.



Since buying a Lumix GH1, I have been excited to attach it to my telescope, microscope, and any other imaging device so that I can capture unusual photographs. Today, I got all of the parts together and tested it with a microscope for the first time.

The microscope is a Labo VJ-71. It's a decent-quality student microscope with DIN 4x, 10x, and 40x objectives. I also have a remote shutter release for the camera, an LED on a flexible mount for top-lighting, and eyepiece (not needed for photography)



In order to attach the camera to the microscope, I found this microscope->Nikon adapter that I had built years ago. The barrel fits inside the microscope tube and provides a Nikon lens mount. I got the lens mount from a very old, very broken lens. I have a m4/3->Nikon adapter, so I can attach this to the GH1.

The first problem that I noticed was a bright, fuzzy spot in the middle of the image. I removed the camera, and looked down the microscope with all of the adapters in place, but no eyepiece. I could see a lot of light reflecting off the tube's inner walls and this ring of light was landing on the sensor and ruining the image. I added a washer to the Nikon adapter to act as a baffle. This helped, but I also ended up unscrewing the eyepiece tube from the microscope, and inserting the Nikon adapter into the microscope body. This shortened the distance between the camera and the objective, so there was less tube wall to cause unwanted reflections.
I started with this dandelion flower. This image is shot with my Vivitar 28-90, at 28mm


Here is a photo taken directly from the microscope. The objective is only 4x, but as you can see, the overall image is highly magnified. This cluster of pollen parts on the flower is only a few mm in width.

Another problem with microphotography is the extremely shallow depth of field. Even with the 4x objective, there is not much in focus. A neat solution to this problem is to use photo-stacking software, and stack a whole bunch of images taken at different focal depths.
I used CombineZM, a free software tool to do the alignment and stacking:
http://hadleyweb.pwp.blueyonder.co.uk/CZM/News.htm

Neat!


The head of a common house fly. Yikes!









Friday, February 26, 2010

Disassembly of an ASUS VH198T LCD monitor with LED backlight




Linear position tracking with a quadrature encoder

I recently searched the internet for information regarding linear position tracking with quadrature encoders. Surprisingly, there wasn't much available. I didn't find any development kits, blog postings, or other all-in-one information sources. This is strange since position tracking is needed for many applications, and can be done accurately and inexpensively. All inkjet printers, old ball-type computer mice and flatbed scanners use quadrature encoders to track motion (either linear or rotary).

I eventually found this:

http://encodernet.com/products/encoders/incremental/modules/em1/

However, $30 for each encoder, and $15 for each plastic linear strip seems a little excessive. The plastic strips are printed with a series of lines that provide an optical pattern for the sensor to track. These particular strips look like an alignment nightmare since the width of the printed area is so small. They don't seem to offer any kits either.

I also found that a company called Avago manufactures encoders, but not the plastic linear strips ("codestrips") that are required to actually use the encoder. I didn't see any development kits.

Mouser sells the Avago encoders:
http://www.mouser.com/Search/ProductDetail.aspx?R=AEDS-9641-P10virtualkey63050000virtualkey630-AEDS-9641-P10

I chose the AEDS-9641. The suffix determines the coder's resolution limit. I chose AEDS-9641-P10 for 150 lines-per-inch.

After extensive internet searching, I found some 150 lines-per-inch (lpi) plastic strips here:

http://www.goldmine-elec-products.com/prodinfo.asp?number=G15602


These strips almost certainly were designed for inkjet printers. They are called linear code strips, codestrips, encoder strips, etc. They are quite wide, and have the pattern printed nearly across their whole width.
I connected the encoder's phases to my oscilloscope and pulled the plastic strip through the encoder.

OK, that looks great. Now I need to decode and count the quadrature sensor output. Fortunately, Avago also sells decoder chips that are built to work with their sensors, and Mouser carries some of them. I bought the HCTL-2022 and HCTL-2032.


Here I have the HCTL-2022 hooked up to a National Instruments USB-6501. The 6501 reads eight LSBs from the 2022 and displays the count on a graph ranging from 0 to 255.

There are some sharp transitions in this graph because the counter was wrapping around the possible data range as I moved the plastic strip through the encoder. The 2022 chip is a so-called "4x counter", so it registers a spatial resolution that is 4 times higher than the number of lines-per-inch on the encoder strip. It does this by tracking the rising and falling edges for both the "A" and "B" phases on the encoder. So, at 150lpi*4 = 600 counts/inch. The 8-bit range of 255 can cover about 255/600 = .425". For my application, this will be enough.

The system is very stable. I was able to feed the codestrip through the encoder by hand (with unavoidable wiggling and twisting), and the system maintained perfect tracking. The encoder has some plastic bumps that keep the strip in alignment, and this seems to work superbly. Avago says the encoder can count up to 60,000 lines per second, so at 150lpi, this is 400 inches/sec -- pretty fast.

I coupled the HCTL-2022 to an Analog Devices AD558 to provide a nice 0-10V analog output signal that can be sampled at high speed by a National Instruments DAQ device.

Thursday, February 25, 2010

National Instruments USB-6501 minimum sampling interval

I have a project where I need to collect some parallel digital data with a computer and store it in a plain text file. Ideally the file would look like this:

t (s) Value
0.000 130
0.005 127
0.010 126
0.015 127
0.020 200

Value is the decimal equivalent of 8 individual binary data lines.

This data collection could be achieved via the parallel port with custom software, however I'd rather use USB, and I'd also like to collect 2 separate 8-bit signals. I've used National Instruments products before, and figured the USB-6501 might be a good choice for this project. I called NI, and asked specifically about the sample rate. The technical salesperson did not have a clear answer. The best answer was "about 900Hz", but it was unclear whether this referred to the sample rate of a single digital line or all 24 lines that the device provides.


I bought the USB-6501 and tested it out with the included SignalExpress freeware from NI. As it turns out, the minimal sampling interval for two 8-bit signals is about 15ms (eg 67Hz) on my Core2Duo 2GHz with USB 2.0. Yeesh. I think that's pretty lousy, and it will not work for my application.

What's really annoying is that the program will not indicate what the minimal sampling interval is. You just have to take a guess and then run the data acquisition and test it. I also noticed that generating a CPU load on the machine will cause the data acquisition to halt if the minimal sampling interval cannot be reached. So, if you keep lowering the interval, keep retesting, and find that 15ms appears to work, you may find when you start another program or move a window, the CPU becomes ever-so-slightly more loaded and the acquisition will fail. Oops. Overall, the USB6501 is only good for very low-speed applications.

I will continue my project with an NI USB-6008 and use a digital-to-analog converter to convert my 8-bit signal into an analog voltage, then use the 6008 to record the voltage. It seems a little backward, but I cannot see any other low-cost high-speed digital USB devices from NI. Do you have any suggestions?