The Smell of Molten Projects in the Morning

Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.

Category: Photography & Images

Taking & making images.

  • Casio EX-Z850 Camera Button Failure

    The Casio EX-Z850 camera living in my pocket finally developed a problem. Two buttons on the back select the Review and Camera modes; the former stopped working, which means I can’t see pictures after I take them. The Camera button may still work, but because I can’t display pix, that’s pretty much moot.

    Taking the camera apart require a Philips 00 screwdriver bit and some care, but eventually you’re confronted with this:

    Casio EX-Z850 camera - opened
    Casio EX-Z850 camera – opened

    The buttons and the mode selector dial all connect to the same flexible PCB substrate, which ends up in this connector. You should ease the black pressure bar (seen edge-on here) upward to release the flex PCB:

    Casio EX-Z850 button connector
    Casio EX-Z850 button connector

    As it turns out, the two buttons have a common contact that’s the second trace from the top in the flat cable. Both buttons have good snap action, good conductivity, and seem to work fine. That puts the problem deeper inside the camera, where I don’t see much point in going; I can certainly make things much worse and likely not make them any better.

    In fact, it turns out that the two buttons on the USB/charging cradle don’t work now, either, which implies that the camera buttons run in parallel with those. So there’s something blown in the camera’s guts, which is definitely Bad News.

    Back in the Bad Old Days, you used to take a picture and wait a week or two to get the results back from the drug store. Perhaps it’s fashionably retro to have a digital camera without a Review mode?

  • Look Alive!

    You know how, in those old cartoons, whenever the vultures started landing in nearby trees, that was an indication of trouble ahead for the hero?

    Turkey Vulture in pine tree
    Turkey Vulture in pine tree

    The local Turkey Vulture flock has a roost a few miles away and they’re often seen circling in the thermals overhead.

    A few years ago I encountered one dismantling a squirrel flapjack on the road:

    Vulture dismantling squirrel
    Vulture dismantling squirrel

    It’s an ugly job, but somebody’s got to do it…

     

  • Microscope LED Ring Illuminator

    A batch of LED ring lights arrived from halfway around the planet and I’d earmarked one for a microscope ring illuminator, despite the crappy color spectrum of white LEDs. It’s better than the fluorescent desk lamp I’d been using up to this point.

    This shows the business end of the LED ring light, which would probably look better more professional without the full-frontal Barbie color scheme:

    Microscope LED Ring light - snout view
    Microscope LED Ring light – snout view

    It’s less overwhelming from the top:

    Microscope with LED illuminator
    Microscope with LED illuminator

    The power cable came with the ring. I unsoldered it, fed the end through the shade, resoldered it, snipped off the automobile lamp adapter, wired it to a switch and a 12 V 200 mA wall wart, and hot-melt-glued the switch to the microscope. Yet another vampire load, alas.

    The two parts must be printed separately to eliminate any problem with overhang, as the finished widget would have vertical walls on both sides. I thought about support material, realized that would be a lot like work, and split the thing into two parts.

    LED ring light - mounting plate and shade
    LED ring light – mounting plate and shade

    The walls on the shade ring show the same backlash problem that cropped up there; I built these before tweaking the belts.

    The mounting plate screws into the microscope’s accessory thread:

    Microscope LED Ring Light - Mount Plate
    Microscope LED Ring Light – Mount Plate

    Admittedly, “screws into” may be an exaggeration: the mount is just a cylindrical feature slightly larger than the microscope’s minor thread diameter; it’s barely more than a snug friction fit. I clipped out four small sections to allow that ring to bend slightly as it engages the threads.

    A shade contains the LED ring and keeps direct light off the objective lenses. There’s a tiny hole on one side to let the power wires out:

    Microscope LED Ring Light - Shade
    Microscope LED Ring Light – Shade

    The two parts got glued together with the same ABS-in-MEK gunk that I apply to the aluminum build plate:

    Clamping LED ring light parts
    Clamping LED ring light parts

    I applied three blobs of hot-melt glue inside the shade, lined up the LED ring’s power wire with the exit hole, and smooshed it into place. Pause for a breath and it’s done!

    The result actually looks pretty good, despite the weird yellow-and-blue spectrum you get free with every “white” LED. I reset the camera’s color correction using a white sheet of paper. This is an ordinary M3 socket head cap screw, familiar to Thing-O-Matic owners everywhere, and a tweaked needle-point tweezer:

    Sample image using LED ring light
    Sample image using LED ring light

    The microscope camera mount works surprisingly well, particularly given how simple it was to build.

    The OpenSCAD source makes the shade walls a bit taller than you see above. When I run out of pink filament, this one’s on the rebuild list!

    // Microscope LED Ring Illuminator Mount
    // Ed Nisley - KE4ZNU - Mar 2011
    
    // Build with...
    //	extrusion parameters matching the values below
    //	2 extra shells
    //	3 solid surfaces at top + bottom
    
    Build = "Ring";					// Mount or Ring
    
    // Extrusion parameters for successful building
    
    ThreadZ = 0.33;						// should match extrusion thickness
    WT = 1.75;							// width over thickness
    ThreadWidth = ThreadZ * WT;			// should match extrusion width
    
    HoleWindage = ThreadWidth;			// enlarge hole dia by extrusion width
    
    // Screw mount dimensions
    
    MountOD = 46.85 - ThreadWidth;		// Microscope thread diameter (thread minor)
    MountDepth = 2.5;					// ... length
    MountID = MountOD - 6*ThreadWidth;	// ID of mount body -- must clear lenses
    
    echo(str("Mount ID: ",MountID));
    echo(str("Mount OD: ",MountOD));
    
    PlateThick = 3*ThreadZ;				// Thickness of mounting plate beyond rings
    
    echo(str("Plate: ",PlateThick));
    
    // LED Ring holder dimensions
    
    RingID = 54.0;
    RingOD = 71.0;
    RingFit = 0.5;						// radial gap from ID and OD
    
    InnerShade = 6.0;					// Shade walls around ring
    OuterShade = 10.0;
    ShadeWall = 4*ThreadWidth;			//  wall thickness
    
    HolderID = RingID - 2*RingFit - 2*ShadeWall;
    HolderOD = RingOD + 2*RingFit + 2*ShadeWall;
    
    echo(str("Holder ID:",HolderID));
    echo(str("Holder OD:",HolderOD));
    
    LeadWidth = 4.0 + HoleWindage;		// LED power lead hole
    LeadTall = 2.0 + HoleWindage;
    
    Protrusion = 0.1;					// extend holes beyond surfaces for visibility
    
    //---------------
    // Create thread gripper and plate
    
    module Mount() {
    
      difference() {
    	union() {
    	  translate([0,0,PlateThick])
    		cylinder(r=(MountOD/2 + HoleWindage),h=MountDepth);
    	  cylinder(r=HolderOD/2,h=PlateThick);
    	}
    
    	translate([0,0,-Protrusion])
    	  cylinder(r=MountID/2,h=(PlateThick + MountDepth + 2*Protrusion));
      }
    
    }
    
    //----------------
    // Create LED ring holder
    
    module Ring() {
    
      difference() {
    	union() {
    	  cylinder(r=HolderOD/2,h=PlateThick);
    
    	  translate([0,0,PlateThick]) {
    		difference() {
    		  cylinder(r=HolderOD/2,h=OuterShade);
    		  cylinder(r=(HolderOD/2 - ShadeWall),h=(OuterShade + Protrusion));
    		}
    
    		cylinder(r=(HolderID/2 + ShadeWall),h=InnerShade);
    	  }
    	}
    
    	translate([0,0,-Protrusion])
    	  cylinder(r=HolderID/2,h=(InnerShade + PlateThick + 2*Protrusion));
    
    	translate([(HolderOD/2 - ShadeWall/2),0,(PlateThick + ShadeWall/2 + LeadTall/2)]) {
    	  scale([ShadeWall*2,LeadWidth,LeadTall])
    		rotate(a=[0,90,0])
    		  cylinder(r=0.5,h=1.0,center=true,$fn=12);
    	}
      }
    
    }
    
    //---------------
    // Build what's needed
    
    if (Build == "Mount") {
      Mount();
    }
    else {
      Ring();
    }
    
  • Sherline Laser Alignment: Polarizing Filter

    Laser aligner polarizing filter detail
    Laser aligner polarizing filter detail

    A display across the aisle from the CNC Ghetto at Cabin Fever featured a nice Laser Center Edge Finder with their new polarizing attachment. I played with it for a while and decided that, although my crude lashup gave similar results, I just had to have a polarizing filter, too.

    I’d already made a bushing to fit the top of the spindle bore with a small aperture that aids in lining up the laser, so I just added a small recess for a disk of polarizing film. I have, for reasons that should not require any explanation by now, a lifetime supply of polarizing film…

    Anyhow, the new polarizing filter sits neatly atop the spindle. The main laser beam lights up the middle of the filter, with junk light spilling on the bushing to the front and rear.

    Polarizing film in upper bushing
    Polarizing film in upper bushing

    Getting a good photograph of the spot size poses some problems, but here goes. This is the original, un-attenuated spot on a scale with 0.5 mm divisions: in round numbers, it’s half a millimeter across.

    Normal laser spot size
    Normal laser spot size

    Cross-polarizing the beam produces this attenuated spot on the same scale: it’s 0.25 mm in diameter, maybe a bit less. Call it 10 mils.

    Attenuated laser spot size
    Attenuated laser spot size

    Obviously, what you’re seeing are overexposed more-or-less Gaussian spots, so their diameters aren’t fixed numbers. But at this level, the inaccuracies of my Orc Engineering lens mount are comparable to the spot size, so reducing the spot any further isn’t going to improve the overall positioning accuracy.

    It’s worth noting that the spot size isn’t the same as the positioning accuracy: you can visually align a workpiece mark to less than 1/4 the spot diameter. Claiming 1/10 the diameter would be more brag than fact, at least for me, but somewhere around 2 mils is close. That’s good enough for most of what I do.

    I like it!

  • Adobe Reader Print Colors

    While printing up handouts for my talk at Cabin Fever, I finally tracked down why Adobe Reader was producing such crappy colors.

    The left is before and the right is after the fix, scanned at the same time with the same image adjustments:

    Oversaturated vs normal printing
    Oversaturated vs normal printing

    All of the print settings appeared correct (plain paper, 720 dpi, normal contrast, etc, etc), but Adobe Reader (and only Adobe Reader) looked like it was trying to print on vastly higher quality paper than I was using. Too much ink, too much contrast, generally useless results.

    The solution was, as always, trivial, after far too much fiddling around.

    In Reader’s Print dialog, there’s a button in the lower-left corner labeled Advanced. Clicky, then put a checkmark in the box that says Let printer determine colors.

    And then It Just Works.

    Equally puzzling: ask for 25 copies of a two-page document, check the Collate box, and you get 25 page 1, 25 page 2, then more page 1 starts coming out. I bet I’d get 25 x 25 sheets of paper by the time it gave up.

    I have no idea what’s going on, either.

    Memo to Self: verify that the box stays checked after updates.

  • DSC-F717 Memory Stick Errors: Socket Cable Reinsertion

    While I was fiddling with the camera to get that first spectrograph, it began coughing up an assortment of Memory Stick errors, including the dreaded C:13:01 error. Having had this happen several years ago, I knew it came from the ribbon cable contacts in the Memory Stick socket and the only way to fix it involves taking the camera apart.

    At the time, I used the guide at http://hbar.servebeer.com/text/f707/, which is now a dead link; you can use archive.org to retrieve it. There’s an exact copy at http://batteringram.org/misc/f707repair/ and a bit of rummaging suggests the same person is running the new site.

    Anyhow, here’s my version of the teardown and fix. This is a bit more aggressive than what you’ll read above, in that I disconnect all the cables to get straightforward access to the guts of the camera, but I think it makes everything easier. In any event, re-plugging the cables in those connectors will probably be a Good Thing.

    Remove the battery, Memory Stick, and all the straps and doodads. This fix will reset the camera to its factory defaults; you must eventually reset everything, so review your settings.

    If your filing system depends on the camera’s numbering system: heads up! This will reset the image sequence numbers; the next picture will be DSC00001.JPG.

    Remove the four Philips-00 screws that hold the rear case in place. Note that they are not identical…

    Two on the left.

    DSC-F717 case screws - left side
    DSC-F717 case screws – left side

    The rear screw on the right side.

    DSC-F717 case screws - right side
    DSC-F717 case screws – right side

    The screw on the right side of the bottom passes through the front part of the case.

    DSC-F717 case screws - bottom
    DSC-F717 case screws – bottom

    Ease the whole rear half of the case, display and all, away from the front half, until you can disconnect the three-wire cable from the power jack. A needle-nose pliers may be helpful, but be gentle!

    DSC-F717 internal power cable
    DSC-F717 internal power cable

    Now things get nasty.

    The flat paddle in the lower right plugs into a socket on the display board in the rear case: pry it out if it hasn’t popped out of its own accord.

    Disconnect the ribbon cable on the left side by prying the gray latch away from the cable; the ribbon will pop out with no effort.

    Put the rear part of the case somewhere out of the way.

    DSC-F717 main board cables
    DSC-F717 main board cables

    Peel the static shield off the main circuit board. The black strip is a surprisingly strong adhesive tape that’s stuck to the ribbon cables along the top edge of the board. Peel gently!

    DSC-F717 static shield
    DSC-F717 static shield

    Pull the three cables out of the sockets along the top of the board. The blue cable seems to be much more fragile than the others, but they all come out by just pulling directly upward: parallel to the board.

    Unscrew the two P-00 screws holding the main board in place: upper left and center of the board.

    DSC-F717 main board cables - top
    DSC-F717 main board cables – top

    Flip the camera over and ease the main board away from the case to expose the white connector on the bottom. This is stuck firmly in place, so try to not brutalize anything around the connector when it pops out.

    DSC-F717 main board cables - bottom
    DSC-F717 main board cables – bottom

    That leaves only the ribbon cable on the right of this picture (left of the camera) connecting the optical section to the main board. Push the two ends of the gray latch bar parallel to the cable (it is not the same as the connector on the other side of the board shown above) away from the connector until the bar releases the cable and it pops out.

    Put the main board somewhere safe.

    DSC-F717 main board cables - rear
    DSC-F717 main board cables – rear

    Now you can actually see the Memory Stick socket behind all the ribbon cables!

    DSC-F717 Memory Stick socket - exposed
    DSC-F717 Memory Stick socket – exposed

    Remove the two P-00 mounting screws, one to the upper right and the other to the lower right in the steel retaining bar.

    Remove the socket from the camera. Whew!

    DSC-F717 Memory Stick socket - retaining screws
    DSC-F717 Memory Stick socket – retaining screws

    Here is the offending cable entry into the Memory Stick socket. Pull the mumble cable out.

    DSC-F717 Memory Stick socket - cable entry
    DSC-F717 Memory Stick socket – cable entry

    The socket pins evidently move just a little bit, every time you put in a  Memory Stick, eroding teeny divots in the cable contact pads. I generally use the USB connection, so the socket doesn’t see a lot of motion. Your mileage may vary.

    DSC-F717 Memory Stick cable indentations
    DSC-F717 Memory Stick cable indentations

    I cleaned off the ribbon cable pads with Caig DeoxIT, although I’m not convinced that really does anything in this situation.

    This guy dismantled the socket to clean the internal contacts, which would probably make sense while you’ve got the hood up. I didn’t do that this time, though.

    Then you reassemble everything in reverse order, after which the camera Just Works. Probably for another few years.

    The puzzling part of this failure: the camera has literally hundreds of ribbon cable contacts, but only the Memory Stick cable goes bad. If any other cable failed, the camera would go Toes Up, right? Next time around I may try soldering thin copper pads on the cable or applying a thin backing layer to improve the resilience, but that sounds pretty risky even to me.

    If you haven’t done so already, put a write-protected image of your biz card / contact info on every Memory Stick you use with your cameras to make it easy for an honest person who finds your camera to get in touch with you. The dishonest ones won’t change their behavior one way or the other.

    Take a picture of your card now: the camera will set up the folders and name it DSC00001.JPG. If you’ve already got such a file, take a picture anyway, delete it, then copy your existing file to the camera as DSC00001.JPG. In either case, write-protect the file.

    Memo to Self: next time, take the socket apart and cast some epoxy around the contacts to prevent further motion.

  • Spectrometer: Quick and Dirty Image Processing

    Having gotten a spectrometer image from the crude camera lashup, the next task is to (figure out how to) extract some meaningful data. The general idea is to use ImageMagick and Gnuplot as much as possible, so as to avoid writing any actual software.

    The original image is the high-res version of this:

    First light - warm-white CFL - no adjustments
    First light – warm-white CFL – no adjustments

    Use ImageMagick to crop out a slice across the middle and convert it to lossless PNG:

    convert -crop 2500x100+0+1000! dsc00273.jpg dsc00273-strip.png
    
    dsc00273-strip.png
    dsc00273-strip.png

    I can’t figure out how to reset the image size using -extract, but -crop gets the job done.

    The default ImageMagic PNG compression is 75, so I should include a -quality 100 option, too.

    Because we have colors separated spatially, all we need is a grayscale intensity plot. The easy and, alas, wrong way to convert the color image to grayscale goes like this:

    convert -colorspace GRAY dsc00273-strip.png dsc00273-strip-gray.png
    
    dsc00273-strip-gray.png
    dsc00273-strip-gray.png

    That grayscale value is a weighted sum of the RGB components that preserves human-vision luminosity:

    Gray = 0.29900*R+0.58700*G+0.11400*B

    I think it’s better to simply add the RGB components without the weights, because we care more about the actual spectral intensity. That might allow overly high intensity in some peculiar situations, but I’ll figure that out later. First, get the red / green / blue channels into separate files:

    convert -separate dsc00273-strip.png dsc00273-strip-chan%d.png
    
    dsc00273-strip-chan0.png
    dsc00273-strip-chan0.png
    dsc00273-strip-chan1.png
    dsc00273-strip-chan1.png
    dsc00273-strip-chan2.png
    dsc00273-strip-chan2.png

    That looks better: the intensities resemble the original colors.

    Then add those three files together, pixel by pixel, to produce a single grayscale file:

    convert -compose plus dsc00273-strip-chan0.png dsc00273-strip-chan1.png -composite dsc00273-strip-chan2.png -composite dsc00273-strip-spect.png
    
    dsc00273-strip-spect.png
    dsc00273-strip-spect.png

    Extract a one-pixel row from the middle and write it as a raw binary file. You could extract the row from the original image, but I think some blurring might be appropriate, so later is better. There’s no point in trying to display a one-pixel-tall image, so I won’t bother.

    convert -crop 2500x1+0+50 dsc00273-strip-spect.png gray:dsc00273-line.bin
    

    Fire up Gnuplot and have it plot the grayscale intensities:

    gnuplot
    plot 'dsc00273-line.bin' binary format="%uint8" record=2500x1 using 1 with lines lt 3
    

    And there’s the spectrogram…

    Gnuplot - dsc00270 - CFL
    Gnuplot – dsc00270 – CFL

    A quick-and-dirty bash script to persuade ImageMagick to make something similar to that happen, including all the commented-out cruft that I’ve been copying forever so I don’t forget the magick incantations when I need them again:

    #!/bin/sh
    base=${1%%.*}
    echo Base name is ${base}
    convert -crop 2500x100+0+1000! $1 ${base}-strip.png
    convert -separate ${base}-strip.png ${base}-strip-chan%d.png
    convert -compose plus ${base}-strip-chan0.png ${base}-strip-chan1.png -composite ${base}-strip-chan2.png -composite ${base}-strip-spect.png
    convert -crop 2500x1+0+50 ${base}-strip-spect.png gray:${base}-line.bin
    export GDFONTPATH="/usr/share/fonts/TTF/"
    gnuplot << EOF
    set term png font "arialbd.ttf" 18 size 950,600
    set output "${base}-spect.png"
    set title "${base} Spectrum"
    set key noautotitles
    unset mouse
    set bmargin 4
    #set grid xtics ytics
    #set xrange [0:1400]
    set xlabel "Red <- Colors -> Violet"
    #set format x "%3.0f"
    #set logscale y
    set ylabel "Light intensity"
    #set format y "%3.0f"
    #set yrange [0:60]
    #set ytic 5
    #set datafile separator "\t"
    #set label 1 "mumble" at 1600,0.300 font "arialbd,18"
    plot	\
    	"${base}-line.bin" \
    	binary format="%uint8" record=2500x1 \
    	using 1 with lines lt 3
    EOF
    display ${base}-spect.png
    

    Observations & ideas:

    It turns out that the flat topped peak in the middle was in the original green channel data: that color was overexposed.

    If I had a camera that could do RAW images, this whole thing would work even better. Using 16-bit intensity channels would be exceedingly good; the original JPG file has only 8-bit channel resolution: 1/256 = -24 dB, which isn’t anywhere near good enough. That’s assuming the camera + JPG compression has 24 dB dynamic range, which I doubt.

    That blue / violet peak over on the right looks great: the optical focus is fine & dandy. I focused the spectrometer at roughly infinity, set the camera to infinity, then tweaked the spectrometer to make the answer come out right.

    FWIW, I think that deep blue-violet line is the mercury G-line emission at 435 nm, which would explain why it’s so narrow. The others are rather broad phosphor emissions from the CFL tube’s surface.

    LEDs can provide spectral wavelength calibration markers, although their peaks are rather broad in comparison to mercury emission lines. A 400-450 nm “UV” LED puts out a broad blue-violet blur on the left (reddish) side of the emission line. Maybe it’s really the mercury emission H-line at 404 nm?

    An IR LED puts a line on the far left side, about twice the distance to the left of the red line as the green line is to its right. I don’t know the exact wavelength, but it’s around 900 nm. The camera (my old DSC-F717) can do IR + visual images, but it insists on auto-setting the exposure and focus, which wipes out the other lines. The line is barely visible with the camera’s internal (and highly effective) hot mirror in place. Maybe with a more stable setup that would work.

    Diode lasers in IR, red, green, and blue? Hmmm…

    ImageMagick (probably) can’t detect those LED markers and scale the output file width, as it deals with intensity over a regular XY grid. A Python script could swallow the output binary file and spit out a scaled binary file with the bump peaks set to known locations. Actually, I’d be willing to bet there’s a perverse way to get IM to do X-axis scaling, but I’m even more certain the command-line syntax would be a wonder to behold.

    Inject the LED images with a beamsplitter or teeny mirror across the bottom of the spectrometer slit and get intensity calibration, too. Vary the LED intensity with a known current for decent calibration over several orders of magnitude. That could compensate for the crappy dynamic range: as long as the LEDs aren’t saturated, you can correct them to a known peak value. IM can probably do that automagically, given known regions on the input curve.

    Blur the strip image to get rid of color noise and irregularities in the slit. Perhaps a vertical sum in each channel along (part of?) the entire strip, then divide by the strip height, which would completely avoid blurring along the horizontal axis. If, of course, the entrance slit is exactly vertical with respect to the camera sensor.

    IM knows how to deskew / rotate images. Apply that before summing, so as to correct small misalignments?

    Different cameras have different entrance pupils. A quick check shows the DSC-H5 has a much smaller entrance pupil at full zoom: the spectrum covers more than the full screen, so the spectroscope won’t work well with that camera. Normally, you’d like to fill the entrance pupil with the image, but …

    Getting all the optical machinery supported and aligned and oriented will require an optical bench of some sort. Perhaps my surface plate with magnetic sticky bases?

    I think this is going to work…