It moves stuff in small increments using a small electric motor, in response to a users input.
I guess that means Ive 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" isnt 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 doesnt 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 its 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 havent 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.
Its 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.
0 komentar:
Posting Komentar