Mechatronics Exercises

Workspace Navigation

Photogrammetry based 3D scanner

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

Joose Lankia

1 Introduction

Photogrammetry is a 3D scanning method in which many photos are taken of an object from different directions and fed into a software that makes the 3D model based on the 3D depth information it is capable of calculating thanks to the photos taken from different angles. The goal for this project is to build a device that will rotate an object and move a smartphone around it to take pictures of the object from all the different directions. The data processing is then made by a smartphone app and a 3D model can be exported. 

2 Parts

For this project, the following critical parts have been bought:

AZ-Nano V3-Board with ATMEGA328 CH34019.99€
MOTOU NEMA 17 Stepper Motor2


A4988 Stepper Motor Driver2


(per unit)

Ahorraluz Transformer 12V DC 2A 24W Power Supply


HD44780 1602 LCD Module


I2C interface


3 Current progress

What has been done:

All the parts listed above has been ordered and they have arrived. Until now (16.3.2022), I have been focusing on getting the electronics working. The working principle can be seen in the following video. First of the stepper motors rotates a turntable where a scanned object is placed. The turntable rotates one full revolution by stopping after set intervals, so that a camera can take photos from all the different angles. After one full rotation, the second motor moves the camera in vertical direction and the turntable does new rotation and so on until all the angles have been captured on camera.

The lcd screen show the current progress of the scan by displaying how many pictures have already been taken. 

View file

The Arduino code:

Wiki Markup
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd = LiquidCrystal_I2C(0x27, 16, 2);

// Setting up pins for both of the motors
uint8_t M1_step = 2;
uint8_t M1_dir = 3;
uint8_t M2_step = 4;
uint8_t M2_dir = 5;

// This controls how many stops there will be for the turntable and the ring
int table_positions = 10;
int arc_positions = 5;

// This controls how much each motor will spin every time (needs to adjusted later)
int steps_M1 = 1000;
int steps_M2 = 1000;

int usDelay = 950;

// Counter for the progress that will be shown on the screen
int pictures_taken = 0;

void setup() { 
  pinMode(M1_step, OUTPUT); 
  pinMode(M1_dir, OUTPUT);
  pinMode(M2_step, OUTPUT);
  pinMode(M2_dir, OUTPUT);

void loop() {
  for (int i = 0; i < arc_positions; i++) {
    for (int j = 0; j < table_positions; j++) {
      lcd.setCursor(0, 0);
      lcd.print("Pictures taken:");
      lcd.setCursor(0, 1);
      lcd.print(String(pictures_taken++) + String("
/ 100"));

      take_steps(steps_M1, usDelay, M1_step, M1_dir);
    take_steps(steps_M2, usDelay, M2_step, M2_dir);

// Function for spinning a motor
void take_steps(int steps, int usDelay, uint8_t step_pin, uint8_t dir_pin) {
  digitalWrite(dir_pin, HIGH);
  for (int i = 0; i < steps; i++) {
    digitalWrite(step_pin, HIGH);
    digitalWrite(step_pin, LOW);

What needs to be done next:

On the electronics side, the whole system will be controlled with couple of buttons and that action is yet to be done. Also, the Arduino needs to be controlled by external power source. The action of taking the pictures is also yet to be done and so is the led lights which will provide uniform lighting to the object. In the end, all the electronics will be semi-permanently soldered so that there is no risk of messing up the wirings afterwards. 

On the mechanical side, almost everything needs to be still done. The contraption will be mounted on a plywood base board and the ring will probably be made of aluminium. The ring will be mounted on 3D printed rollers. The mount connecting the mobile camera to the ring will either be bought or made by myself. The next step is to start working on the ring and the mounts for it. Planning and 3D modeling for the mounting mechanism has been started, but there is yet very little to show. 

Current problems: 

The main problem would have to be the lack of time. Until now, not much time has been available but hopefully next week I will start working on the mechanical parts. There were some problems with the electronics, but they have been overcome, so hopefully on that side there should not be any more major problems.