My Take on macro rail

oracacle

Senior Member
After having been obtained a macro lense i was bondering what to photo graph with it. While looking around on the interent i found that several members had made electronic macro rail using picaxe, and old PC parts.

After looking around for a bit i found an old broken DVD RW and a half broken 20X2 (port b doesnt work). after a quick order of some L293D ICs and a question on the forum about its voltage i found myself by able to control the carriage of this old drive.
The main addition I have made is a couple of switches so the 20x2 knows whenthe carriage is at the extremes of the rails. well when i saw switches, bnot being able to find some light weight switches in maplin (I may order some at some point), i used some stripped wire and made contact on both the carriage and rail ends using some blu-tack. This made a sort of contact stop with +v being carried by the carriage.

With a little experimenting i found that the half step provided by the drives stepper motor wasn't really a half step, more like a 1/4 then 3/4 step, but with a single step only moving the carriage 0.15mm this wasn't an issue.

The internet led me to several pieces of stacking software, the one that came up most often was zerene, which i am using the trial of at the moment (I may plump the £60 for it at some point)

This i my first real attempt at macro photography
Results:

large-leaf by f2268d215cc925918731918f4efa0289, on Flickr
 

Attachments

oracacle

Senior Member
Nearly forgot to post code, still a little sloppy but works a charm

Also picture of my end stops

Code:
#rem
DVD RW
Stroke - 40mm
Step - 0.15mm

Currently require terminal to operate, for inputing item length
#endrem

#picaxe 20x2
#terminal 9600

let dirsc = %10001111
symbol stepp	= w0
symbol coil		= b2
symbol out		= b3
symbol bytes	= b4
symbol loops	= b5
symbol distance	= w3
symbol words	= w4
symbol cm		= b10
symbol dp		= b11
symbol ret		= 13
symbol lfeed	= 10
symbol com		= 44
symbol space	= 32
symbol shutter	= w6

pause 2000										'allow terminal to open

init0:
	if pinc.4 = 1 then							'check for carriage in position 1
		sertxd ("Calibrating",ret,lfeed)				'send start if rail
		goto init1								'if at start, go to other end
		End if
	inc coil									'increment coil position
	gosub position								'move motor
	goto init0
	
init1:
	let coil = coil - 1							'decrement coil position
	inc stepp									'increment step
	gosub position								'move motor
	if pinc.5 = 1 then							'check for end of rail
		let stepp = stepp - 4						'add margin to stop hinting end in normal use
	'now send number of step for complete rail
		bytes = stepp * 15 / 100
		bintoascii bytes,b55,cm,dp
		sertxd (cm,46,dp,"cm",ret,lfeed)
		let bytes = stepp / 2						'calculate centre of rail
		'pause 1000
		for loops = 0 to bytes						'move carriage to centre of rail
		inc coil								'increment coil position
		gosub position
		next loops
		let pinsb = %00000000
		sertxd ("Calibration Complete",ret,lfeed)			'inorm middle has been reached
		'this is when user setup item and camera, will need buttom press when ready
		pause 2000
		goto main
		end if
	goto init1
	
main:
	#rem
	the user will need to insert the distance to be covered
	this number will need to be multiplied by 100, as will
	the 0.17 for each step
	
	the user will input distance in cm to 1 dp, this means
	the picaxe can easily recive the data and calculate the mm
	needed providing distance stays below 10cm
	
	if 2.3cm is entered the cm is multiplied by 10 and then has
	the dp added, in this case (2 * 10) + 3 = 23mm
	#endrem
	
main1:
	sertxd ("Please input distance, including DP and stop",ret,lfeed)
	serrxd #cm,#dp								'user input
	let distance = cm * 10 + dp * 100					'Calculate distance
	let words = distance / 15						'find number of steps for item
	if words > stepp then							'check item not to large
		let bytes = stepp * 15 / 100
		bintoascii bytes,b55,cm,dp
		'if too large, send message including max size
		sertxd ("Outside Operating Range, Max:",cm,46,dp,"cm",ret,lfeed)
		goto main1
		endif
	let words = words / 2	
	sertxd ("Moving to starting position",ret,lfeed)		'show about to start pictures
	for loops = 0 to words							'loop to start
	if pinc.4 = 1 or pinc.5 = 1 then goto err				'check for position
	gosub position								'move to postion
	let coil = coil - 1							'decrease coils
	pause 50									'move slowly so item is not disturbed
	next loops
	let words = distance / 15	
	sertxd ("Place item on carriage and setup camera",ret,lfeed,"set focus for furthest point",ret,lfeed,"Send 'C' to continue",ret,lfeed)
	serrxd ("C")								'Wait for user to send
	'ask for shutter time set on camera	
	sertxd ("Please enter shutter time in seconds (max 9), followed by stop",ret,lfeed)
	serrxd #shutter								'recieve shutter time

	if shutter < 1 then							'check for less than 1 second
		shutter = 1								'add value for pause
		end if
	let shutter = shutter * 3						'incread value to allow storage time
	let w7 = shutter * stepp / 60
	sertxd ("time Per Shot: ",#shutter," sec",ret,lfeed,"Total time: ",#w7," mins",ret,lfeed)			'tell user how long each shot will take
	let shutter = shutter * 1000						'set pause value
		
	sertxd ("Number of Shots: ",#words,ret,lfeed)
		
	pause 500
	sertxd ("Starting Sequence",ret,lfeed)				'show about to start sequence
	let words = distance / 15						'find number of steps for item
	for loops = 0 to words							'loop
	if pinc.4 = 1 or pinc.5 = 1 then goto err				'check for over margin
	inc coil									'increment coil
	gosub position								'move motor
	pause 500
	'fire camera and wait for it to store
	pulsout c.7, 2000								'fire camera
	sertxd (#loops," of ",#words,ret,lfeed)				'send info to user
	pause shutter									'wait for camera to store
	
	next loops
	sertxd ("Sequence Complete")						'tell user sequence complete
	end
	
err:
	'a problem has occored and the carriage has moved to the end of the rail
	let bytes = stepp * 17 / 100	
	bintoascii bytes,b55,cm,dp
	sertxd ("Outside Operating Range, Max:",cm,46,dp,"cm",ret,lfeed)
	end
	
position:
	let coil = coil & %00000011 						'mask lower two bits of coil
	lookup coil,(%1010,%1001,%0101,%0110),out				'lookup up coil polarity
	let pinsc = out
	return
 

Attachments

dsvilko

Senior Member
Excellent result! I have always wondered if the small bipolar stepper used in most of today's DVD drives is precise enough for macro stacking. Even though I usually use 0.05-0.1mm steps at about 3X magnification, 0.15mm is certainly fine enough for lower magnifications. It definitely makes the mechanics almost trivial.
Looking forward to seeing some more of your stacker macro photos.
 
Top