Arduino Controller for Automated 360° Product Photography

11,355

62

21

Introduction: Arduino Controller for Automated 360° Product Photography

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).

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

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:
https://github.com/FluxGarage/Controller-for-Steppermotor-Turntable-and-IR-Camera-Shutter

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

Be the First to Share

    Recommendations

    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    21 Discussions

    0
    matuskms
    matuskms

    Question 2 months ago

    Can it working with smartphone?

    0
    FluxGarage
    FluxGarage

    Answer 2 months ago

    Hi matuskms,
    this controller can't yet trigger smartphone cameras, but I'm experimenting with bluetooth/wifi camera triggering. So there may be another controller version ready within the next few months.

    0
    JanezD
    JanezD

    Question 3 months ago

    Great project. I like it. However my Nikon D5600 doesn't support IR. Do you know for option to replace IR with WiFI trigger option. Thank you.

    0
    FluxGarage
    FluxGarage

    Answer 3 months ago

    Hi JanezD,
    with some further development work, it should be possible to extend this controller with wifi functionality. For example, you could add an esp8266 wifi module and replace the content of the snap(); function with the wifi trigger code.
    I'm planning to develop a new controller version that is able to do such things, but I don't know yet when I will have time to do that.

    1
    CarlosR478
    CarlosR478

    4 months ago

    It's working like a charm but actually got a lot of troubles with my Canon EOS 60D. It turns out that the link for the multicamerairlibrary it's outdated, and with that one it didn't even compiled me the code. However the same author has the updated library in another portal (the new one is from 2016), and that one works flawlessly.

    0
    CarlosR478
    CarlosR478

    Reply 4 months ago

    And thank you very much guys for this guide, you don't know how much work I am saving with this.

    0
    3dbybrunolopes
    3dbybrunolopes

    Reply 3 months ago

    Hi Carlos,
    I've also a Canon 60D, can you link us for the library you found?
    Thanks

    0
    FluxGarage
    FluxGarage

    Reply 4 months ago

    Hi Carlos, thank you for your feedback and the hint to the updated multicamerairlibrary. Could you post a link to the library version from 2016?

    1
    chadfx
    chadfx

    Reply 4 months ago

    I found this one from 2013:
    https://github.com/andaluri/multiCameraIrControl

    It looks like the snap command has changed from 'shotNow' to 'shutterNow'

    Still in the process of trying to get it running, so I can't confirm if this works yet.

    0
    bcboy1956
    bcboy1956

    4 months ago

    Hi
    I have a Stepper Motor 28BYJ-48 that I would like to use it has enough torque to turn my platform that I ran on another program. Waht in the code would I need to change?


    I know the Stepper Motor 28BYJ-48 each step corresponding to a rotation of 11.25 degrees according to the datasheet. That means there are 32 steps per revolution (360/11.25 = 32). In addition, the manufacturer has specified a gear ratio of 64:1 for the 28BYJ-48 stepper motor. To obtain the final number of steps, the gear ratio must be multiplied by the number of steps per revolution, 32. The more accurate value for the gear ratio is actually about 63.68395 : 1. Therefore, we set the final number of steps to 2038 (32 x 63.68395 = 2037.8864).

    0
    FluxGarage
    FluxGarage

    Reply 4 months ago

    Hi bcboy,
    there are two functions in the code for rotating the stepper motor:
    - void rotate(int steps, float speed)
    - void rotateDeg(float deg, float speed)
    Currently, the rotageDeg is used, where the input argument is a degree value. I'd suggest to use the "rotate function" where you can just use a "steps" value as an argument.
    So you should go to the "void photoshooting()" function and replace the line "rotateDeg(360/shootingsteps, shootingspeed);" with "rotate(2038/shootingsteps, shootingspeed) first.
    If you use the advanced controller, the value "shootingsteps" can be 10, 20 or 40, so the 2038 will be divided by the selected value. I'm not sure if there will be rounding problems then. You could then try to declare the "steps" as a float variable:
    void rotate(float steps, float speed)

    I hope I could point you in the right direction.

    0
    bcboy1956
    bcboy1956

    Reply 4 months ago

    Hi
    Thanks I made the changes you suggested I am getting a small partial turn. I have used smaller numbers "shootingsteps" 2,4 6. rather then the 10,20, 40 numbers.
    I read some more on easy drivers and realized the easy driver default to 1/8 step, read more still not sure how to change it to full step?
    I do not understand how to "You can pull either or both to ground" Is it in the physical wiring or in the code?

    "You can pull either or both to ground to select the other 3 modes if you want. See the table below:"
    http://www.schmalzhaus.com/EasyDriver/
    MS1MS2ResolutionlowlowFull Step (2 phase)highlowHalf steplowhighQuarter stephighhighEight step

    0
    FluxGarage
    FluxGarage

    Reply 3 months ago

    Hi bcboy,
    yes, the easydriver supports mircostepping and thus each full step is based on 8 microsteps. I think it makes sense to multiply your 2038 full-steps with 8 and look if that works:
    -> "rotate(16304/shootingsteps, shootingspeed)"

    It seems that your stepper motor is an unipolar motor with 5 wires?

    I'm also not familiar with all the different stepper motor types, but as mentioned on the easydriver page, 5 wire motors probably don't work:
    "You can use 4-wire, 6-wire or 8-wire stepper motors. The only kind you can't use is 5-wire stepper motors. (They need uni-polar drivers.)"
    http://www.schmalzhaus.com/EasyDriver/

    1
    bcboy1956
    bcboy1956

    Reply 3 months ago

    Hi
    Thanks that worked, no idea why I did not think of it! ULN2003 Stepper Motor ,yes it is a uni-poplar stepper motor but changed by following the instructions break the red wire circuit under the blue plastic cover at this site
    https://simvim.com/tech_28byj.html .


    1
    Charhead
    Charhead

    4 months ago

    Great Tutorial, it works fine with a Nikon D5300 and Olympus OM-D E-M10

    Thy

    0
    FluxGarage
    FluxGarage

    Reply 4 months ago

    Hi Charhead, thank you for your feedback! Glad to hear that the controller works with your Nikon and Olympus cameras. Wish you lots of fun with your project ;)

    0
    Shakkarius
    Shakkarius

    7 months ago

    I got several errors while compiling the script. So I can't upload and test.
    For example:
    Documents\Arduino\libraries\tiny/TinyDebugSerial.h:682:22: error: cannot convert 'TinyDebugSerialWriter_9600* {aka int*}' to 'TinyDebugSerialWriter*' in assignment
    _writer = &tdsw9600;
    ^~~~~~~~

    0
    FluxGarage
    FluxGarage

    Reply 6 months ago

    Hi Shakkarius,
    it seems that you are trying to compile the code for an ATtiny chip, right? Both versions of the current controller code are considered to be used with an Arduino Uno, meaning an ATmega328 chip.
    I know that there are some instructables here on how to use an ATtiny85 chip as a stepper motor controller, but I did not check them in detail. E.g. this:
    https://www.instructables.com/id/Attiny85-as-a-StepDir-Stepper-Motor-Controller/

    0
    TobiM6
    TobiM6

    1 year ago

    Amazing tech