CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD - page 61 - Creative Uses of CHDK - CHDK Forum

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

  • 704 Replies
  • 191736 Views
*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #600 on: 02 / September / 2013, 11:57:40 »
Advertisements
S90 SticK EXPOSURE CONTROLLER for SHUTTERLESS IMAGE ACQUISITION Part 1 of 5

SYNOPSIS

Most scientific imaging applications require prescribed selection of a scene illumination or excitation source.   Under those conditions, image acquisition occurs in complete darkness (like a flash shot at night).  In a digital camera, the mechanical shutter is used only to terminate light acquisition, not to start it as in a film camera.  The mechanical shutter is always open before a shot takes place.  Hence if the imager, i.e. the CCD (here the S90 PFP configuration), is operated in complete darkness, that intrinsically simulates a mechanical shutter if scene illumination can be turned ON and turned OFF when synchronized with the camera's exposure signal.  Exposure (light acquisition interval, Figure 1) in a digital camera thus is the combination of "electronic shutter open"  and mechanical shutter close.  So what is an "electronic shutter"?  What it isn't, is not an LCD in front of a CCD.  To start acquiring scene photons after a shoot button press, the CCD first gets a "well dump" signal that purges existing collected photoelectrons from the CCD wells into the chip substrate, thus clearing the wells from the accumulated unwanted photoelectrons before the shot.  That dump is extremely fast and can occur in a few hundred nanoseconds.  At that point, the photographer's desired scene light accumulation begins depositing new photoelectrons into the empty wells, the equivalent of the curtain-open instance in a film camera.  After the camera's Tv timeout, the mechanical shutter closes, and the CCD image photoelectrons are serially read out to the CDS (correlated double sampler) of the analog signal processing pipeline.  The two prime purposes of the mechanical shutter are:
   a) to terminate exposure, and
   b) to prevent image smear from occurring during readout because scene photons would still be arriving on the CCD after Tv timeout had expired and would distort a clean readout if not obscured.

However, there is no readily available exposure start signal that defines the CCD well-dump on the S90.  Serendipity has been favorable here in a discovery that has given us access to that signal, which ultimately resulted in this new SticK EXPOSURE CONTROLLER.  The signal is found on the bottom speaker pad on the S90 keypad circuit board (described in a next post). 

In order to set up correct speaker operation for the controller, the only enabled sound function has to be shutter (Fig 2, right panel).  Also, shutter volume must be at the lowest level as shown.

Figure 1 suggests there are two state machines that have to be handled: a) normal shoot, left panel, and b) custom white balance CWB, right panel.  My solution for (b) on the 5V SparkFun ProMicro 16 MHz AVR (same MCU as I used in the MECHA SIMULATOR/SHUTTER CONTROLLER) is to have a switch input that "arms" the normal shooting state machine (a) to accept a CWB operation.  The nice side-effect of the manual arm signal is that you can use the push button to turn ON your light source for liveview.  I have provided a reset switch input to turn OFF the light source, which readies the state machine for a normal shot.  Thus I consider this a complete imaging solution for scientific applications.

The TEMPORAL EFFECTS of PHOSPHORS in LEDs

When using LEDs as illumination sources, some caution has to be observed.  Color LEDs and white LEDs use phosphors and scintillators to emit light.  Their fluorescence lifetime, e.g. intensity to drop to a value of (1-1/e)*(initial intensity) after power-OFF, is usually quite long, sometimes as long as several milliseconds.  The lifetime effect also occurs at power-ON, but in reverse.  So that behavior limits shutter speed Tv.  Using a white LED I have excellent high-purity results with a Tv as fast as 1/30th second.  For ultra high speed photography, you can trigger diode lasers instead of direct-driving LEDs.  In fact you can use this solution to obtain smear-free images of up to 1/200,000th second (or faster) quite easily using laser diodes.

« Last Edit: 04 / September / 2013, 23:03:55 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #601 on: 02 / September / 2013, 12:08:02 »
S90 SticK EXPOSURE CONTROLLER for SHUTTERLESS IMAGE ACQUISITION Part 2 of 5

Figure 1 shows where to connect the the exposure start signal on the S90 keypad circuit board to the bottom speaker pad.  The signal is a tri-state output that when enabled by Canon F/W (during a shot), centers the out a 1/2 Vcc of 3.3V (ie 1.6V.).  This is not enough to be detectable by the MCU, so a simple voltage level shifter has to be used.  When the output is disabled (outside of a shot), the output is left floating so a sink resistor is needed (next posts).

I have a red LED attached to the same exposure signal.  The LED is entirely optional.

Figure 2 is an in-progress photo of the hardware during development.
« Last Edit: 02 / September / 2013, 15:37:02 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #602 on: 02 / September / 2013, 12:46:48 »
S90 SticK EXPOSURE CONTROLLER for SHUTTERLESS IMAGE ACQUISITION Part 3 of 5

MCU EXTERNAL CIRCUIT

The level shifter (Fig 1) can use any NPN 2N2222-type transistor.  I used a BC846B.  The other parts (optoisolator and optoswitches) are the same as in the MECHA SIMULATOR/SHUTTER CONTROLLER. 

Fig 2 shows the wiring.  Note that the level shifter board is rotated wrt Fig 1.
« Last Edit: 02 / September / 2013, 15:36:39 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #603 on: 02 / September / 2013, 13:40:35 »
S90 SticK EXPOSURE CONTROLLER for SHUTTERLESS IMAGE ACQUISITION Part 4 of 5

MCU Arduino SOURCE CODE

In contrast to the massive state machine in the MECHA SIMULATOR, this one is trivial and is a good starting point if you are learning about state machines.  The CPP file can be compiled by the Arduino IDE.  Please remember to replace the default interrupt library C file WInterrupts.c (usually found in ...\My Documents\Arduino\hardware\SF32u4_boards\cores\arduino) with the one I modified for the MECHA SIMULATOR (also attached).  My version forces clear of pending interrupts and is very important for both MCUs.


« Last Edit: 02 / September / 2013, 15:35:56 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #604 on: 02 / September / 2013, 15:35:09 »
S90 SticK EXPOSURE CONTROLLER for SHUTTERLESS IMAGE ACQUISITION Part 5 of 5

SUBSYSTEM WIRING (Fig 1) and FINAL ASSEMBLY PHOTO (Fig 2)

Figure 1.  The entire system runs from the +4.6V camera main supply with a common ground.   Wire colors in the wiring diagram match the photo.  You can vary the current through the exposure LED by changing its series resistor (here 100 ohms, ~30mA) as needed. 

Figure 2. On the MCU, the leftmost LED beside the USB connector is power (power is OFF in photo).  Top right LED (above crystal) is EXPOSURE, and bottom right LED (below crystal) is goes ON when phantom mechanical shutter closes, and OFF when open.

USAGE

To obtain liveview illumination, press the ARM switch to turn ON the EXPOSURE LED.  Before shooting, turn OFF the EXPOSURE LED by pressing the RESET switch.  If you want to acquire a custom white balance, press the ARM switch to turn ON the LED.  Pressing MENU in the Canon CWB option when asked acquires the white balance image and turns OFF the EXPOSURE LED, getting the system ready to take a shot (CWB acquisition is instantaneous, and feels as the EXPOSURE LED turns OFF without doing anything).  You can shoot, or press ARM for liveview again.

CORNERSTONE CONCLUSION

The addition of this module completes the S90 PFP imager.  It complements the great work done by the CHDK team, and whole system is working so well, one can call this final addition the cherry on the cake.  The fantastic (boring) grayscale images of a few pages ago were acquired using this setup.  I will be updating these posts as I get feedback from readers and as useful ideas come to mind.  So please come back here later for another look.

This concludes the development of the the S90 PFP CCD imager, unquestionably a stunning success.  A huge thanks to all concerned.  Next on the horizon will be another exciting endeavor to give the system unified long-range over-LAN control in a generic instrumentation scenario using the Beaglebone Black and CHDKPTP converted to a client/server configuration.  I look forward to discussing possibilities and ideas with anyone who is interested.
« Last Edit: 04 / September / 2013, 22:57:11 by SticK »

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #605 on: 06 / September / 2013, 11:39:37 »
A GENERAL QUESTION ABOUT Canon & CHDK SETTINGS PERSISTENCE

@reyalp
@srsa_4c

The current settings, both Canon and CHDK, are kept in static RAM by the on-board S90 battery.  To date, I have had no start-up failures with the MECHA SIMULATOR and special CHDK.  Because at one point I will have to change the battery which will clear static RAM, I'd like to simulate that change successfully, before committing the new hardware to the instrument.

Hence removing/reinserting the battery will likely put the camera into a factory-fresh state.  Camera behavior in that state is unknown to me.  For example, once booted, I have one minute to go into REC mode before the IS times out and gives a lens error.  Thus if there is some intervening deviation, such as Canon asking the user to set a clock etc, that could take more than a minute to respond to, or other unknown variables that might prevent MECHA SIM from operating correctly when I go into REC, please tell me your thoughts of what you know on this possibility so I have some idea what to expect, and whether I should have cause for concern that I could get locked out and not be able to start the camera.
« Last Edit: 06 / September / 2013, 11:42:08 by SticK »

*

Offline reyalp

  • ******
  • 14126
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #606 on: 06 / September / 2013, 13:33:27 »
The current settings, both Canon and CHDK, are kept in static RAM by the on-board S90 battery.
???
CHDK settings are kept on the SD card, in CHDK/*.CFG
Canon settings (flash params) are mostly kept on the same internal flash memory as the firmware code.

AFAIK the on board battery is mostly (or only?) used for the RTC. I don't know about the S90, but on many older cams this battery is a user-replaceable coin cell. Replacing this battery does not reset the camera to factory defaults, it just resets the clock.

Edit:
And congratulations on your success so far with this project. A very impressive piece of work  :D
« Last Edit: 06 / September / 2013, 13:36:22 by reyalp »
Don't forget what the H stands for.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #607 on: 06 / September / 2013, 14:27:28 »
CHDK settings are kept on the SD card, in CHDK/*.CFG
Canon settings (flash params) are mostly kept on the same internal flash memory as the firmware code. I don't know about the S90, but on many older cams this battery is a user-replaceable coin cell. Replacing this battery does not reset the camera to factory defaults, it just resets the clock.
This is *very* useful info, as the S90 does have a button cell, the battery I was referring to.  I conjectured from srsa's work, perhaps incorrectly I hope, that coin-battery static RAM might be involved in keeping some settings.  I will wait for him to chime in as well before venturing into that fog  ???, most of which has lifted with your encouraging comment.

Thank you for your very nice comment :).  By the way, over the past week I have been chatting with Ti's software engineering for the Beaglebone to encourage them to develop a C++ interface to libuv.  Presently, the BBB stock package only works BoneScript, ie javascript pin functions that get compiled by on-board Node.js, and then run by v8 and libuv.  Ti has responded to my suggestions rather well.  We'll see how that develops, because if we can create a BBB interface to my S90, I think it can be made generic for all cameras that CHDKPTP supports for anyone wishing to have a PC-less remote camera control over UDP or TCP/IP sockets.
« Last Edit: 06 / September / 2013, 15:45:50 by SticK »

*

Offline srsa_4c

  • ******
  • 4451
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #608 on: 06 / September / 2013, 15:49:59 »
The RTC circuits used in the cameras usually have a few bits of "user" SRAM. My experience is that at least some mecha status / error information is stored there. Some cameras can even store the index of the last viewed picture there (I have not verified this, but AFAIK that index is not stored on the card, and is not written into flash).
After a loss of the backup voltage the default state of the SRAM equals to "no error" (at least on the a430), so I would not expect trouble. Some cameras have a rechargeable backup battery instead of a regular one, these lose their charge in 1-2 weeks when the main battery is depleted or not present. Not sure which type of battery the S90 has.

And congratulations on your success so far with this project. A very impressive piece of work
+1

Is there a way to delete this entirely?
If reyalp doesn't notice, you can use the "Report to moderator" link.

*

Offline SticK

  • *****
  • 779
Re: CHDKPTP: S90 Primary Focal Plane Configuration - hacking out the CCD
« Reply #609 on: 06 / September / 2013, 17:08:50 »
After a loss of the backup voltage the default state of the SRAM equals to "no error" (at least on the a430), so I would not expect trouble.
That's two votes to zero // thank you.

Quote
Not sure which type of battery the S90 has.
Will let you know.

And congratulations on your success so far with this project. A very impressive piece of work
+1
The PFP S90 project is a solid tangible demonstration of the power of CHDK and all the talented folks who have built it over the years.  When I first approached you guys a year ago I had no idea how well this would turn out.  Truly remarkable!

Quote
If reyalp doesn't notice, you can use the "Report to moderator" link.
:D

 

Related Topics


SimplePortal © 2008-2014, SimplePortal