Arduino Controller for Automated 360° Product Photography

3,711

34

3

About: FluxGarage is a project of Dennis Hoelscher from Hellfish Design, Germany.

Let's build an arduino based controller that controls a steppermotor and a camera shutter. Together with a steppermotor driven turntable, this is a powerful and low cost system for automated 360° product photography or photogrammetry.
The automatic camera shutter is based on a great library from „Sebastian Setz“ and works for infrared triggered cameras of Nikon, Canon, Minolta, Olympus, Pentax, Sony.

I've prepared two versions of the controller:

  • A basic version that is operated with a simple pushbutton and a status led.
  • An advanced version that uses a 16x2 LCD + keypad shield and thus has a menu to change the variables „on the fly“ and not only in the sourcecode.

What does the controller do?

If you trigger a „photoshooting“ by pushing the button, the turntable performs a full revolution, divided into a predefined amount of steps. After each rotation step, the controller makes a short break and then triggers the camera. You will be able to change the variables of the rotation speed, the delay time and the number of steps in the source code (for simple controller version) or in the display menu (advanced controller version).

Step 1: Gather Parts and Files

Parts:

  • Arduino Uno (or similar)
  • Breadboard (halfsize breadboard fits)
  • Easydriver Stepper Motor Driver
    https://www.sparkfun.com/products/12779
  • 2X Heatsink for Easydriver (optional but HIGHLY recommended)
    https://www.sparkfun.com/products/11510You'll need thermal tape to fix the heatsink onto the chip. If you order your heatsink, make sure that termal tape is inclued or can be ordered separately.
  • Infrared LED 950nm (for IR camera trigger)
  • Resistor 220 ohms (pre-resistors for infrared-LED)
  • Piezo sound element (optional, if you want to have feedback sounds)
  • Some Jumper Wires
  • External Power Supply for Steppermotor
    I made good experiences with a 12V 1A power adapter to drive a 1A NEMA 17 Steppermotor from Trinamic. I also had a 24V 3A power adapter in use. The Easydriver board supports up to 30V and 750mA per phase. More on the easydriver-specs here: http://www.schmalzhaus.com/EasyDriver/index.html
  • Socket for steppermotor's external power supply
  • Bipolar NEMA 17 Steppermotor and Turntable e.g. the FluxGarage „Automated Turntable With Steppermotor“ Link: https://www.instructables.com/id/Automated-Turnta...

Add for basic pushbutton-controller ...

  • Pushbutton
  • Resistor 10k ohms (for the pushbutton)
  • LED (status-led)
  • Resistor 220 ohms (pre-resistors for status-LED)

... OR add for advanced controller with display+keypad menu:

Download the Arduino codes and Fritzing diagrams for basic and advanced controller:
https://github.com/FluxGarage/Controller-for-Stepp...

If you want to open the Fritzing document for the advanced controller, make sure to download and install the adafruit elements: https://blog.adafruit.com/2012/08/27/how-to-insta...


Please note:
On the pictures I'm using the FluxGarage „Tinkerer's Baseplate“ and the FluxGarage „Front Plate for 16x2 LCD + Keypad Shield“. Using those elements is optional, if you also want to use them, klick at the links for the regarding instructables.

Step 2: Assemble Circuit

Solder Easydriver board for breadboard use:
In order to use the easydriver on a breadboard, you need to solder some male pin headers on the board. The best way is to put the male pin headers into the breadboard, lay the easydriver on top and then solder the pins.

Wiring up:
Wire up the parts as shown in the regarding Fritzing graphic for the basic or advanced controller. Download the Firtzing diagrams on github, find the links in step 1.

Double check if everything is connected as follows:

  • Arduino digital pin 02 = dir pin of Easydriver
  • Arduino digital pin 03 = step pin of Easydriver
  • Arduino digital pin 09 = output for piezo
  • Arduino digital pin 12 = output for infrared LED (place 220 ohms pre resistor before led)

+ for Basic Controller:

  • Arduino digital pin 04 = input for pushbutton (place 10k ohms resistor before button ground)
  • Arduino digital pin 13 = output for status LED (place 220 ohms pre resistor before led)

+ for Advanced Controller:

  • Stack the display + keypad shield onto the arduino, actually those pins are used: Arduino analog pin A4+A5 and 5V+GND.

Connect Steppermotor:
Wiring up bipolar stepper motors (4 wires) is about connecting the two coils (A and B) of the motor to the right pins of the easydriver board.
Take a look at the graphic in the middle of this page and at the specs of your specific stepper motor:
http://www.schmalzhaus.com/EasyDriver/index.html

You can also find more information about wiring up your stepper motor and the Easydriver here: http://bildr.org/2011/06/easydriver/

Connect External Power Supply
The Easydriver board has two separate power pins on the upper right side (M+ and Ground). While the board itself gains power from the Arduino, the separate input provides power for the steppermotor. If you use a typical „out of the box“ power adapter and a socket, you should connect the „+“ wire to the „M+“ pin of the easydriver and the „-“ wire to easydriver's the „GND“ pin. Usually the „+“ is on the inner side, whereas the „-“ is on the outer side of the plug. But be careful, some power adapters allow to switch the polarity! If you wire your easydriver incorrect, it may and will probably be damaged, keep that in mind.

Step 3: Upload Sourcecode to Arduino

Download the Arduino sourcecode at Github:
Find download link at step 1.

Download Arduino IDE:
https://www.arduino.cc/en/Main/Software

Download the third party libraries and copy them to your IDE's library folder:
… for the camera shutter:
https://github.com/dharmapurikar/Arduino/tree/mast...
… for the Adafruit 16x2 Display+Keypad Shield:
https://github.com/adafruit/Adafruit-RGB-LCD-Shiel...

The code is tested and works fine with the latest Arduino IDE (1.8.7 on windows) and Arduino Uno + Easydriver Stepper motor Driver + Adafruit 16x2 Display+Keypad Shield, + a Trinamic stepper motor and a Nikon D60 camera.

Adjust code to work with your specific camera:
As mentioned, I used the „multiCameraIrControl.h“ library by Sebastian Setz. To make it work for your camera, you have to delete the comment slashes before your camera manufacturer name and of course add slashes before all the other manufacturer names:

// Set Camera Type<br>Nikon D5000(12);<br>//Canon D5(12);<br>//Minolta A900(12);<br>//Olympus E5(12);<br>//Pentax K7(12);<br>//Sony A900(12);

Do the similar adjusment in the „snap“ function:

// Take a picture<br>void snap(){<br>D5000.shotNow();<br>//D5.shotNow();<br>//A900.shotNow();<br>//E5.shotNow();<br>//K7.shotNow();<br>//A900.shotNow();<br>}

Please note:
Unfortunately, I wasn't yet able to test other IR triggered cameras yet than my own Nikon D60. The camera shutter library should work with several cameras of the different manufacturers, not only the specific camera models that are mentioned in the code. It would be great if you post a comment on your experiences with your Canon, Minolta, Olympus, Pentax or Sony camera.

Step 4: Operate the Controller

What does the code respectively the controller do?
If you push the button, a „photoshooting“ is triggered. Each Photoshooting is a finite loop of the following sequence:

  1. Camera is triggered
  2. Short delay
  3. Steppermotor will rotate a predefined amount of degrees
  4. Short delay

A photoshooting is based on a set of variables that determine its exact behaviour. You can change these variables in the sourcecode (for simple controller version) or in the display menu (advanced controller version).


Operating the basic controller:

On the basic controller the Status LED shows when the system is ready to perform. The LED turns off when you start a photoshooting. You can interrupt a photoshooting by holding the button until the „interrupt sound“ appears and the turntable stops. Have a look at the video in this instructable's top section to see this in "real life".

The photoshooting's variables can be found in the code's top section, and can be changed to modify the photoshooting. Below you can see the initial values:

int shootingsteps = 20; // number of steps for a full revolution, should be 10, 20 or 40<br>float shootingspeed = 0.01; // rotation speed: any number from .01 -> 1 with 1 being fastest -
Slower is stronger (slower = better for „heavy“ objects)<br>int shootingdelay = 1000; // break in milliseconds before and after each rotation


Operating the advanced controller:

When turning the advanced controller on, a FluxGarage logosplash is shown for 4 seconds. After that, the controller is ready to perform and shows a list of the adjustable set of variables:

  • ST = Number of Steps, can be 10, 20 or 40
  • SP = Rotation Speed, can be 1-5 while 1 being slowest
  • DE = Delay before and after each step in tenth of a second, can be 5, 10, 25, 50
  • LI = Determines if the display's background light is on or off while shooting. Can be 1 = on or 0 = off

You can navigate through the variable types with the left and right buttons and change the values with the up and down buttons.
Start a photoshooting by pressing the select button and interrupt a photoshooting by holding the select button until the „interrupt sound“ appears. Have a look at the video in this instructable's top section to see this in "real life".

Step 5: Start Shooting

If you've built your own controller + turntable and your camera is in place, you're all set to start shooting ... almost. Let me share some learnings from my own experiments:

  • Use a light tent to illuminate your objects evenly. You can find lots of good tutorials here at instructables.com that show how to create a diy lightbox. Also, there are inexpensive textile light tents that can be bought in many online shops.
  • Use lightbulbs with the same color temperature (Kelvin)
  • Focus the object on the turntable manually, deactivate your camera's autofocus
  • Turn off your camera's image stabilizer, if working with a tripod
  • Select a measuring range in the background, where the shot object won't appear. By doing so, you'll avoid flickering in your image sequence. Another way is to manually set your camera's exposure times etc.
  • If you want to include your 360-Images into your website, use javascript plugins like
    „Jquery Reel Plugin“ by Petr Vostřel alias „PISI”
    http://jquery.vostrel.cz/reel
    „360 Degrees Product Viewer“ by „Codyhouse“
    https://codyhouse.co/gem/360-degrees-product-view...

This is the result of one of my shootings (created with above's setting):
http://www.fluxgarage.com/turntable_360viewer.html

Share

    Recommendations

    • Toys Contest

      Toys Contest
    • First Time Author

      First Time Author
    • PCB Contest

      PCB Contest

    3 Discussions

    0
    None
    TobiM6

    19 days ago

    Amazing tech