| Both sides previous revisionPrevious revisionNext revision | Previous revision |
| arduino:Spin-Scan [2020/01/12 18:09] – tony | arduino:Spin-Scan [2026/10/15 23:37] (current) – tony |
|---|
| \\ | \\ |
| |
| {{ :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. | 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.\\ |
| \\ \\ \\ \\ \\ | {{ arduino:spin-scan:pc231605b.png?400 |Original camera setup to manually produce 360° animation.}} |
| | \\ |
| |
| 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: | 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: |
| ===== Hardware configuration ===== | ===== Hardware configuration ===== |
| |
| * Arduino Uno clone (duinotech UNO classic r3, p/n XC-4410) | 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. |
| |
| * LCD keypad shield clone (duinotech 2 x 16 LCD Controller, p/n XC-4454) | {{arduino:spin-scan:spinscan2.png?800|Fritzing connection illustration of Arduino, LCD, Stepper controller, stepper motor}}\\ |
| | The hardware setup consisting of the Arduino UNO with LCD shield, stepper motor controller, stepper motor, and an infrared LED for controlling the shutter on the camera. |
| |
| * Stepper Motor controller (duinotech L298N based, Dual Stepper Motor Controller, p/n XC-4492) | ===== Parts list ===== |
| | * Arduino Uno clone (duinotech UNO classic r3, p/n [[:electronic:boards:arduino:xc4410|XC4410]]) |
| | * LCD keypad shield clone (duinotech 2 x 16 LCD Controller, p/n [[:electronic:boards:shield:xc4454|XC4454]]) |
| | * Stepper Motor controller (duinotech {{:electronic:datasheet:stmicroelectronics:ds_l298.pdf|L298N}} based, Dual Stepper Motor Controller, p/n [[:electronic/boards/xc4492|XC4492]]) |
| | * [[:electronic:actuator:stepper:msaf200b51|MSAF200B51]], a Sankyo Mitsubishi stepper motor |
| |
| I had a choice of a number of recycled stepper motors, and settled on using a [[:electronic: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 implementation with a rubber disk on the end of the stepper motor shaft as a platform for mounting subjects. The green and white wires to the left go to the 12V power supply for the motor, the rest is powered through the USB port connected to the Arduino) |
| {{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) | |
| | |
| <html><br style="clear: both;" /></html> | |
| |
| ===== The program code ===== | ===== 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. | 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)). | 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" \\ | 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" \\ |
| | **Select**|Start/stop scanner| | | **Select**|Start/stop scanner| |
| | **Left**|Cycle through post shutter delay times| | | **Left**|Cycle through post shutter delay times| |
| | **Up**|Cycle through options for number of exposures per revolution| | | **Up**|Cycle through options for the number of exposures per revolution| |
| | **Down**|Step one unit counter-clockwise without triggering camera| | | **Down**|Step one unit counter-clockwise without triggering camera| |
| | **Right**|Step one unit clockwise without triggering camera| | | **Right**|Step one unit clockwise without triggering camera| |
| 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. | 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 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. | 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 :\\ | Here is my modified version of Shapespear's code so far :\\ |