Convert Your CNC to a Macro Photography Rail in 30 Seconds Flat!

7,042

32

9

Introduction: Convert Your CNC to a Macro Photography Rail in 30 Seconds Flat!

If you're lucky enough to already own a CNC milling machine, here's a way to turn it into a 'rail camera' for 'focus stacked' or 'extended depth of field (EDOF)' macro photography. When you get really close to an object to take macro photos, your camera doesn't have very much depth of field, so a technique was invented to take multiple photographs from different heights, each one contributing a slice of the final picture. In order to get good coverage, the camera distance should be moved in small and equal steps between frames - which is something that a CNC mill can easily do!

Supplies

1) CNC mill

2) 1/8th in shaft from Dremel tool

3) Raspberry Pi Camera and Raspberry Pi

Step 1: You'll Need One Simple Tool...

If you have a CNC mill there's a pretty good chance you have one of these lying around - it's a shaft to connect various types of tool to a Dremel. Or you can buy one for pennies. It's the type of shaft that has a screw in the end.

Step 2: Attach the Shaft to a Corner of Your Raspberry Pi Camera

Many people who have CNC mills already have a webcam or Raspberry Pi camera attached, to remotely view or record their CNC work. If you have one, just remove it from its mount.

You'll want to adjust the focus to the closest possible. Official Pi cameras have a small lens that is lightly tacked in place to stop the focus drifting - you may need to break the glue to turn the lens into close-up mode. There are also Chinese clones of the PiCam which look similar but the lens is in a one-piece holder and cannot be focused.

The ideal lens is one similar to the attached images, which is easily re-focused, such as comes with the ArduCam cameras.

Attach the shaft to a corner of your Raspberry Pi Camera - any corner will do.

Step 3: ... and Insert the Shaft Into the Collet.

It fits in to the tool holder collet just like any CNC tool. Obviously you don't want to spin the motor! Either just be careful not to turn the spindle on, or be extra cautious and remove the +/- wires to the spindle (which you can cover with tape to avoid accidental shorts).

Step 4: And Now Take Some Pictures!

Use the GCODE interface to raise or lower the Z axis a small unit at a time (eg 0.5mm) and snap a photo using the raspistill command on your Raspberry Pi. Then process the image stack with one of many utilities, such as CombineZP, PicoLay, EnFuse, and TuFuse. Experienced CNC users/programmers could easily automate the rail movement and picture taking.

CNC Contest 2020

Participated in the
CNC Contest 2020

Be the First to Share

    Recommendations

    • Home Decor Challenge

      Home Decor Challenge
    • Explore Science Challenge

      Explore Science Challenge
    • Box Challenge

      Box Challenge

    9 Comments

    0
    VinayDand
    VinayDand

    9 months ago

    Nice instructable and clever usage of resources.
    Is 'CombineZP' is maintained currently?
    Can not locate it's official site / developer page
    Any pointer to this will be appreciated

    0
    L.L.Moorloch
    L.L.Moorloch

    9 months ago

    Would someone please tell me what a CNC tool is?

    0
    mcshrade
    mcshrade

    Reply 9 months ago

    CNC stands for computer numerically controlled machining. You write a program and send it to the machine, set the tool heights, set your XYZ zero points. If you set all the parameters right and hit GO the machine will start milling the part you programmed it to make. That's a very basic explanation from a machinist of 25 years.

    0
    ArthurW21
    ArthurW21

    Question 9 months ago on Step 4

    Love the project! What CNC controller are you using? I can send you a Smoothieboard for free if you are ready to do a short writeup in the smoothie documentation on how somebody would reproduce the CNC-controller-related steps of what you are doing.

    0
    gtoal
    gtoal

    Answer 9 months ago

    The CNC is a Sainsmart 3018 and the controller board is their GRBL one. I do appreciate the offer of a free board but really there is nothing at all controller-specific in the way I'm using this. The G-Code to move the Z axis is pretty simple - something like "G0 Z15" for example to set the Z axis to 15mm above the surface. You could do it trivially with the Jog controls of any package.

    0
    allan.sheldon8
    allan.sheldon8

    9 months ago

    Quite simply, brilliant idea. I’ll be doing this later today.

    0
    InarcoC
    InarcoC

    9 months ago on Step 4

    I don't hava a CNC. Neither do I have a PiCamera. But a 3D printer and a fixed-focus endoscope camera could do the trick. Thanks.

    0
    jessyratfink
    jessyratfink

    10 months ago

    Clever use of a CNC :D