Focus Stacking with a Raspberry Pi – Focus Stacker Circuit Details

    I have finally got round to drawing up the electrical schematic diagram for the focus stacker showing how my Raspberry Pi is connected to the various component that form part of my stacker. Please check very carefully before using any of this information. It works for me but may not for you! The information is shown on this page.

    Focus Stacking with a Raspberry Pi – test stack of 148 images of a fly

    Today I made another test run with a stack of 148 images at 40 micron intervals using the Otamat 20mm lens, this time on a 42mm extension tube. The subject was another of my old insects forraged last year for trial purposes. I have been waiting to see how these tests go before getting hold of various bits of entomological equipment – forceps and the like – as well as acquiring the necessary chemicals for relaxing the insects, stilling, drying etc, and plastic/glass tubes and containers for processing the specimens and keeping them clean. The work by Johan J Ingles-Le Nobel on his website – Extreme Macro – has been an inspiration and a huge help in working out what to do.

    test specimen - not in the best of conditioning - no prep other than mounting for the stack
    Test specimen – not in the best of conditioning – no prep other than mounting for the stack

    So this specimen is a bit ugly in many respects, is missing some key components with many bristles broken off, and it could do with a wash and brush up!  But it has served its purpose. I am satisfied that if I can prepare a passable specimen, then I can make a passable macro image. After a number of test stacks I am now sure that the kit works as envisaged, and that the lenses are OK; we are good to go to the next stage.

    There are some minor software changes to be implemented to make things a little easier; I am accumulating a list and at some point will do an integrated update. I intend to make another light box, much larger, to accommodate larger specimens in a diorama form for 1:1 macro work; for this I will need to improve the method of positioning and lighting the backdrops as the current arrangement doesn’t really do what is required – back to the drawing board here.

    Finally I need to decide on my stacking software. At the moment I am using a trial version of Zerene. I am quite happy with the results so far but will probably have a look at Helicon Focus too.

    Focus Stacking with a Raspberry Pi – development modifications

    The rubber band drive has gone, replaced with some lego gearing. I had acquired various sized gear wheels (40, 24 and 16 teeth) and the one that worked best for my installation was the 40-16 arrangement shown here in the picture. I was able to adjust the position of the stepper motor to accommodate this new configuration by means of the adjustable tension arm. This works much better than the rubber band arrangement, and the movement of the stage on its rack is quite smooth and jerk free.

    The new gearwheel drive resplendent with miniature rubber duck. When I have built the dust cover, Mr Duck will sit on a spindle protruding through the cover so that I can see how the motor is behaving.
    The new gearwheel drive resplendent with miniature rubber duck. When I have built the dust cover, Mr Duck will sit on a spindle protruding through the cover so that I can see how the motor is behaving.

    I have also now installed the official rubber duck rotation indicator!

    The motor control software has a soft-start and soft-stop routine so that the rack speeds up and slows down gracefully when it has been motoring at full speed for a long traverse, say, to park the stage. It avoids an abrupt stop which is not ideal. (when incrementing between shots a much slower speed is used). I had noticed that the speeding up was quite gradual to start with and then seemed to make a big jump in speed at the end of the speed up sequence. The routine was running correctly and the motor was doing what it was told – namely to speed up on each 8-step sequence by a fixed amount represented by a reduction in sleep-time between individual motor steps of 0.001s starting at .060s until the target speed was reached at .002s.  After a lot of head scratching I realised that this simple approach was completely wrong as the last two increments effectively double the speed (from sleep time of .004 to .002) hence the jerk. A more sophisticated algorithm was required based on a reducing  percentage of the sleep-time at each 8-step sequence. This was easy to do and works much better.

    The flexible stalk lamps are going to be used to light the backdrop, and I have acquired some IKEA JANSJÖ LED lights for the main illumination of the specimen. These are very cheap (£10 each) and have a clamp at the base, and are mains powered. Just have to work out how to arrange them. I have also obtained some 0.5mm white plasticard sheet to build some light diffusers with – some experimentation is required to get this aspect right as it is quite critical to get even lighting.

    Camera remote control. You can also see the miniature beeper attached to the second relay channel on the Sainsmart relay.
    Camera remote control. You can also see the miniature beeper attached to the second relay channel on the Sainsmart relay.

    The remote camera shutter release  I bought on e-bay is now connected to the rig by means of a two-pin din plug and socket, and enables me to test fire the camera when everything is powered off, or if the GUI isn’t giving me the option.

    I have finally got a warning beeper wired in. The 3.5mm audio out put from the Pi requires an amplifier to drive anything at a reasonable volume so I had ruled that out as just an additional complication. MobaXterm could not provide a solution that would use the laptop audio system. In the end the easiest option was to drive a 5v beeper via the Sainsmart 2-channel relay board on which I had a spare channel doing nothing. The beeper can be seen in the picture hanging onto the relay. Volume control is by piercing a hole in the paper cover over the end of the beeper to protect it from damage during manufacture. Without the label it is too loud. With the label, way too quiet. A small hole just perfect -low tech but effective!!

    A simple program piup.py was added to turn on a green indicator LED when the Pi is booted up using the Cron job scheduler, so that I know it’s OK to connect the laptop. It sits in the home/pi directory and is called by a line at the end of the crontab  file:

    @reboot python/home/pi/piup.py &

    The “&” at the end of the line calls for the command to be run in the background. So the green light stays on while other scripts run.

    Shall be ready to take some test shots soon.

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!

Archives

Category Specific RSS

Share


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
RSS
EMAIL
Facebook
Google+
http://www.picsbymike.co.uk/mhp_blog/tag/programming/">
Twitter