Showing posts with label macro. Show all posts
Showing posts with label macro. Show all posts

Photography - My new macro-bot

I built a thing today.

It moves stuff in small increments using a small electric motor, in response to a users input.

I guess that means I've built my first robot.

Actually, probably my second.

Anyway...

My device looks like this










It also looks like this.

The bit with the "1" next to it is my previously built power supply that delivers 5 volts to my project.

The bit with a "2" next to it is the previously made PICAXE Proto Board that connects some input/output pins to my breadboard.

The "3" is the transistor bit, that powers the motor when the chip sends a signal to do so.

And the "4" isn't really visible. If you could see the "4", it would be next to the the switch that the user presses to make the subject move a tiny bit.

The point of this exercise is to attempt to make a device that carries an empty box of mints along a steady track, to carry a subject to different focal distances, in order to make a series of photos to create a focus stack, and thus create an image with a greater depth of field than might otherwise be achieved.

This absurdly simple solution, represents my first successful attempt at creating an electronic something without external help from someone, somewhere on the planet.

All the software does is wait for someone to press the button, then move the subject a tiny bit closer to the camera. This changes which bit of the subject is in focus, and enables the user to take a "stack" of pics, each one having a different plane in sharp focus. The user can then knit them all together using some free software, creating a photo with an otherwise impossible depth of depth of field.

The 11 lines of code that makes it work look like this (the very small amount of black text is the actual software, the green text is just my description of it)

--------------------------------------------------


; Macro Mover ver 2013 06 10 0200
        ;moves a small platform holding a photographic macro subject a tiny amount closer to the camera         '            each time a button is pressed, helping to create a "focus stack"
;120thingsIn20Years.blogspot.com
;no rights reserved
;use at your own risk

;For picaxe 08M2

#No_Data 'saves a few seconds when uploading the code to the chip, because it doesn't have to check for data

main:' begin the main program loop

if pinC.1 = 1 then gosub Move    'if someone is pressing the button, jump to the bit of code called "Move"

goto main ' if it gets this far, go back to the start and check for a button press again

Move: 'the bit of code that moves the platform with the subject on it

do until pinc.1 = 0 :loop ' hang here until the button is released

high 2 'turn on the motorconnected to pin 2
pause 2 ' wait for 2 milliseconds
low 2 ' turn off the motor connected to pin 2
pause 100 ' pause for 100 milliseconds

      return 'go back to the gosub that called the "Move" code

-------------------------------------------------


I started with an old CD ROM drive that I ripped all the interesting bits out of.

I think this is the original motor because it fits perfectly. This is the motor that made the laser head move from the centre to the rim. Now it's the motor that moves the photographic subject towards the lens, changing which bit is in focus.

The blu-tac is there as a weight to keep the linear cog in contact with the gear that the motor connects to.





So the motor makes the black bit move from this extreme...

(see the black bit)










to this extreme, but in tiny increments each time the button is pressed.

Each button press causes a a quarter of a millimetre migration.

.25 mm = 0.0098 inches

A tiny amount each button press.

The camera sits on the large grey platform to the right.


The software controls how much the motor moves at any given moment. This way we control how much we increment the slice of our subject that is in crisp focus.

The camera is securely set in place because there is a tight fit due to my bending some tags in order to hug the camera. There is also two lumps of blu-tac securing the camera to the base.

This arrangement feels totally secure, and I haven't had any problems with the camera moving.







Last, but far from least, I added a subject platform  and a light source. The subject sits on a platform made form an empty tic-tac (small mint confectionery) box,

The light source is the thing on three zebra legs.

It's best to move the light source with the subject as it moves toward, or away from the camera, to avoid photos with different exposures, so a light that moves with the subject is best.




Once you have a "stack" of photos with different bits in focus, you can knit them all together with a program like "MacroFusion" (free, open source program I run on my linux computer)

To use this Macro-bot device, you press down once or more times, on a button to move the subject a tiny bit closer to the camera. After each button press (or two or three) you take a photo. Each time you press the button, the subject moves a fraction of a millimetre. I found pressing the button once was suitable for macro shots where the lens was at full zoom, and pressing three times when the lens was at minimum zoom.

Some experimentation is required, but as soon as I made this, I immediately solved all the problems I was having with poor alignment of my photos in a focus stack.

Successful results to follow...




120 Things in 20 years - Sometimes, all you have to do to make a robot, is to replace all the bits from the robot you salvaged last week.






Photography - Hack a macro lens from a zoom lens

I decided to make a more permanent macro lens.

The improvised one here was just too crazy to use. Everything had to be held together with tape, string, and luck.

It turns out it's pretty easy to hack a macro lens, if you already have a short zoom lens you don't need.

There are a lot of canon kit lenses that came with the cameras floating around out there for only a few dollars. The best price I saw was $3.98 US.

The lens I'm using is a canon EF 35-80mm zoom. I got it for free from someone who paid around $5 for it in Japan.

 The first step is to find some screws that might let you get inside.

The object here is to remove the front lens element.

My screws were found under a sticker, but different lenses hide the screws in different places.




Removing the sticker revealed 3 screws.

The sticker is useless after you remove it, so don't try this unless you want the change to be permanent.

That's the wrinkled corpse of the sticker in the background.




Undo the screws.











This allows the top lens element to be removed.

This lens cluster does the focusing as far as I can tell.

At this point you can take a macro shot, but the lens will leak a lot of light onto your censor. The black plastic surround covers a gap between the outer lens casing, and the inner sleeve that controls the zoom.



In my lens, it wasn't possible to remove the lens from the plastic surround, so I had to cut it off.

If you were trying to do this as a temporary thing, and wanted to try it before you commit, all you need to do is cover the lens front with something light proof with a hole around 2cm in diameter in the centre.

I'm guessing gaffer tape would work well.



The main thing is to create a cover for the gap between the outer casing and the inner zoom sleeve.

The lenses are of no use, but the plastic surround is very useful, because it has a screw thread to take filters.

A clear glass filter, or a UV filter will be the thing that keeps dust out of the lens.

The large black plastic thing is the bit we are keeping.



There was an extra hole that I filled with a screw to keep everything light tight.










A clear glass filter, and it's all done.












The results are pleasantly surprising. The original lens could zoom into around 6cm in width. This is closer to 1cm.

The focus ring no longer does anything, but the zoom still zooms. 

There are two ways to focus. 

Moving the camera or the subject until the scene is in focus is where you start. The distance from the lens that the subject needs to be is only around 5cm. Once you have the subject roughly in place, you can use the zoom to change the point that's in sharp focus. 

The zoom also works as a zoom, and changes the field of view between 12mm and 25mm from one extreme to the other. ie at full zoom (as per the shot of the pencil, you can fill the frame with a 12mm object)

All in all, not quite as functional as a proper zoom lens, but for $5 it represents a pretty good compromise, and something I'd call a total success.





120 Things in 20 years - If canon just made the front lens element removable, I wouldn't have needed to do this lens hack to convert a zoom lens to a macro. 

Photography - Photo stacking


I've been reading a bit about photography, and discovered this thing called "photo stacking".

It helps you create super close ups that have everything in focus.


Normally in a photo, you get some bits in focus, and some out of focus.

This can be a good thing, because you don't always want, for example, the background to be sharp.

Sometimes things look better when you cant see them.

But sometimes you want to see it all.


I'll drop a series of seven photos here with each one seeing a different section in focus.

This first pic of a 300mm ruler is taken at a focal length of 10mm.


This next pic is at 20mm

You can see that the section that's in focus has moved a little further back.














This one at 50mm

















 Here are three more in the series with each one seeing the focal length change through 100mm, 150mm, 200mm, and 300mm.

I would have preferred to use increments of 5mm all the way through, and take 60 photos, but this camera I have only deals with those photo lengths when used in manual focus mode. 

There is software that is free and open source, that can take the best bits of each photo, and knit them all together to make one photo. 

Apparently it's possible to do this in a graphics program, but I dont have the skill set, and the software seems to work. 

There are a few different software packages, some that cost and some that are free. The one I'm playing with is called, CombineZP. All you have to do is select the photos (New), then chose something that I dont understand called, "align and balance used fra..." (the title of this function is cut off because whoever made it doesn't respect my inalienable right to resize whatever window I want, and my screen size isn't the same as theirs), then click something that makes perfect sence that says GO.

After a few seconds wait, the end result is pretty good for a first attempt, and might just prove to be a very useful tool in trying to capture extreme close up shots. 

I'm guessing it would be perfect if I just had a camera that could deal with letting me chose where to focus all on my own. 

Even without respecting my free will, the result is quite good. You can see in the photo below, some bands of blur where I couldn't divide the focal length and add another frame. There's an obvious blur between the "k" and "i", and another at the "3" in 300. Another at 250, but they are all errors caused by my camera not letting me take pictures in between the ones I took. 

'Tis an interesting bit of kit, and I thoroughly recommend trying it if you are taking macro shots. 
 
The result...






































120 Things in 20 years - I love discovering new things like photo stacking for macro shots, and I love discovering that there are only 6 photos in my series of 7. I deleted one, and have no idea which one it was, so I moved on. 

I'm also without confidence that I'm using the words "focal length" properly. 

Popular Posts