supplierdeeply

CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD

  • 704 Replies
  • 32027 Views
*

Offline SticK

  • *****
  • 779
  • Publish
    Advertisements
    INTRODUCTION

    CHKDPTP is a powerful camera remote control tool with a live viewfinder that runs on your PC substituting for Canon's RemoteCapture.  It allows full access to all camera features in both PLAY and RECORD modes, and adds sophisticated scriptable programmatic capabilities that leave Canon software biting the dust.  It also works with PowerShots that are not supported by Canon RemoteCapture.  The S90 is one of these. The optoelectronics in this camera make it perhaps the most suitable of all small-format CCD cameras for low light photography such as astronomy.  In addition, CHDK extends the Tv range from the Canon limit of 15 seconds to 64 seconds. The CHDKPTP PC viewfinder can be set for 360x270 mode or to 720x540 for a high resolution live image with this camera.

    The S90 CCD has a 10 Mpx 1/1.7" (7.6x5.7mm) sensor surface and uses a correlated double sampler (CDS), variable gain amplifier (VGA) and 12-bit analog-to-digital converter (ADC) in its signal processing pipeline.  It is one of the few high-end PowerShots that also captures Canon native RAW images, in addition to DNG images provided by CHDK.  The advantage Canon native RAW is the size, typically 2/3 of a DNG.  One advantage of a CHDK DNG is that warm and hot pixels can be handled in a manner similar to dead pixels.  CHDK allows the use of either format in the S90.  JPG images are barrel-corrected in the camera while Canon native RAW images (CR2 in the S90) are barrel-corrected in their PC software.  Thus for contortion-free primary focal plane (PFP) configuration RAW imaging, use another tool, such as free RAWTherapee, to decode Canon native raw images.

    OBJECTIVE

    The best quality imaging that can be achieved from your optical instrument is when the CCD is installed in a PFP configuration.  In other words, your instrument projects its own focal plane directly on the CCD without you having to optically compensate for unnecessary intervening camera lenses whose presence attenuates and distorts the imaging path.  Thus the goal of this effort is to determine the minimum camera configuration that will allow direct access to the CCD sensor surface, eliminating as many of the lens components as possible thus reducing the camera's volumetric footprint.  Because optical feedback will be disabled when the CCD is removed, the PFP configuration is meant to be operated in the M (manual) camera mode.

    There are a few important issues to be mindful of:

       1) Right after a shot, no matter how fast your shutter speed is, you have to obstruct the CCD for the image readout for at least 1/3 second,
       2) Dark subtract ... if enabled, remember to simulate a closed shutter after your image acquisition has timed out.  For example, if you set Tv to 8s, keep your shutter open for 8s after the camera has responded to your shoot command, then close it for 8-1/4s for dark acquisition and readout, and then open again for continued live view,
       3) Flash setting .. make sure you have flash disabled otherwise the camera will shut down after a minute,
       4) In the CHDKPTP command line execute =set_config_value(67,3) -- ALT_PREVENT_SHUTDOWN_ALWAYS.

    The best way to handle (1) and (2) is hijack the camera's shutter signal and operate your own shutter.  I will illustrate how that can be done later in this thread.

    DISMANTLING the CAMERA

    The tools necessary are a #0 Philips screwdriver, wooden round toothpick for ribbon cables, a #7 curved tweezers, and Exacto knife.  To access the CCD and lens, back, front and top cover, and LCD have to be removed.  There is an LCD replacement YouTube movie for an S90 that can help you get started.  If you are going to extract your lens assembly, then the button panel has to be disconnected from the front of the camera and removed, and the flash sub-assembly can be removed for overall easier access.  As you see in Figure 1, the camera operates without any of these components, except that on power up, you get a passing benign warning for flash position.  There are three types of ribbon cable connectors a) zero-insertion-force flip-release, b) pull-out/push-in force-insertion and c) snap-on, snap-off.  The two LCD connectors are the (a) type which require lifting and swiveling up the black retainer with the dull side of the knife blade, from the cable side.  The rest of the small ribbon connectors are the (b) type that can be disconnected with the toothpick.  The large connectors for the CCD and lens control are the type (c) and can be gently pried off with toothpicks.

    Figure 1 shows the stripped-down camera powered and connected to the PC running CHDKPTP.  Since you no longer have the LCD, the PC becomes the only way you can interact with the camera.  With the top cover off the mode switch contacts are disengaged causing the camera to boot into AUTO mode by default.  You can change mode to M with the drop-down in CHDKPTP.  By removing the CCD (three screws) and swinging it out, it can be made to face sideways or backwards for a PFP configuration while keeping the lens operating normally so the camera does not go in to error and shut down.  In M mode all camera functions work properly, even focus except that it has no effect on the image of course.  The viewfinder is set to 360x270.  This is the quickest but least flexible method to access the CCD and will work if you have room for the lens to extend and enough room to mount the entire camera in your apparatus.

    Figure 2 illustrates a sacrificial lens assembly under powered functional test that will be used to further decompose the camera and lens towards a minimal workable PFP configuration candidate.  Because the minimization process will include intentional errors that I will introduce into the lens assembly to document firmware behavior, the original lens is being left intact as a fallback to restore normal operation.  Here the camera's original CCD is still connected, but I have diverted main board lens control ribbon cable connector to the sacrificial assembly.  This lens was purchased on eBay from an unscrupulous seller who advertises his items as "New."  Obviously a used reject, it was filthy-dirty, severely mishandled and a ribbon cable damaged.   It extends slowly and retracts with difficulty.  However, the poor behavior of this lens is offering more insight on Canon's control and signalling that I hope to explore later as I progress in this endeavor.

    Next post ... disassembling the lens ... and ... can this defective lens possibly be restored?
    « Last Edit: 24 / October / 2012, 16:23:11 by SticK »

  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #1 on: 12 / October / 2012, 05:46:59 »
    Good.

    Quote
    This lens was purchased on eBay from an unscrupulous seller who advertises his items as "New." 

    Is that the one you recently ordered ?

    If so, at least you do not need the optics.
    « Last Edit: 12 / October / 2012, 05:51:23 by Microfunguy »

    *

    Offline SticK

    • *****
    • 779
  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #2 on: 12 / October / 2012, 08:41:00 »
    Yes, but it was not from the place in China you suggested.  There were a few other choices and I thought the only US source would have been better than Asian, but it turned out not.  It was one of those sellers that is "registered elsewhere and may speak a different language."  I've learned that with a feedback rating of 99.8% one has to be careful and ask questions first.  Ratings of 99.5% or lower, like this one, are very poor .. buyer beware types for sure.  In this case I asked if the item was new enclosed in original Canon packing, the answer was ... refurbished, contradicting the advertised new straightaway.  Thus I was poised to be surprised with good lens and despite my question, it turned out not even that.  I did manage to take it apart and find the problem however, but the goal here is to tear it apart anyway.  This one of course will not be reassembled.  So if you don't want to get a defective lens, don't order from the US location.

    These PowerShot lenses manage to accumulate dust in the lens cavity because of suction when opening and closing, and this one was no exception, on top of the defect.  So I think the endeavor will be interesting also because I found the trick to take it completely apart right down to the individual lens blocks so one can actually do the cleaning and restoration oneself.  It takes patience and time but is not difficult.

    *

    Offline SticK

    • *****
    • 779
  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #3 on: 12 / October / 2012, 15:49:31 »
    DISMANTLING THE LENS

    CAUTION: use an anti-static station, wrist strap, and static-control handling precautions.

    This procedure can also be used for cleaning and restoring your S90 lens, and I think in general may be applicable to most PowerShot lenses. In Figure 1, the procedure progresses from left to right.  The Z-orientation (Z-axis out of paper) of the all components called "front" is that of lens cap 2B except iris 4C, which flips over on top of IS-shutter-lens cover 5D. Figure 2 is a reassembly explosion map that is a two-dimensional version of a perspective mechanical drawing. RED arrows: {this component encloses}-->{that component}. BLUE arrows: {this component is adjacent to}-->{that component}.  If the arrow is dotted, it means the mating is on the far side of the component.

    Optical path is: entrance pupil compound lens 2C -> iris 4C -> exit pupil compound lens & IS 4C -> shutter 5B (with actuator in 4C) -> focus lens 1C -> UV-NIR filter (not shown) -> CCD (not shown).

    BASIC PROCEDURE

    Some obvious details are left out. It may be helpful, especially if you want to reassemble the lens for reverse order, to paste this into an editor, make it into a single line for each step and print out. The entire lens assembly is secured to the camera metal frame with 3 screws. Disconnect the two type (c) ribbon cables from the main board and remove lens. Disconnect all 3 external ribbon cables (1C 12 o'clock, and 7-8 o'clock). Optoswitches are held in place with a soft rubber cement. Use the knife to cut the cement and tweezers and toothpick to very carefully extract optoswitch from backshell 1C 11-o'clock and the closer-to-you zoom motor optoswitch in frontshell 1A. Remove 4 perimeter screws that secure backshell 1C to frontshell 1A from the back 1C. With assembly facing up so that gears (1C 3-5 o'clock) don't fall out, slowly pry apart 1A and 1C, while keeping 1B (with its enclosed 3A etc) secure with 1C. If you intend to reassemble the lens, mark the exact angular index position of main zoom ring 1B wrt 1C before removing the entire internal subassembly contained in 3A (which also still contains 1B). Finally, separate the complete internal subassembly 3A+1B from 1C.

    At this point you can manually operate the lens extension zoom mechanism by holding 3A and turning 1B. Metallic lens cap 2B is cemented in-place to entrance pupil sub-assembly 2C. Extend the lens and with knife, pry off 2B by jacking up the ring around its circumference. Some decent force is needed to get it moving and you may have to go around a few times to inch it off evenly. With tweezers remove springs and dustcovers 2A from lens 2C. On my defective lens I found the springs to be soiled, interfering with free operation of the dustcover. The very high mechanical disadvantage propagated back to the zoom motor was making it very difficult to actuate the lens. The camera would attempt two or three retraction attempts before the lens would finally retract completely. As soon as I removed 2A, the lens zoom operated perfectly again.

    Index mark liberally as you go along. Extend lens fully. Remove zoom ring 1B from the outside of 3A. Next, locate the thin slit at 7-8 o'clock in 3A&3B where two ribbon cables belonging to 4C & 5C pass, and pull the cables into the cavity. 

    This is hard part. 3A contains all the optical and electronic components of the zoom sub-assembly. They are all held together at once by one very clever fastener trick that took me a few good hours to figure out. Looking towards the front of 2C as in Fig 1, just around the perimeter of the interior lens subassembly, locate three small radial flanges that bridge the lens subassembly to its external enclosure. One is 4 mm wide the other two are 2 mm wide. The lips that hold the lens subassembly flanges are just on the inside perimeter of the external enclosure. Thus the lens subassembly can be rotated CCW with respect to its external enclosure. Position a pair of fine needle-nose pliers so that you can turn the inside lens subassembly while holding 2C.  Not much force is needed. Turn CCW slowly so you see the flanges move relative to their retaining lips. Only about a half-hour rotation will release all the components. Even though lens subassembly can be rotated a tiny bit further and removed, that's not necessary as the lens can easily be cleaned installed as-is. That is, rotate only as far as is necessary to release components and no more.

    Now you have access to all the internal components. With component 5 (shutter, IS and exit pupil compound lens) still as one unit, with a toothpick you can manually activate the shutter by toggling the little free-moving solenoid stub which is easy to find. Movement is about 2 mm. You will notice that the IS lens is mounted on springs and can be made to move a bit if you touch it. Remove shutter retainer 5A by prying off three clips with a fine watchmaker's screwdriver or knife. The vanes are not metallic, but a low-mass polymer that is very fragile. The same polymer is used for the iris vanes 4C (not visible because they are fully retracted in Figure 1). Use a toothpick and fine tweezers to handle the parts, and immediately put them into an electronic anti-static envelope. Borrow a camera and photograph your shutter removal progress if you want to get at the exit pupil lens for cleaning and reassembly.

    Removing the CCD, its rubber surround, and filter from 1C. This is a bit tricky because the transparent cement used to secure the screws is very strong and difficult to remove with a knife. After masking the entire back of 1C and exposing only the screws, I used a Dremel with a 1mm milling tool to clear out the cement, at high speed to prevent vibration. 

    CLEANING GUIDELINES

    I use acetone, however, the plastics in this lens are volatile and will react with it if you make a mistake and you don't want to get any dissolved plastic on lens. Safest for most purposes is the highest proof pure drinkable alcohol you can get at a liquor store. I advise against any other kinds of pharmacy alcohols as they leave residues. I advise against using dust-off because that can leave organic residue and also electrostatically charge the lens' surface, causing it to attract micron-sized particles that you can't even see under a microscope resulting in shadows, especially when on a CCD window. Clean the housings first. Use plenty of Q-tips. If you touch a Q-tip end, discard it. Use each Q-tip only once. Dip the Q-tip in ethanol and shake it hard so it is moist, not wet. Begin at the center of the optic and spiral outwards. Let film evaporate. Inspect optic and repeat as necessary. Assemble the lens.

    Canon PowerShot lenses are notorious for inviting dust into the lens mechanism. This lens had a few small particles on every component with a large one right in the FoV on the filter ... no wonder it was a reject. The loose gaps in lens mechanism provide no protection against dust being sucked in by the vacuum caused by lens extension. A simple design addition with a couple of felt ring barriers would definitely help. Before shutdown, give your extended lens barrel a quick wipe down. Use a plastic sandwich bag to store the camera in your pocket or purse.

    Next post: dimensions.
    « Last Edit: 13 / October / 2012, 16:23:38 by SticK »


  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #4 on: 12 / October / 2012, 19:55:05 »
    Good work.

    This is probably the first time this procedure has been described in detail.

    What diameter (in mm!) is the shutter opening ?
    « Last Edit: 12 / October / 2012, 19:57:35 by Microfunguy »

    *

    Offline SticK

    • *****
    • 779
  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #5 on: 12 / October / 2012, 20:59:59 »
    Thank you.  The shutter exit port in 5B is 5.5mm diameter.  What matters is the exit pupil diameter 5C (facing paper) is 5mm.  I intended to put dimensions and other physical info in the previous post but hit the 7500 character limit // they're coming soon.

    *

    Offline SticK

    • *****
    • 779
  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #6 on: 13 / October / 2012, 16:22:39 »
    ISOLATED COMPONENT DIMENSIONS for designing a MOUNTING ADAPTER

    Figure 1.  Since I have already determined the minimal functional component arrangement that can be successfully used for a CCD-accessible PFP configuration without the need to modify electromechanics (basically 1A+1B+1C+3A, demonstrated in detail in the next post), the dimensions I am showing here are only the ones I feel will be useful for designing a mounting adapter for your instrument.  As an aside for general interest, I have added lens dimensions too.

    There are two camera-side mounting possibilities:

      1) An external circular adapter that fits and tightens over 1A (by say several set screws around the perimeter), and has a hole to mate with your instrument (for example the eyepiece of a telescope).  In this format, the maximum depth of the camera-side of your adapter is 9.5 mm.  If you choose this format, use many setscrews, and tighten lightly not to interfere with the motion of 1B.
      2) An internal circular adapter that is a very mild press-fit on the inside of 3A.  There you have a wall thickness limit of 3mm but your insert can be as long as 20 mm.   It means ID should be a bit larger than the 28.0 mm in 3C to allow for focus assembly movement.

    TIP: you can start with a PVC pipe end-cap sold in most hardware stores.  They come in many sizes and are easy to work with.

    Next post: With minimal components in a splayed configuration, I will describe their relative behavior when taking a shot.
    « Last Edit: 13 / October / 2012, 16:41:44 by SticK »

    *

    Offline SticK

    • *****
    • 779
  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #7 on: 14 / October / 2012, 00:41:50 »
    MINIMAL FUNCTIONAL SUBASSEMBLY ARRANGEMENT for PFP CCD ACCESS

    Figure 1

    This is a setup that will work for most PFP applications.  Without making any modifications to electromechanics, the minimal configuration lens subassemblies needed for error-free PFP operation are:
      LEFT COMPONENT: iris 4C.
      CENTER COMPONENT: shutter solenoid and optical image stabilizer 5C.
      RIGHT COMPONENT: frontshell 1A, main lens extender barrel 1B, stationary lens compartment 3A, and backshell 1C.

    Here backshell 1C still has the focus lens installed.  For a typical on-camera PFP arrangement you could remove the focus subassembly from 1C (simply by hand-turning the leadscrew), detach the focus lens for an unobstructed path to the CCD, and reinstall the subassembly so that the stowed signal is correctly handled by firmware ("focus assy stowed switch" in the figure).  That way you will have an unobstructed light path all the way to your CCD.  To protect the CCD from dust, when you remove the focus assembly to take the glass out, turn 1C upside-down, put some tape to cover the hole in the focus assembly, and reinstall it straightaway.  Peel off the protective tape only when you are ready to attach your PFP camera to your instrument.  Cotton gloves available at pharmacies are very useful for this kind of work.

    Thus you could then install the RIGHT COMPONENT back into the camera (no different than the back view of the original in the figure, but, with a big gaping hole in the front), and viola, you have PFP CCD access.  Mount your camera according to my guidelines in a previous post.  Note that it is not necessary to remove the CCD from 1C to do all this, and in fact is preferable that you don't if this arrangement works for you. 

    Next, there are two choices for stowing the CENTER and RIGHT components:

        a) fasten both to the back of backshell 1C with double-sided adhesive, making sure that the iris, shutter solenoid and OIS are free to move,
           -- OR --
        b) if you want to reinstall the LCD and the back switch panel which likely is preferable, then surprisingly (although I have not tried it myself) I am sure there is plenty of ribbon cable to thread through the small space between the main board and the body of 1A, sandwich LEFT and CENTER components together, and conveniently fasten them to the front of the camera beside the now-vacant lens housing.

    With (b) you can also reinstall the top cover of the camera for normal POWER and MODE switch access.  Clearly the S90 provides a flexible mechanical and mounting solution in addition its superlative optoelectronic characteristics.

    Shooting sequence definition

    In the figure, the components are powered and camera is set to the M (manual mode).  These are very approximate times just to give an idea of basic behavior.  I enabled dark subtract by =set_raw_nr(2) and I entered shoot -tv=4 -av=5.6 into the CHDKPTP command line.  I pressed execute at t=0 and timed the events.

    Standby live view conditions: iris = f2.0 (7.9 mm), shutter=OPEN, very dark subject (live CCD is enclosed in the original lens assembly (annotated CCD in yellow in the figure).

    Seconds
         0:  Execute shoot command
      1.2:  AF light turns ON, and attempt to focus starts (slight movement of focus assembly)
      1.5:  AF light turns OFF
      2.1:  Focus lens stops moving
      2.7:  Iris closes to f5.6 (2.6 mm) and image acquisition starts
      6.9:  Shutter closes for dark acquisition and image transfer
    11.4:  Shutter opens
    12.9:  Iris resets to f2.0 and the camera returns to standby live view mode

    It takes 1.2 seconds before the camera begins to react to the PTP shoot command.  The AF light and focus attempt is 0.9 seconds long.  Following focus attempt, computational overhead is 0.6 seconds long.  The 4-second shot is handled in 4.2 seconds, assuming an expected overhead of 0.2 seconds.  The 4-second dark and image transfer is 4.5 seconds long.  Thus subtracting 0.2s overhead and the 4s dark, we get approximately 0.3s for the image transfer itself.  At the end of the sequence, there is 0.5s image processing time before the image file(s) save begins.  Overall, there is 12.9(total)-8(shot&dark)=4.9, almost 5 seconds of overhead before the camera is ready for the next shot (not counting save-to-SD time).  This global overhead result, 5 seconds, was the same for shoot -tv=1/125 -av=5.6.

    Other useful observations

    MECHANICAL SHUTTER.  The shutter does not take part in timing a photograph as in a film camera.  In the S90, the shutter is used (closes) only for dark acquisition and image transfer.  When you put the camera in PLAY or PDN, the shutter is closed to protect the CCD CFA (color filter array) from unnecessary exposure to light. 

    IRIS.  The camera steps the iris only in whole units of f-stops (i.e. 2.0, 2.8. 4.0, 5.6 etc), that is, 1/3 intermediate f-stops that are available in the Canon menu are intensity-manipulated by firmware.  Hence as a consequence, and this is interesting, DNG files may only increment by units of f-stops whereas Canon native CR2 raw files (and JPGs) are surely intensity-manipulated by firmware for intermediate Av settings.  The DNG validation can be empirically verified but I have not done it.  When you put the camera in PLAY (lens retract) or PDN, the iris opens fully (as seen in the exploded views) so that it can be stowed against the protruding entrance pupil of the IS.

    Next post:  The electrical functions of the components will be described and DC-characterized, disconnected.  An attempt will be made to AC-characterize (state: running) as many control signals as possible.
    « Last Edit: 14 / October / 2012, 09:24:33 by SticK »


  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #8 on: 14 / October / 2012, 05:39:44 »
    Is the IS lens moved by electromagnets ?

    *

    Offline SticK

    • *****
    • 779
  • Publish
    Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
    « Reply #9 on: 14 / October / 2012, 08:43:43 »
    Yes, linear motors with differential Hall-effect position-encoded feedback // a detailed explanation is in the works of all the parts is in the works and coming soon.
    « Last Edit: 14 / October / 2012, 08:45:17 by SticK »

     

    Related Topics