Focus Stacking with a Raspberry Pi – Design Refinements

    focus stackerThe parts for making the lighting control box arrived and I was spurred into action before Christmas to modify the rig to accommodate the revised lighting controls and to build the light control box itself. In the end it took a whole day as I decided to take the opportunity to remove some redundant wiring and to reallocate the push buttons on the sledge mounted control box. I also updated the wiring diagrams to keep track of what I had done.

    Focus stacker light control box
    The focus stacker light control box and the “STOP” remote

    So now I have a lighting control box that sits behind and below the camera; there is also a momentary switch to operate the camera shutter so that I can make a blank exposure between stacks very easily.

    The remote camera shutter is now a remote stop button for the stage which makes it much easier to control the set up of near and far focus points, eyes on the camera and remote in hand.

    focus stacker electrical connections
    Focus stacker electrical connections

    The lights are plug and socket connected to the sledge as is the control box, for easy dismantling and storage. When I need to work on the main module I can quickly disconnect it from everything, and there are no trailing wires getting in the way.

    The redundant 6v lights switch on the sledge mounted control box has been replaced by a push button to operate the camera shutter – mainly to put something useful there instead of having a hole!

    Focus Stacker
    The light diffusion box – now with removable top and back – much better.

    The light diffusion box has also been modified to enable the top and back to be taken off leaving the front and the camera/lens set-up undisturbed. This makes it much easier to tweak the specimen during set up and after successive stacks.

    I am still not totally satisfied with the light diffusion box and may make yet another one, even bigger. I am finding it fiddly to get at the lab jack even with the removable top and back, and the lights would ideally be sited a bit further away from the subject to allow for more diffusion and baffling.

    I have forgotten to manually enter the time and date on at least one occasion, and have given up on the software solution to updating Pi time as too difficult, and so I recently obtained an Adafruit real time battery operated clock module (RTC). It is very compact and is supplied with its battery. It sits neatly in the junction box under the rack where the two wires that need to connect it to the Pi are already present and unused having been taped back originally at the time of build “for a rainy day” – there was a stroke of good luck!  It also needs Pi 5v and GRND which were both there too. The assembly and installation was easy. Modifying the config files on the Pi was not difficult. Installing the drivers for the RTC was impossible………. why, because…… need the Pi to be connected to the internet. If it was connected to the internet I wouldn’t need the RTC, would I?  The driver goes by the name of i2c and enables one chip to talk to another.  There is, apparently, no reliable way to download the correct version of i2c (there are many and various!) and install it without being connected to the internet, which is a bit daft. There are plenty of people wanting to do this judging by the forum talk on the web, but the experts issue dire warnings of workarounds messing up your PI configuration big time. Later versions of Debian whatever, have the drivers in the supplied library. But not mine. Back to square one for the time being.

    focus stacker
    Overall set-up
    focus stacker
    focus stacker- the new light control box handily located behind the camera.

    Focus Stacking with a Raspberry Pi – Focus-Stacker Project Parts List

    I thought it was time that I set down the list of parts that were used to build my focus-stacker. The cost was less than £120. If you live in the USA you could probably do it for the same in dollars – or less!  And it does depend a lot on what you have lying around at home that you can use for this project. I have not included anything to do with lighting or camera equipment other than the IR trigger. Most of the parts were purchased on e-bay with some like the Pi  itself coming from Amazon. You do need to check when purchasing cheap electronic parts on e-bay to make sure they are not coming from Hong Kong if you want them quickly. Shipment from HK  can involve up to a ten week wait for the item to be shipped surface, though sometimes items arrive remarkably quickly. Factor shipment time from HK into you procurement and build schedule if going down that road.

    For the working parts – electronics, motor and rack drive:

    1. Raspberry Pi RBCA000 ARM 1176JZF-S Motherboard 512MB RAM – £ 27.39
    2. 8GB SDHC SD Card pre-loaded with Raspbian “wheezy” Linux operating system – £8.29
    3. iZKA® High Power Micro USB UK Dedicated Mains Power Wall Supply Charger For Raspberry Pi – (5V / 2.1A) – £6.99
    4. 40 wire ribbon cable Male to Female with ends broken out to individual contacts – £4.99
    5. 40 wire ribbon cable Female to Female with ends broken out to individual contacts – £4.99
    6. Arduino 5V 4-Phase Stepper Motor with ULN2003 Control Board – £6.90
    7. SainSmart 2-Channel 5V Relay Module – £8.00
    8. Micsc LEDs, resistors, switches, nylon stand-offs, nylon screws and bolts, solder pins, Veroboard, fibreglass sheet, and project boxes – approx £35
    9. Camera infrared remote control for Sony Alpha – £2.69
    10. Stalk for camera remote IR  – salvaged from flexible USB LED lamp £ 1.98
    11. DVD Rack – salvaged from old DVD player
    12. Misc Lego Technic gear wheels – approx £5
    13. Other miscellaneous electrical components and cable ties – from a box in my shed

    For the chassis:

    1. Aluminium channel 3/4″ x 3/4″, aluminium angle 3/4″ x 3/4″ and 1/8″ aluminium plate – all  from  my shed
    2. S/S and other hardware to hold everything together and three rubber feet
    3. Camera Rack – old Minolta rack lurking in my junk cupboard

    I will cover the software side of things in another post.

    Focus Stacking with a Raspberry Pi – Modifying an IR Remote to Work with the RPi

    I decided to bite the bullet and have a go at removing the IR transmitter from the camera remote and reconnecting it on some long leads so that just the IR transmitter needed to be lined up with the camera detector, and not the whole unit. It wasn’t so hard after all. I added a connection to a push button for testing, which will eventually be connected to the relay that is controlled by the Pi.

    The finished remote with flying leads for the IR transmitter and push button.

    Here is how I did it.

    To take the unit apart is much easier than you would think. It is not an ultrasonically welded case. In fact the front is just a thin piece of plastic held on to the unit with some form of self adhesive that (on my unit) enables the front to be removed and reapplied multiple times, and stay stuck!

    Internal PCB showing the numeric keypad circuitry

    Once you have removed the front, it becomes much clearer what you have to do. On the pcb are all the positions for a full numeric keypad. For the camera remote function just two were used – triggers with zero and 2 sec delays. For my application I only need the trigger with zero delay.

    Remove the battery before unscrewing the five small screws which enable the pcb to be removed from its plastic case. Turned over you can see how the IR transmitter is soldered in place.

    To make the modifications I removed the IR transmitter carefully using a pair of long nose pliers as a heat sink between device and soldering iron. Leads were inserted between device and pcb and that bit was done. To connect the remote to the push button (for test purposes) and ultimately the relay controlled by the Pi, some leads need to be attached to the pcb where the push button moulded into the cover (cunningly made conductive in that area) normally contacts the track on the pcb and bridges the gap to complete the circuit. Luckily, on just the right pcb tracks there are a couple of plated through holes into which pins can be soldered for the connections I needed.

    The component side of the PCB

    It is easy to put everything back together which is the reverse of the disassembly process. Once done, a quick check with my camera showed that everything was working as it should.

    I am waiting for a flexible stalk to arrive, which I will use to hold the IR transmitter so that it can be positioned correctly relative to the camera sensor. Once I have that in my hands I will be able to see how long to make the final lead lengths.


    Assembly with front cover removed


What’s it all about?

Here are my jottings about my photographic projects and activities. I have been working on a focus stacking macro photography rig. There are quite a few posts about that. In addition I write about other photographic activities as and when!


Category Specific RSS


Warning: A non-numeric value encountered in /home/public/mhp_blog/wp-content/plugins/ultimate-social-media-icons/libs/sfsi_widget.php on line 238