Skip to content

Mini Total Station

Inspiration

Everything starts with an inspiration. As a civil engineer, I always admired the principles and instruments of surveying, the basic and primordial tools of any construction process. Digital theodolite or Total Station is one such instrument.But these instruments came at a high price. I was really inquisitive in knowing what’s inside this instrument. This took me to my project.

Research

After deciding on the project, I did search exhaustively in the internet for any information that can positively help me for the project. The issues that I wanted to know was
1. What is the best sensor for accurate angular measurement ?
2. Which is the best sensor for accurate distance measurement ?
3. Am I gonnna include optics (telescope) to it ?
4. What’s the range and accuracy I need ?
5. How much cost can I spent on the project ?, afterall it is not a real prototype one that I am making. All Academy intends is that we learn basic principles of digital fabrication. ( It took me a while to understand this.)

The fact was that I couldn’t find any guiding resource on building the T station, which meant I am on my own. Neither did I find any DIY documents or manufactures’s ripped up drawings on this.

Sensors

After my Input Week, I got familiar with all sorts of sensors that could be incorporated in a project. I did search exhaustively in the Academy pages too to find the best suited sensor for my job. The idea was that I would find the best sensor, check its accuracy, price and finally settle with the decision.

MPU 6050 as Angle Sensor

MPU 6050

This sensor is used universally in drones, and all motion tracking instruments. This is essentially a six axis combined accelerometer and gyroscope. It gives rate of change of rotation and rate of change of acceleration in motion. However this article was an eye opener to me. What I wanted was to measure angle, but the gyroscope gave only rate of change of angle. To convert that to angle we need to integrate this rate of change over the period to get the angle measured. The problem was that this addition would add all the error too in angle rate measurement cumulatively to get a big error on the final angle measurement. So the option was ruled out.

Stepper motor as Angle Sensor

During machine week I understood the effectiveness of stepper motor to move according to calculated pulses given. The idea was that instead of manually bisecting the target by turning the sensor, the stepper can be turned using a switch or joystick. A typical stepper would give 200 pulses per revolution. A feedback counter can be included in the program to measure the rotation of the stepper. Everytime stepper is given a pulse a counter will be initiated to add the values incrementally. This way clockwise and anticlockwise rotations can be recorded. To increase the resolution of 200P/R I could include gears to increase the resolution by accomodating the chances of error by way of slip. But by including gear housing and all my instrument will become more bulky and complex. So this too was ruled out.

Optical Incremental Encoder as Angle Sensor

Search for a more reliable and simple angle measuring sensor took me to rotary incremental encoders. These encoders work in a way similar to stepper, the only difference being upon rotation the encoders would return pulses.

An optical encoder is an electro mechanical device. It houses a rotating shaft on which a disc which is alternatively perforated or alternatively opaque and transparent segments are mounted to. A photo emitter diode is kept on one side of the disc and photo receiver on the other end coaxially. As the disc rotates the the path of the photo emitter gets alternatively blocked and opened by the disc. Whenever the light passes through the slit or transparent segments the analog signal of 1 is recorded.When it is blocked an analog 0 is recorded. The smaller these segments more would be the resolution of the encoder. Encoder inside
Source : http://www.optical-encoders.eu/optical-encoder.html

There are several types of rotary encoders. Absolute and relative (incremental) encoders are the two main types.While an absolute encoder outputs a value proportional to the current shaft angle, an incremental encoder outputs the step of the shaft and its direction.

An incremental rotary encoder generates two output signals while its shaft is rotating which is also called quadrature ouptut. Depending on the direction, one of the signals leads the other. You can see the output signal waveforms of an incremental rotary encoder and the expected bit sequence below. Encoder output Source: https://github.com/whitecatboard/Lua-RTOS-ESP32/wiki/ENCODER-module
As you can see from the figure, both of the outputs stays HIGH at the initial state. When the encoder shaft starts to rotate in clockwise direction, Output A falls to LOW first and Output B follows it with a lag. In a counter-clockwise direction the operation turns opposite. Time intervals on the waveform depend on the rotation speed but the signal lagging is guaranteed in encoder operation. An encoder with 600 pulses per revolution was ordered online. Encoder Source:https://robu.in/product/incremental-optical-rotary-encoder-6002400-pulse-600-ppr/?gclid=EAIaIQobChMIoLmj7pnL4gIVlIaPCh0YrwlKEAQYAyABEgIp1PD_BwE

Electronic Distance Measuring Sensor

There were many options for sensing distance like Infrared,LASER,using ultrasonic waves etc. I decided to do it with LASER. For maximum range and accuracy LASER is to be used.
LASER works on the principle of Time of Flight. A LASER distometer emits a pulse of laser at a target and the receiver module will measure the time of return of this pulse. Knowing the velocity of the LASER pulse the distance can be easily found out. A typical LASER distance measurement module of range 50m was ordered online. EDM Source:https://www.aliexpress.com/item/50m-164ft-Laser-Distance-Measuring-Sensor-Range-Finder-Module-Low-cost-Diastimeter-Single-Continuous-Measurement/32792768667.html?spm=2114.search0104.3.8.3e8e415b2ZaxiL&ws_ab_test=searchweb0_0,searchweb201602_2_10065_10068_319_10059_10884_317_10887_10696_321_322_10084_453_10083_454_10103_10618_10307_537_536,searchweb201603_53,ppcSwitch_0&algo_expid=064474d9-bf8e-4d7c-b177-2e45893fc073-1&algo_pvid=064474d9-bf8e-4d7c-b177-2e45893fc073&transAbTest=ae803_4

Using Alidade Bar instead of telescope

In a standard T station targets in the field are bisected using telescopes with eye piece and objective lens. With project getting bulky, I decided to skip this part as I would be needing only an Alidade bar for this purpose. I would mount LASER module on this and bisect the target using LASER beam. Alidade
A typical alidade used in Plane Table Surveying

Designing

Before arriving at the primary requirements of mini T station, I had to research upon the basic working principle of a conventional theodolite/ traverse. Theodolite axes Source : https://commons.wikimedia.org/wiki/File:Theodolite_vermeer.png
The figure above shows the basic axes in a T station/theodolite. The instrument shall have two mutually orthogonal axes. Vertical and Horizontal angles are measured with reference to the horizontal and vertical axes respectively. The line of sight or the line of collimation is the line of the laser. During measurement this line of LASER shall be perpendicular to the vertical axis. This is checked by means of a plate bubble level fixed to the top side of the LASER module. The horizontal level is maintained by a vertically immovable shaft passing through the vertical frame. This vertical frame is connected orthogonal to the base plate. The laser module with the bubble level is connected at right angle to the horizontal shaft. The rotation in horizontal plane is ensured by fixing a horizontal roller bearing. Here bearing no.6006zz was used.

The designing of the instrument was done in Fusion 360.

Base plate

Base plate The base plate of the instrument is the plate on which the whole instrument rests upon. The diameter is 100mm and 6mm thick. This was cut in acrylic plastic. Holes for inserting 3mm are provided for connecting the other parts to the instrument.

Horizontal bearing inner connector

Hoz bearing inner connector This part connects to the inner ring of the horizontal bearing. The bearing has to fit in it tightly. An offset of 4mm is provided on both sides of the inner diameter of the bearing. Holes are provided on the periphery of the connector for fixing this component to the base plate.The outer dimension of this part is kept in accordance with the inner diameter of the bearing which is 30mm. The central hole of this connector rigidly holds the shaft of the horizontal encoder in inverted position.

Horizontal bearing outer connector

Hoz bearing outer connector This part holds the outer ring of the bearing. The entire assembly is connected on to this. After connection, the outer ring of the bearing rotates with respect to the central pivot while the inner ring along with the Horizontal bearing inner connector and the base plate will remain stationary.The width of the ring is kept equal to the width of the bearing which is 13mm. A cover offset is provided to prevent slippage of the bearing in any event.

Top connection plate

Top Connection plate The top connection plate connects the Horizontal bearing outer connector and the vertical walls of the instrument along with the Alidade bar on which the LASER module is fixed on. The slots seen at the centre are for fixing the encoder and the other ones are for connecting the vertical walls of the instrument and the outer connector. This has two plates of 3mm thickness each. The outer diameter of the top connection plate is 150mm. A horizontal encoder is connected to the centre of this plate. The shaft of the encoder tightly holds the inner hole of the Horizontal bearing inner connector.

Vertical Walls

Vertical walls
This forms the main part of the instrument. It houses the Alidade with the LASER module, vertical encoder, the horizontal shaft, bubble level, display panel, keypad and the circuit board. Holes are provided on one of the walls for fixing the encoder, shaft and the circuit board. The width of the vertical wall is kept equal to 90mm.The two walls are kept apart at a distance of 75mm. The height of the wall is kept equal to 110mm, thereby allowing space for a free rotation of the Alidade bar.

Alidade bar and the Vertical Encoder

Alidade
As mentioned earlier the vertical angle is measured in a vertical plane by the vertical encoder. This vertical encoder is connected rigidly to the vertical wall. The shaft of the vertical encoder connects to a 5mm Mild steel rod through a coupler (3D printed). The Alidade bar holds the LASER module and is connected rigidly to the horizontal shaft. Any rotation movement to the shaft is translated to the encoder and it records the rotation.

Mini T The completed design of the instrument. The housing for LASER module was done seperately and is not shown in this above picture.

Fusion Design file here

Fabrication and Assembly of the components

As decided the choice of material was finalised after the design stage. The two connectors to the bearing were 3D printed. A trial print of the horizontal inner bearing connector was done in PLA. But first time the print showed lack of fit for the real dimension. A second trial was done too, but it was found that the printed part is of light weight and the layers were shearing off in bearing. bearing inner error Though the stl file dimension was for 30mm it showed a difference in dimension of 0.6mm. Bearing PLA 3D printed PLA in ultimaker. The infill density was kept to 70 percent and wall thickness to 1.2mm. Layer height was kept .15mm. But the printed parts were light weight and not robust.I understood that PLA is not suitable for printing mechanically performing parts. It’s just better for only dimensional prototyping. Hence the plan was changed to use ABS plastic. The ABS material was printed in the Aeqon Aeqon

ABS plastic 3D printed bearing connectors fixed to the horizontal bearing

Download 3D printed parts design files here

Video of Shopbot cutting Acrylic

Download .dxf files of acrylic cut parts here

The remaining parts were cut in acrylic sheets of 3mm and 6mm thickness to be assembled as pressfit mode. Since shopbot was used for cutting no kerf allowances had to be incorporated. The base plate and top connection plates were connected to the encoder using 3mm nuts. The Alidade bar and the laser cover were also 3 D printed in ABS and assembled. A threaded shaft of 5mm was used to support the alidade and vertical encoder. A bubble level was also attached atop the laser module to check the level of the instrument.

Assembly The vertical walls were first connected to the top connection plates using press fit Assembly Slots provided to ensure that the horizontal encoder is seated properly Assembly The bearing was inserted to the Horizontal bearing outer connector Assembly Horizontal bearing inner connector fixed on the other side of the bearing Assembly Fixing the horizontal encoder

Assembly

Assembly Fixing the alidade bar to the shaft. On the left side the shaft coupler is seen

Assembly Fixing the base plate to the bearing connector Assembly Fixing the vertical encoder Assembly Connecting the shaft to the main body Assembly Nylon Standoffs were used to connect the circuit board to the main body Assembly Connecting the standoff to the vertical wall Assembly Circuit board after connecting it to the vertical wall Assembly A case for protecting the circuit board was designed and 3D printed Assembly Connections were all made using jumper wires Assembly Wires were all bundled and pulled out of the main body through the lot provided in the vertical wall Assembly After connecting case to the main body. Assembly The display panel and switches were all fixed using permanent glue to the main body.

The wires of the encoder came really messy. The wires were sheathed so they were not cut.
In the further development it is intended that a case will enclose all the open spaces in the main body.

Electronics and Programming

The system had 3 different sensors and input keys communicating as input and an OLED display as the output. System Architecture Atmega 328p was chosen as the right microcontroller as it had the dedicated I2C pin for two wire interface. The rotary encoders were connected to the microcontroller to the interrupt pins. The rotary encoder had four signal outs, for VCC, GND, Phase A and Phase B. These Phase A and Phase B are the data lines and these were to be connected to the interrupt pins of the MCU. Interrupt function is a characteristic of the microcontroller. They enable the MCU to stop normal data processing upon trigger given any time to perform specifc tasks given by the user. The advantage of this functionality is that they enable the MCU to conserve power and only at the trigger, say whenever a switch is pressed the MCU will perform the predefined task given to the MCU. The interrupt function can be evoked either externally or internally.Atmega 328p had only two dedicated external interrupt pins available. We had to connect two each for an encoder to get the readings. This is made possible by changing the other general input/output digital pins as PC interrupt one by referring the datasheet. Hence only during angle measurement/ reset operation time, the interrupt routines will be performed and signals from the encoder will be taken.

The distance measuring module was interfaced using UART interface by connecting those to the RX and TX pins of the MCU. The issue that was faced was that the working voltage level of the module was limited to 2-3V. Other parts were working at 5v. This case I will have to use a voltage regulator to adjust the power given to the LASER module only. For testing power supply was given externally exclusively to the lasermodule.

OLED display of 1.3” was interfaced with I2C connection to the MCU. Also input keys were chosen for Hoz angle measurement, Hoz angle reset, Vertical Angle measurement, reset, laser on/off and distance measure. Thus a set of six push switches are provided.

Designing the Circuit

The components used in the circuit are
1. ATmega 328p 2. External resonator 20MHz
3. SMD LED
4. 10 kohm resistors for I2C pullup-2 nos 5. .1 uF capacitor
6. SMD 2x2 header pins 4 nos for connecting 2 encoder,OLED display and LASER module
7. 499 ohm resistor for the LED
8. SMD 2x5 pin header for connecting switches 9. 0 ohm resistors to bypass traces-3 nos

The circuit was designed using Autodesk Eagle software. Schematic The schematic of the circuit designed Board Monochrome trace The board was designed after numerous trials for routing the traces. Traces were drawn for a width and gap of 16 mill.

Eagle files here

PCB The milled PCB. Air wires were given to connect traces at many places. After milling the connections were checked using Multimeter for possibility of break in continuity and verified.Now the MCU is ready to be programmed.

The circuit for keypad was also designed and milled. The circuit contained provisions for conencting six SMD switches and four connections for the I2C OLED display. Switches are connected to the pins A0,A1,A2,A3 for getting encoder values. On default mode these pins are all pulled up diigtally. Whenever the switch is pressed it would ground the voltage to make the voltage in the pins to a low state. This low state at the pins are checked and required functions are performed by the MCU.Switches and female header slots for connecting the display panel was fixed on the reverse side of the circuit board seperately. For this the flip trace command in the Eagle was used. Switch Schematic Schematic of the Switch board Switch Board Board of the switch board

Switch Board SMD switches connected on the reverse side of the board

Switch Board Eagle files

Programming

The programming was done in Aurduino IDE

The original code is as below

// Manu Mohan S, FabAcademy 2019
// 16 June 2019
// Fablab Trivandrum
// This program is written for the partial fullfilment of course requirement in the Final Project
// This code reads values from two rotary encoders(600 pulses per revolution)
// and dispalys the horizontal and vertical angles. It also takes the distance
// values from the distance sensing module and display it in the OLED screen.
// For circuit schematic refer http://fabacademy.org/2019/labs/trivandrum/students/manu-mohan/projects/final-project/

#include<avr/interrupt.h> // library for AVR interrupt function
#include "U8glib.h"       // library for OLED display

//#define  USART_BAUDRATE 19200
//#define UBRR_VALUE (((F_CPU / (USART_BAUDRATE * 16UL))) - 1)

U8GLIB_SH1106_128X64 u8g(U8G_I2C_OPT_NONE); // I2C / TWI // configuration for SH1106 type driver


float horz,vert,h_angle,v_angle =0;   // variables declared
char h_char[6], v_char[6],dist[6];    // character variables declared
int h0,hm,v0,vm = 1;                  // initialising the variables

void setup() {

  //USART0Init();

  //DDRD &= 0b11110011;
  DDRD &= (~(1<<2)) && (~(1<<3));  // Pins 2 and 3 (external interrupt 0 and 1 pin of MCU) connected to
  PORTD |= (1<<2)|(1<<3);          // phase A of Encoder 1 and Encoder 2
  DDRC &= 0xf0;                    // Enable the internal interrupt functions
  PORTC |=0x0f;

  EICRA |= (1<<ISC00) | (1<<ISC01) |(1<<ISC10) | (1<<ISC11);
  EIMSK |= (1<< INT0) |(1<<INT1);
  sei();
  pinMode(5,INPUT);               // Pin 5 and 6 are connected to phase B of Encoder 1 and 2 respectively
  digitalWrite(5,HIGH);
  pinMode(6,INPUT);
  digitalWrite(6,HIGH);
  Serial.begin(19200);
  u8g.setColorIndex(1);          // Configuration for the OLED display   
  u8g.setFont(u8g_font_unifont); // Font for OLED display
}

void loop(void) {
  //Serial.print("Encoder_1 is ");
  //Serial.println(horz);
  //Serial.print("Encoder_2 is ");
  //Serial.println(vert);
  //delay(1000);
  */

  /*//h_angle = 23.3;v_angle = 34.5;
  //Serial.println(horz);
  h_angle = (horz*360)/600;
  v_angle = (vert*360)/600;
  //Serial.println(h_angle);
  itoa(h_angle,h_char,10);
  itoa(v_angle,v_char,10);
  //get_distance();
  display_update();

  delay(1000);

  // Switch 1 is connected to A0 and performs Horizontal angle reset
  if(digitalRead(A0)==LOW){
      horz = 0;
      h_angle = (horz*360)/600;
      itoa(h_angle,h_char,10);
      display_update();
      delay(1000);
      }

  // Switch 2 is connected to A1 and performs Horizontal angle measurement    
  if(digitalRead(A1)==LOW){

      h_angle = (horz*360)/600;
      itoa(h_angle,h_char,10);
      display_update();
      delay(1000);
     }

  // Switch 3 is connected to A2 and performs Vertical angle reset    
  if(digitalRead(A2)==LOW){
      vert = 0;
      v_angle = (vert*360)/600;
      itoa(v_angle,v_char,10);
      display_update();
      delay(1000);}

  // Switch 4 is connected to A3 and performs Vertical angle measurement     
  if(digitalRead(A3)==LOW){

      v_angle = (vert*360)/600;
      itoa(v_angle,v_char,10);
      display_update();
      delay(1000);
    }


}
// Display partitioning to show the values of horizontal,vertical angles and Distance in the OLED screen

 void display_update(void){
    u8g.firstPage();  
  do {
    u8g.drawLine(64,0,64,44);
    u8g.drawLine(0,44,128,44);
    u8g.drawStr( 15, 16, "Horz");
    u8g.drawStr( 14, 32,h_char);
    u8g.drawStr( 80, 16, "Vert");
    u8g.drawStr( 80, 32, v_char);
    u8g.drawStr( 2,62, "Distance :");
    u8g.drawStr( 86, 62, dist);
  } while( u8g.nextPage() );
}


// Running Interrupt Service Routine for angle measurement
ISR(INT0_vect){
  if(digitalRead(5)==HIGH){
    vert++;
  }
  else{vert--;}
}
ISR(INT1_vect){
  if(digitalRead(6)==HIGH){
    horz--;
  }
  else{horz++;}
}

// Distance function to get the distance
void get_distance(void){
  int uart_value;
  //char dist_out[6];
  //Serial.write("D");
  //distance = Serial.read();

  check:
  Serial.write("D\n");
    uart_value = Serial.read();
    if (uart_value=='D'){
      uart_value = Serial.read();
      if (uart_value==':'){
        uart_value = Serial.read();
        if (uart_value==' '){
          for(int i=0; i<6;i++){
            dist[i]=Serial.read();
          }

          }
          else{goto check;}
        }
        else{goto check;}
    }
    else{goto check;}



  //dist = dist_out;
}

PS: I like to thank my instructor Yadu for helping me out in this part. I must confess that that my learnings in the embedded programming part has been really on a slow curve. But now I can understand program and build logic necessary for program building.

Working video

Click the picture above to play. The video shows the measurement of horizontal angle . Then the reset button resets the value of horizontal angle to zero. Again the vertical angle is measured as same above.

Issues

During testing it was found that both the encoders are working. I was not able to interface the LASER module with 328p MCU. My instructor Yadu speculated that it might be because of that fact that the functioning voltage of the Laser module is rather less (<3V),while other components and MCU work at a rating of 5.0V. During testing however the LASER module did seperately serially communicate with the computer using 3.3 v USB to TTL Convertor. I am still working to fix the LASER module part.

Bill of Materials

The bill of materials is attached here below

Bill of materials

Total cost of Fabrication of Mini T station was about 113 USD

Licensing

I would like to license the documentation part of my work using GNU Free Documentation License v 1.3. Please refer this linkfor the terms and conditions.
All the design files and software files are licensed under GNU GPL v3.0.
Click here for terms and conditions

What I have learned

Overall this whole 5 months has been a beautiful and exciting ride. I began with absolutely minimal knowledge in programming, CAD design, electronics production, machine design etc. Now I can read, understand basic programming, understand how stuff works in this digital world. I learnt, how an idea can be translated to physical material using principles of digital fabrication. I learnt how work, errors, learnings etc. can be meticulously documented and broadcasted using modern tool of version control. Another key learning was with the time management in project management. After spenting hours at the lab, I realised how anyone can master anything with constant perseverance. Now I am instilled with real confidence that I can pursue my dreams to “Make Almost Anything. “

Acknowledgements

I am grateful to Professor Niel Gershenfeld, KeralaStartup Mission and Fab Foundation in providing me with a wonderful oppurtunity to be a part of this elite global learning platform.

I am really indebted to the help received from my instructor and friends in the FabLab, for without them I wouldn’t had completed this project in time. Especially I am really greatful to my instructor Yadu Sharon for his inspiration in developing the project and helping me out in finalising the design, programming and interfacing part. I really thank my co instructor Ganadev Prajapathy for his timely intervention in the final stages of the project. I want to extend my gratitude to Mr Rahul Rajan, Technical Officer, Kerala Startup Mission for his guidance on using Fusion 360,his suggestions that helped me in selecting right sensor at the starting stage of the project and fixing the design errors. I would like to thank the lab in charge Mr Suhail P for his help whenever I got stuck in the electronics design part.