Ed Nisley's Blog: Shop notes, electronics, firmware, machinery, 3D printing, laser cuttery, and curiosities. Contents: 100% human thinking, 0% AI slop.
The stereo zoom microscope over the electronics bench lives on the end of long support arm that tends to be just slightly wobbly. Part of the problem is that the far end is anchored on the sponge-backed laminate flooring I put atop the bench, but it’d be slightly wobbly even with a firm base on the plywood bench top.
So I prop up the microscope with a machinist’s jack and it’s all stable & good.
This one happens to be from an ancient Starret 190 set that I accumulated along with some other tooling, but any of the cheap imitations would work just as well.
The two bubble level vials help get the microscope axis exactly perpendicular to the bench surface, which makes the difference between good overall focus and a blurred image with a single line in focus. Here the jack is vertical and the microscope is tilted slightly toward the edge of the bench; the jack has a pivot below its knurled top plate.
The motivation for gutting that Dell laptop battery was to find out if the cells could become a higher-capacity external battery for the Canon SX230HS camera. Those discharge curves suggest they can’t, but I also want to know what voltage levels correspond to the various battery status icons, which means I must feed an adjustable power supply into the camera… so I need a fake NB-5L battery with a cheater cord.
The first step: crack the case of the worst of the eBay junkers. I squeezed it in the bench vise to no avail, then worked a small chisel / scraper (*) into the joint. The lid was firmly bonded to the case, but it eventually came free:
NB-5L Battery – opened
The protective PCB sits at one end of the cell, with a strip of black foam insulating the components from the nickel strips:
NB-5L – protective PCB
It turns out that the cell’s metal shell is the positive contact, which I didn’t expect.
The component side of the PCB has a 10 kΩ resistor connected between the center and negative contacts. That should be a thermistor, but it’s a cheap eBay knockoff and I suppose I should be delighted that there’s not a gaping hole where that contact should be. The PCB fits against the small notch in the case and is held in place by small features on the top and bottom. The negative contact is on the far left:
NB-5L – PCB interior view
Canon sells an AC adapter for the camera that includes an empty battery with a coaxial jack that aligns with a hole in the battery compartment cover. I soldered a pair of wires to the PCB, drilled a hole in the appropriate spot, added some closed-cell foam and hot-melt glue to anchor the PCB, and made a cheater adapter. For the record, the orange wire is positive:
NB-5L – gutted case with pigtail
It turns out that the camera battery cover must be closed and latched before the camera will turn on, but the sliding latch mechanism occludes the hole. This cannot be an inadvertent design feature, but I managed to snake the wire out anyway.
Connecting that up to a bench supply (with a meter having 0.1 V resolution) produces the following results:
Voltage
Result
3.8
Full charge
3.7
2/3 charge
3.6
Blinking orange
3.5
“Charge the battery”
The camera draws about 500 mA in picture-taking mode, about 300 mA in display mode, and peaks at around 1 A while zooming.
The Genuine Canon NB-5L is good for 800 mA·h to 3.6 V, as are the two best pairs of the Dell cells. The latter remain over 3.7 V for 500 mA·h, which suggests one pair would run for about an hour before starting to blink. Maybe that’s Good Enough, but … a new prismatic battery is looking better all the time.
(*) Made by my father, many years ago, with a simple wood handle that eventually disintegrated. I squished some epoxy putty around the haft and covered it with heatshrink tubing, but (now that I have a 3D printer) I really should print up a spiffy replacement. I’ve been using it to pry objects off the printer’s build platform, so that’d be only fitting…
Putting that battery into the Dell 8100 laptop produced the dreaded blinky light of doom, so it has been on the shelf for maybe half a year. Having gutted the cells from the case, the next step was to discharge the cells completely, thereby producing the lower four curves in this plot:
Dell 8100 Laptop Battery Cells
I arbitrarily labeled the cell pairs 1 through 4. Pair 1 has the lowest remaining charge and the other three seem very closely matched.
I recharged the four cell pairs one-at-a-time from a bench power supply set to 4.2 V. Each pair started charging at about 2 A, somewhat lower than the pack’s 3.5 A limit, so the supply’s 3 A current limit didn’t come into play. You probably don’t want to do this at home, but …
The usual charge regime for lithium cells terminates when the charging current at 4.2 V drops below 3% of the rated current (other sources say 10%, take your pick). The pack’s dataplate sayeth the charging current = 3.5 A, so the termination current = 100 mA. I picked 3% of the initial 2 A current = 60 mA and stopped the charge there, so I think the cells were about as charged as they were ever going to get.
As nearly as I can tell, increasing the voltage enough to charge at a current-limited 3.5 A (a bit beyond my bench supply’s upper limit, but let’s pretend), then reducing the voltage to 4.2 V as the current drops would be perfectly OK and in accordance with accepted practice, but I’m not that interested in a faster charge.
Unlike the other three pairs, Pair 1 quickly became warm and I stopped the charge. Warming is not a nominal outcome of charging lithium-based cells, so those were most likely the cells that caused the PCB to pull the plug on the pack. The other pairs remained cool during the entire charge cycle, the way they’re supposed to behave.
However, even with that limited charge, Pack 1 had about the same capacity as the (presumably) fully charged Pack 2, showing that the cells get most of their charge early in the cycle. Pairs 3 and 4 had more capacity, but they’re not in the best of health.
The blue curve in this graph shows the discharge curve for the 1.1 A·h Canon NB-5L battery (actually, a cell) that came with the SX230HS camera:
Canon NB-5L – first tests
Notice that it remains above 3.4 V until it produces 1.1 A·h at 500 mA, which is roughly its rated capacity. The other traces come from those crap eBay NB-5L batteries.
The two best pairs of Dell cells can each produce about 1.3 A·h at 1 A before dropping below 3.4 V (the cursor & box mark that voltage in the top graph), so they’re in rather bad shape. Strapping the best two pairs together would give a hulking lump with perhaps three times the life of the minuscule NB-5L battery, so I think that’s probably not worth the effort.
Particularly when one can get a prismatic 3.7 V 5 A·h battery for about $30 delivered, complete with protective PCB and pigtail leads…
One of the batteries on the ancient Dell Inspiron 8100 laptop died completely and our Larval Engineer reports the other battery isn’t far behind; it gets her from outlet to outlet and not much more. Pursuant to that comment about harvesting reasonably good cells from dead batteries to build an extended-life external battery for the Canon SX230HS camera, I made a preliminary pack probe.
The label says it’s a 14.8 V battery, so you’d expect four 3.7 V lithium cells in series. The 3.8 A·h capacity suggests parallel cells:
Dell 75YUF battery – label
Indeed, peeling off the label shows four cells pairs in series:
Dell 75YUF battery – under label
The case joint seems firmly welded together and resisted simple attempts to crack it open. I might run a slitting saw around the edge, although I’ll probably just crunch it in the vise because the patient need not survive the operation.
A single cell should have a 1.9 A·h capacity, although in an awkward cylindrical form factor. The 3.5 A charging current would drop to 1.7 A for a (string of) single cells.
The Canon SX230HS uses a single 3.7 V, 1.1 A·h prismatic “battery”, which means replacing that with a single external cell wouldn’t be a major win; the size difference shows how much lithium energy storage tech has advanced in the last decade or so. A pair of cells in parallel would quadruple the runtime, which might be enough. Three in parallel would be fine, although that would require attention to matching their capacity; the nominal 5.2 A charging current (1.5 × 3.5 A) seems aggressive.
One of the battery packs I’d re-rebuilt failed in short order, which I wrote off to a bad cell and tossed it on the heap. Having recently found a small stack of Round Tuits, I’ve been cleaning off the bench and took the pack apart again. Turns out I blundered the solder joint between the positive cell terminal and the protective circuit board: the strap in the foreground joining those two points didn’t make a good connection to the cells.
That’s an awkward joint at best, because the protective circuit doesn’t come willingly out of the housing and you (well, I) must solder it without scorching the cells, the plastic case, or the PCB. It can be done, but it’s not easy.
Charged it up and it’s back in the A/B/C pack rotation again.
Memo to Self: Tough to find good repairmen these days, eh?
Begin by mounting the Canon SX230HS on the macro lens adapter, zooming to about the maximum, fiddling with a ruler to put the end at the closest focus point, and eventually get an overall view like this:
Ruler – macro mid-focus
The images below were batch cropped from similar views with ImageMagick:
for f in $(seq 17 22) ; do convert -crop '1500x1126+1900+1800' \
img_18${f}.jpg img_18${f}-crop.jpg ; done
Yes, I’ve taken a bit over 1800 images since getting that camera… the old DSC-F505V recently rolled over at 10K images.
Take a set of six identically exposed pictures starting with the focus at infinity (about 95 mm in real life):
macro far focus
And ending with the closest focus at about 1 meter for this zoom setting (and 80 mm in real life):
macro near focus
Then apply enfuse (from the Ubuntu repositories) with a handful of parameters suggested there that combine the sharpest parts of each image into a single image:
It’s not perfect, it needs a few more intermediate images, there’s fringing around high-contrast edges, and so forth and so on, but for a first pass it ain’t bad at all.
I bar-clamped the camera & macro adapter to the desk in order to eliminate all motion. My usual tripod mount for the macro setup isn’t all that stable and the microscope stand isn’t particularly rigid, either, so I must improve a bunch of mechanical structures. In principle, you can post-process the pictures to realign them, although the tolerances seem daunting enough to make mechanical fixturing look downright attractive by comparison.
Now, if it should turn out that the SX230HS supports the CHDK USB remote trigger, that’d be nice. Or maybe the right way to proceed involves converting the problem to A Simple Matter of Software by writing a CHDK script that tweaks the focus by multiples rather than increments.
Although the macro lens adapter and microscope mount work well enough, the relatively small sensor and lens in my Canon SX230HS make for a razor-thin depth of field:
Macro lens depth of field
Those are, of course, millimeter divisions on the ruler.
A bit of rummaging leads to the notion of Focus Stacking, which involves taking a sequence of images with identical exposure settings and different focus points, then compositing the in-focus parts of each image to produce a single image with everything in focus. Although some examples show a manual process involving layers in, say, The GIMP or Photoshop, I think an automated process would be better.
Given that I have a Canon SX230HS camera, the first step is to download the proper version of the Canon Hack Development Kit, unpack it onto a spare SD card, and get used to it.
As it turns out, the focus bracketing works exactly as intended, but doesn’t do quite what I need: it changes the focus in linear steps by adding a constant bracketing distance. The macro lens adapter drags the “infinity” focus point inward to maybe 15 mm beyond the innermost focus point, but the camera’s focus range still shows 1 m to ∞. Stepping in 1 m increments generates a bazillion pictures that don’t differ by much at all after 5 m, but you still need a few near the far end.
However, it seems the only way to get a bazillion pictures is by holding the shutter button down with the drive mode set to Continuous, as the camera’s Custom Timer mode has a 10 shot upper limit. If I must do that, I may as well adjust the focus manually: the assumption being that the camera shall be firmly mounted to keep the pix in alignment, which currently isn’t true in any of my setups and certainly won’t be true with my finger on the button.
The camera already has exposure bracketing, although not to the extreme range available through CHDK. RAW images (or the roughly equivalent DNG format) might come in handy at some point, but right now they’re just a temping digression available only through CHDK.
If I’m going to keep using CHDK, I must conjure up an artificial NB-5L battery with an external power source. Those cheap eBay batteries work fine for the usual duty cycle, but constant zooming & focusing & suchlike chew them pretty hard…