Published 2 Apr 2018

Making 360° GIF Photos

\\ {{ :arduino:spin-scan:pc231605.jpg?200|Original camera setup to manually produce 360° animation.}}I wanted to automate the creation of 360° animated GIF photos. This sort of thing has been done many times in various ways by many people, so I am re-inventing the wheel here, but I don't have their solution to hand. The obvious way to do it appeared to be to use an Arduino board to control a stepper motor and synchronize the camera. I had previously created such animations by manually moving the camera and taking many photos, then manually aligning the images and stitching them together to get a more or less smooth animation. But this requires a subject that stays still as it takes a lot of time, and the images inevitably are slightly out of alignment. \\ \\ \\ \\ \\ Doing it the hard way, the first animation shows the raw frames jerking about, and the second shows the manually aligned frames giving a smoother animation:
Beetle with pseudo-scorpion attached Beetle with pseudo-scorpion attached
\\ \\ Finished result, trimmed manually adjusted frames:
Beetle with pseudo-scorpion attached
Animation created by trying to move a camera around the subject at a fixed distance.
===== Overview ===== The advantage of automating this by putting the subject on a rotating turntable is that the camera, lighting, distance to the subject, alignment and background all remain static. Additionally the number of images taken to get a smooth animation can be easily adjusted, and frames are in alignment without the necessity of editing or scaling to rectify variations in camera distance etc. This was to be my first Arduino based project, so I looked for examples that had already implemented the tasks required. I came across [[http://www.instructables.com/id/Build-a-DIY-Desktop-3d-Scanner-With-Infinite-Resol/|shapespeare-scanner]], a homemade 3D scanner to create 3D models. I didn't need 3D models, but just the basic automated image capture. So I purchased an Arduino Uno board, plus LCD shield and stepper controller module. I already had a bunch of stepper motors, so set to work. ===== Hardware configuration ===== I had a choice of a number of recycled stepper motors, and settled on using a [[:electronic:actuator:stepper:msaf200b51]], a Sankyo Mitsubishi flat motor with 1.8º/step (200 steps per revolution) and runs off a 12V power supply. Its low profile, and lack of any protruding shaft from underneath meant it could just sit on the desk while testing. {{arduino:spin-scan:p4188738a.jpg?640 |Arduino, LCD, Stepper controller, stepper motor}} \\ \\ \\ The hardware setup consisting of the Arduino UNO with LCD shield, stepper motor controller, stepper motor (with rubber disk on the end of its shaft as a platform for mounting subjects), and an infrared LED for controlling the shutter on the camera (the green and white wires to the left go to the 12V power supply for the motor, the rest is powered from the USB port)
===== Parts list ===== * Arduino Uno clone (duinotech UNO classic r3, p/n XC-4410) * LCD keypad shield clone (duinotech 2 x 16 LCD Controller, p/n XC-4454) * Stepper Motor controller (duinotech L298N based, Dual Stepper Motor Controller, p/n XC-4492) * [[:electronic:actuator:stepper:msaf200b51|MSAF200B51]], a Sankyo Mitsubishi stepper motor ===== The program code ===== As mentioned, I started with Shapespear's [[https://cdn.instructables.com/ORIG/F59/07PC/IJUCSTEF/F5907PCIJUCSTEF.zip|3D scanner firmware]], which was a great base as I had no experience with Arduinos at this point and his code did most of what I wanted. My code is basically the same, but I have removed the manual step-and-take-exposure button function and added a post-exposure delay selection option instead. The other minor change is that I don't use the motor enable/disable controls. The program has the stepper motor and camera-type set within the code, I assume it will be used in a fairly dedicated mode. So it would need to be recompiled and re-downloaded to use it with alternative devices ((the Arduino IDE uses the term "upload" for sending the code to the Arduino board, but in my terminology one downloads from the larger machine to the smaller machine - eg you download from the internet to your PC)). If you are using the code with a different motor, that has a different number of steps per rotation, you will need to adapt "stepsPerRevolution" and "stepChoices" \\ int stepsPerRevolution = 200; int stepChoices [] = {25, 40, 50, 66, 100, 200}; If your stepsPerRevolution divided by a stepChoice produces a fraction then it won't rotate an exact complete revolution on that setting (eg the "66" above will actually result in it only completing 356.4º). If a stepChoice is greater than stepsPerRevolution, then it will be trying to step by less than one step, and result in no movement. ^There are 6 push-button switches on the LCD shield :^^ | **Select**|Start/stop scanner| | **Left**|Cycle through post shutter delay times| | **Up**|Cycle through options for the number of exposures per revolution| | **Down**|Step one unit counter-clockwise without triggering camera| | **Right**|Step one unit clockwise without triggering camera| | **Reset**|Reset scanner| To operate, select the number of steps to take, and change the delay option that determines how long it waits after triggering the shutter, before taking the next step. Then press 'select' to start the scan. Some of the delay options here are quite long (6000 mS = 6 seconds) for situations where the camera might take a long time to take and save the image - eg for a camera that can do internal focus-stacking and combines multiple, rapidly taken, shots each time the shutter is triggered. The scan can be paused at any stage by pressing 'select' to pause and then 'select' again to resume. While paused all the buttons can be operated and you can then resume, but if you change the number of steps it will reset the exposure count before continuing. The reset button stops and resets everything as though it has just been powered on. All these functions except "Up" (cycle through exposure count options) are live, even during a stepping run, so that you can tweak things while a scan is in progress. I might update the code so that the manual step options are just step one stepper motor step, rather in units of stepsPerRevolution/stepChoices, as that would be more useful for aligning the photographic subject exactly where I want it. Here is my modified version of Shapespear's code so far :\\ {{arduino:spin-scan:scanner_firmware-2.ino}}\\ and you would need :\\ {{arduino:spin-scan:multicameraircontrol.cpp}} and\\ {{arduino:spin-scan:multicameraircontrol.h}}\\ ===== The results ===== Below are some initial scans, still a bit of work to do, but promising results:
Animated dead longhorn beetle
Animation showing a dead longhorn beetle found outside our house.
Animation chiton 'valve'
Animation showing a 'valve' (plate) from a chiton shell.
===== Further ideas ===== I have further work to do to setup good lighting and methods of mounting photographic subjects to give the best results. Also it would be useful to package this up in a portable form so the I can photograph subjects in the field. The setup would also work fine for operating a microscope camera, the stepper would be connected to adjust the microscope up and down to move the focus and take multiple photos that are then combined with focus-stacking software to produce sharp macro photos. At the moment the exposures taken are stored in the camera, and have to be downloaded. An enhancement would be controlling the camera via USB (eg [[http://chdk.wikia.com/wiki/CHDK|CHDK software]]) and extracting the photos as they're taken. ====== References and Additional Resources ====== * [[http://www.instructables.com/id/Build-a-DIY-Desktop-3d-Scanner-With-Infinite-Resol/|Shapespeare 3D scanner]]. * [[http://www.regard3d.org/|]], converts photos of an object into a 3D model. * [[http://www.doc-diy.net/photo/remote_pinout/|Camera remote release pinout list]]. If any referenced page no longer exists, try looking for its URL on http://archive.org. \\ ----
 [[:start|Home Page]]   [[:about|About this Site]]   [[:copyright|Copyright Questions]]   [[:contact|Contact Us]]
\\ \\