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.

  • Camera LCD Sunshade & Magnifier: Part 2

    Lens end of viewer
    Lens end of viewer

    With the bottle formed & trimmed to shape, it’s time to mount the lens. This view shows the final result, with the camera body angled upward.

    The general idea is that the bottle cap already attaches securely to the bottle, so I can just cut a rectangular hole in the lid, make it just slightly smaller than the lens, and affix the lens inside with the planar surface facing outward.

    Two motivations for making the hole slightly smaller than the lens:

    • The lens has rounded corners, as it was cut from a 38 mm diameter round lens
    • It won’t stick out, get bumped, and fall off
    Lens opening cut in bottle cap
    Lens opening cut in bottle cap

    The first step was, of course, to make a fixture: a sacrificial wood block with a raised section that fits snugly inside the cap. I found a nice maple disk in the scrap bin, chucked it in the lathe, and turned a section to fit. I don’t have a dust extraction system, so I did this one-handed with another on the shop vac to suck up the swarf. Yuch, wood is dusty!

    That simplified clamping the rather slippery lid in place. It’s probably polyethylene that would slide away under heavy cutting loads, but with a 2 mm end mill that wasn’t a problem. The origin is at the center of the cap, directly atop the convenient injection-molding sprue button.

    The lens is 34.4×22.1 mm, so I cut a 32×20 mm opening using manual CNC. Given a 1 mm cutter radius, the G-Code looked something like this:

    #1=[20/2-1]
    #2=[32/2-1]
    g0 x[0-#1] y[0-#2]
    g1 z-2 f100
    x#1
    y#2
    x[0-#1]
    y[0-#2]
    g0 z30

    That’s from memory, so it might not work quite right. Basically, store the key variables in parameters and use those instead of mistyping a digit somewhere.

    The opening even has nicely rounded 1-mm radius corners from the 2 mm cutter…

    Cutting acrylic lens holder
    Cutting acrylic lens holder

    I added a sheet of acrylic inside the lid to hold the lens in position and provide a more glue-attractive surface. The lens opening here was a slip-fit for the lens: 34.5×22.2 mm. The G-Code looks pretty much the same:

    #1=[22.2/2-1]
    #2=[34.5/2-1]
    g0 x[0-#1] y[0-#2]
    g1 z-2 f100
    x#1
    y#2
    x[0-#1]
    y[0-#2]
    g0 z10
    Trimming outside of acrylic lens holder
    Trimming outside of acrylic lens holder

    The wood disk even had a convenient hole in the middle, making it easy to re-clamp the acrylic from the center with a stack of washers. The laser aligner made alignment easy: make the nut finger-tight, put the spot on the left edge near the front, jog to the rear, twist to split the difference, iterate a few times, then snug down the nut.

    Then the origin is halfway between the edges. Knowing the opening size, find one edge and touch off by half that amount.

    The cardboard lid liner was 43 mm in diameter, so I figured that would work for the acrylic sheet. Circular interpolation makes getting a precise diameter trivially easy, after you remember that this is outside milling so you must add the cutter radius:

    #1=[43/2+1]
    g0 x[0-#1] y0
    g1 z-2 f100
    g2 i#1
    g1 z30
    Finished cap with lens
    Finished cap with lens

    What’s not shown there is the blob of acrylic that welded itself to the cutter because I was taking picures rather than dribbling water on the workpiece to keep it cool. I hate it when that happens.

    But everything pretty much worked out. The holder was a snap fit inside the cap, just like it was supposed to be.

    I glue the lens to the acrylic holder with silicone snot (aka “adhesive” or “caulk”), let it cure overnight, snapped the cap on the bottle, and iterated once to get the lens properly aligned with the opening (the acrylic sheet rotates freely inside the cap).

    Viewer attached to camera
    Viewer attached to camera

    The end result is, admittedly, ugly on a stick, but the first reports from the user community are encouraging!

    We may add a dark cloth ruffle around the bottle cap as an eye shade and eyeglass protector, but that’s in the nature of fine tuning.

  • Camera LCD Sunshade & Magnifier: Part 1

    Viewer attached to camera
    Viewer attached to camera

    Mary take her gardening pictures with our Sony DSC-F505V camera, which has one compelling advantage for the job: the lens and body pivot, so you can take pix at odd angles without groveling in the dirt or hovering over the camera staring downward. Alas, it lacks an optical viewfinder, which means she does a lot of outdoor close-up photography peering into a washed-out LCD panel in full sun. Worse, she’s far-sighted and can’t see fine details without her reading glasses or bifocals, so it’s really hard to get proper focus.

    Something must be done!

    The general notion is to put an opaque shield around the LCD with a lens that magnifies the viewfinder. If you happen to have perfect near vision, the lens is optional and you can probably use one of the commercial sunshades that attach with hook-and-loop strips. That isn’t going to work for us.

    With inspiration from that project, I retired to the Basement Laboratory. [Update: a somewhat less intricate do-it-yourself project starting with a slide viewer. I suspect it works better for normal-looking cameras, not this one.]

    Raw material: rectangular lens and opaque bottle
    Raw material: rectangular lens and opaque bottle

    Rummaging in the Bottle Supply turned up a dark brown plastic bottle made from PETE, the same stuff that makes soda bottles, with a black plastic snap-cap lid. PETE has a glass transition temperature around 75C, which means you can reshape it with a heat gun (not, alas, a hair dryer). Actually, I found two bottles, so I have a backup.

    A bit of soaking in water, followed by a generous application of xylene, got rid of the label & adhesive residue. You can get xylene in small quantities as Goof-Off adhesive remover or just buy a quart at your local big-box home-repair store. Do the xylene part outdoors and don’t toss the rags in the trash until they’re dry.

    Further rummaging in the Lens Supply turned up a 34.4×22.1 mm plano-convex rectangular lens with perhaps a 100 mm focal length. Haven’t a clue where it came from, but perhaps from the Surplus Shed optical supply shop. Pretty nearly any lens with those general specs will work, so use what you have. You do have a box of lenses, don’t you?

    Putting the flat side of the lens close to my (distance-corrected, I’m nearsighted) eyeball and looking through it at the LCD from about 75-125 mmm produces a very nicely enlarged, distortion-free image. This will work!

    Bottle cutting and forming
    Bottle cutting and forming

    The bottle is much thicker than a soda bottle, but easily cut with a razor knife and a bit of care. I removed the bottom and measured the ID as 68 mm. The circumference is, obviously, 214 mm, which is a key dimension: it must fit around the LCD’s perimeter with a bit to spare.

    I made a wood mould block that’s sized and shaped roughly like the back of the camera around the LCD: Mr Block, meet Mr Belt Sander. This avoids the prospect of melting the camera with the heat gun, as it’s largely plastic, too.

    The block is 52×57 mm, for a perimeter of 218 mm, and a totally non-critical 38 mm tall (it came from a 2×4″ chunk of lumber). The pyramidal section acts as a forcing cone to persuade the bottle to stretch around the slightly larger block and become nicely rectangular as it does.

    Wood forming block
    Wood forming block

    Position the bottle over the block, apply the heat gun all around, and ram the bottle downward as it softens. Eventually the bottle will eat the block, even though it’s not completely happy about doing so, at which point you can concentrate on heating each side separately. The bottle will settle down and stretch neatly around the block, giving it a rectangular base with a smooth transition from the round top. The cut edge tends to curl outward in the middle of each flat side, so don’t overheat it.

    Cut the corners back so there’s about one focal length from the cap to the cut, then heat the side flaps (the shape is rectangular: get this right!) and bend them back. I flattened them against the bench to remove the curve. The top and bottom flaps will fit over the top and bottom of the camera and hold the whole affair in place.

    Trim the side flaps to a few mm, as they’ll just form a light shield, and shape them to clear the controls as needed. Form the top & bottom flaps to fit snugly around the camera and trim to fit; they cover up the buttons just under the camera’s LCD, but those aren’t used in normal operation.

    I used plain old electrical tape to hold the bottle in place, as anything thicker will interfere with the lens rotation. If you have a box-shaped camera, hook-and-loop may be your friend.

    That was enough for one day. Tomorrow: a bit of CNC work on the lid

  • Wooly Bear Caterpillar

    This gizmo appeared in one of Mary’s garden containers and, as is their custom, curled up tight and stayed that way when she picked it up.

    Wooly Bears generally have a central brown band, but all-black isn’t unusual. I hadn’t known about the orange bands across the back between the body segments.

    Those spiny hairs are so stiff and it weighs so little that it skitters around on the desk at the slightest touch, all without moving a muscle…

    Find out more about Wooly Bears there or by searching on the obvious keywords.

    We put it back in the garden where it can turn into a moth and produce more Wooly Bears to delight children of all ages.

    Photography note: exposing a dead-black spiny thing against a woodgrain desktop is basically impossible. The desktop is grossly overexposed so the Wooly Bear details come out more-or-less visible. Ugly, but you get the idea.

  • Pileated Woodpecker

    This fellow has been helping to remove the stump in the front yard for a quite a while; today he let me peek around the edge of the door and take a few pictures…

    He’s about crow-sized with a much snappier paint job.

    Scary-sharp beak!

    Taken with a Sony DSC-H5 with their VCL-HGD1758 1.7x teleconverter lens at about 50 feet, then ruthlessly cropped. Not as good as an SLR with a real telephoto lens, but good enough for my simple needs. The teleconverter with a macro lens on the back provides some standoff distance for photos of tabletop widgetry.

  • Infra-red Photography: Roosting Turkeys

    The turkeys were discussing their activities yesterday evening while getting ready for bed in the trees out back. This isn’t unusual, but they seemed rather louder than usual.

    We walked out the driveway, me with the Sony DSC-F717 in IR Night Shot mode, and eavesdropped for a while. The two early birds in the trees may have been air bosses for the rest of the flock, as nobody else arrived while we were there.

    So I didn’t get any pictures, but it reminded me of some I took a few years ago when a hen with a gaggle of chicks roosted in a maple directly in front of the house.

    Three peeps are easy to see, but she had at least two others snuggled up on her left side!

  • Bullet Hole in Plate Glass

    Pellet gun hole in plate glass
    Pellet gun hole in plate glass

    Found this hole in the plate glass window of a church.

    The conchoidal fracture pattern is characteristic of a bullet impact at more-or-less right angles to the pane. I suppose, based on the very small entry hole and no damage to the opposite wall, that it was something like a BB gun at close range, rather than a 0.22-cal handgun or rifle far away.

    Somehow, you just know the lunkheads doing this sort of thing have never repaired a window themselves… when you’re a constructor, you just don’t go around destroying things.

    But maybe that attitude marks me as a fuddy-duddy.

  • Recovering JPG Images From Damaged Flash Memory

    My DSC-F717 just crashed as I took a picture in the Basement Laboratory; it stalled while writing a picture to the memory stick. This camera is known to have problems with its ribbon cables and I’ve fixed it a few times before, but right now I have other things to do. Who knows? Maybe it’s a different problem altogether.

    Thus, the pertinent question is how to grab the image files from the Memory Stick, even with a damaged filesystem. This trick will work with any memory device, so it’s not just a Memory Stick thing.

    The camera crashed with the Memory Stick activity LED stuck on. Turning the camera off didn’t work: it jammed in the power-down sequence. So I poked the Reset button, which snapped the camera back to 1 January 2002, just after midnight. Alas, it now couldn’t read the Memory Stick, which meant either the filesystem is pooched or the camera’s card socket has gone bad again.

    Mmm, do you know where your camera’s Reset button is? It might not even have one, in which case you just yank the battery. If you can yank the battery, that is.

    Anyhow…

    With the camera turned off: extract the memory card, poke it into a suitable USB card reader, and poke that into your PC (running Linux, of course).

    If the filesystem isn’t too badly damaged, you’ll probably get a popup asking what to do with the new drive (the memory card). Dismiss that, as you don’t want anything writing to the memory without your explicit permission, which you won’t give.

    Figure out which device corresponds to the card and which partition to use:

    dmesg | tail
    [29846.600524] sd 5:0:0:2: [sdd] 1947648 512-byte hardware sectors (997 MB)
    [29846.606022] sd 5:0:0:2: [sdd] Write Protect is off
    [29846.606030] sd 5:0:0:2: [sdd] Mode Sense: 23 00 00 00
    [29846.606033] sd 5:0:0:2: [sdd] Assuming drive cache: write through
    [29846.608748]  sdd: sdd1
    

    In this case, the Memory Stick was intact enough to have a valid partition table, so it could be successfully mounted. However, you don’t want any attempt to write the data, just to keep a bad situation from getting worse. You do that by mounting the device read-only:

    sudo mount -o ro /dev/sdd1 /mnt/part

    You’ll need a suitable mount point; I created /mnt/part early on to hold manually mounted disk partitions.

    The FAT filesystem seemed to point to valid files, but attempting to display them didn’t work. So unmount the device before proceding:

    sudo umount /dev/sdd1

    Switch to /tmp or anywhere you have enough elbow room for a few files the size of the memory card.

    Run dd to make a bit-for-bit copy of the entire drive:

    sudo dd if=/dev/sdd of=memstick.bin bs=1M

    The bs=1M should dramatically speed up the transfer; the default is, IIRC, 512 bytes.

    After this, everything you do uses memstick.bin, not the memory card itself. If you’re paranoid like me, you’ll make a copy of the file before you do anything hazardous. You could even make two copies directly from the memory card and compare them, which might be instructive.

    To find your precious JPG images among the rubble, look for their magic Exif headers:

    strings -t x memstick.bin | grep Exif
      68006 Exif
     258006 Exif
     680006 Exif
     848006 Exif
     a18006 Exif
     bf0006 Exif
     e00006 Exif
     fe8006 Exif
    11e8006 Exif
    1420006 Exif
    ... snippage ...
    

    Because the strings search ignores the (presumably broken) FAT directory structure, you’ll find all the image files on the drive, whether or not they’ve been deleted, partially overwritten, or whatever. This is great for forensics and terrible if you’ve got something to hide. You have been warned.

    The -t x parameter returns the string’s starting offset in hex, which you need to find the actual starting offset of the file: it’s 6 bytes lower! Your mileage may vary, so be prepared to fiddle around a bit.

    You could write a bunch of code to parse the JPG header and extract exactly the number of bytes required, but this is no time for subtle gestures. I just yank out whatever the largest possible image file could be, because image-processing programs only process the valid stuff anyway. So, knowing that this camera produces images in the 2.4 MB range, this extracts the first image:

    dd if=memstick.bin of=image.jpg bs=$((16#1000)) count=1K skip=$((16#68))
    

    The $(( … )) notation evaluates the numeric expression within and the 16#… notation expresses a hexadecimal value.

    Soooo, bs=$((16#1000)) says that the blocksize is 4096 bytes, which you can deduce from the fact that all the Exif headers start 6 bytes from a multiple of 0x1000. Again, your camera may do things differently, but the general notion should get you started.

    If you’re fussy, you’ll note that the headers are actually on multiples of 0x8000 bytes, but using 0x1000 means you can read the high-order digits right off the strings dump. Why make things more complicated than necessary?

    Given a 4K blocksize, count=1K extracts a 4MB chunk: 1024 blocks of 4096 bytes each. That’s larger than the largest possible image file from this camera; adjust it to suit whatever you expect to find. Don’t be stingy, OK?

    The skip=$((16#68)) says to begin extracting data 0x68 blocks into memstick.bin. You read that value directly from the strings output, which is easy enough.

    You could write a tidy Bash script to eat the strings values and spit out the corresponding file chunks. I had few enough images this time to just do it manually, which beats having to debug some code…

    Good luck!