Mechanical and Machine Design


For the Machine Building, our team made a Solar Drawing Machine. This system is composed of two sub-systems:

  • The first one is the solar tracker that helps the sunlight to concentrate in one beam.
  • The other one is the machine bed on which the focused beam either engraves or draws a material that can be burnt, melt or cut.
  • I was responsible for the development and functionality of the solar tracker. In order for the solar tracker to be made, an appropriate structure (functional requirements) was needed, an appropriate PCB board and of course a program so that it can run on.

    Functional Requirements

    In order for the LDRs to be connected and work properly, they have to receive the same amount of sunlight, no less no more. To achieve that, something that would be able to give the system that ability had to be designed. So, a structure that when the sun is not perfectly perpendicular to the LDRs would give a shadow to them as a result of getting less sunlight and making them adjusting accordingly was designed and laser cut using a 3mm MDF. Two of the parts of the design were designed to work as a press fit and then were super glued to the base of the design were slots for the placement of the LDRs were also put.

    The base was designed with little holes near the centre point of it so that they would easily get shadow when the LDRs are placed there. The vertical part of the design was measured to fit in the diagonal area of the base. The functionality of the vertical parts of this design is to make shadow to the LDRs when sun is not perfectly perpendicular on them.

    Below you can see the design of the structure and the result after the laser cutting. For the laser cutting, I used the vector settings without the color mapping this time using only the "General" options as I have only cuts to do without any engravings. I used the settings of the machine for the 3mm MDF which are frequency: 30%, power: 100 and speed: 9%. More info for the laser cutter can be found on the "Computer Controlled Cutting" week.

    For software purposes I named the LDRs according to their positions as top left and right, and bottom left and right. This configuration helps for the programming of the solar tracker and the connections of the LDRs to the PCB board.

    PCB Design

    The solar tracker needed a PCB in order to be working. After some research on the internet, I found out the connections of the LDRs and the stepper motors. The stepper motor needs a driver in order to be working. The driver used was the A4988 Pololu Stepper Driver. As two stepper motors were needed for the system to work, one to control the horizontal movement and one the vertical, I used two drivers.

    Below, the connections of one LDR and one stepper driver are illustrated.

    Taken the above connections into consideration, I modified the satshakit made by Daniele Ingrassia into the requirements of my system. After making the eagle file, I proceeded on milling using the same method as the "Electronics Design" week. The settings for the internal path and external path respectively are given below:

  • Cut depth (mm): 0 | 2.1
  • Tool diameter (mm): 0.2 | 1
  • Number of offsets (-1 to fill): 4 | 1
  • Offset overlaps (%): 55 | 50
  • Below, you can see the eagle file of the PCB Board:

    And the finished board soldered:

    Software of the Solar Tracker

    For the software of the system, I followed an example code I found on Instructables. I modified it quite a while using the stepper.h library insted of the servo motors. I still used the same mathematical for the measuring and comparison of the sunlight. Many example codes of the solar tracker systems use the same mathematical formulas, so I thought I will also give it a shot.

    I wrote the code in Arduino language. For the programming of the board, I initially used the arduino board to upload the bootloader on my board and then I directly programmed my board using the FTDI-5V cable. In order to do that, the same procedure was followed as the "Output Devices" week.

    The code can be found below:

    #include <Stepper.h>
    #define motorstep 100 //defining the step of the motor
    //horizontal stepper
    #define hstep 13 //defining the step pin
    #define hdir 12  //defining the direction pin
    int step_hdivision = 10; //defining the micro-step
    Stepper stepperh(motorstep, hstep, hdir);
    //vertical stepper
    #define vstep 10  //defining the step pin
    #define vdir 9    //defining the direction pin
    int step_vdivision = 10;  //defining the micro-step
    Stepper stepperv(motorstep, vstep, vdir);
    int ldrLT = A0; // LDR Left Top
    int ldrRT = A1; // LDR Right Top
    int ldrLD = A2; // LDR Left Down
    int ldrRD = A3; // LDR Right Down
    void setup(){
      //setting the motors' speed
      //declaring the motor pins as output
      pinMode(9, OUTPUT);
      pinMode(10, OUTPUT);
      pinMode(12, OUTPUT);
      pinMode(13, OUTPUT);
      //declaring the LDR pins as inputs
      pinMode(A0, INPUT);
      pinMode(A1, INPUT);
      pinMode(A2, INPUT);
      pinMode(A3, INPUT);
    void loop(){
      //reading the LDR values
      int lt = analogRead(ldrLT);
      //Serial.println (lt);
      int rt = analogRead(ldrRT);
      //Serial.println (rt);
      int ld = analogRead(ldrLD);
      //Serial.println (ld);
      int rd = analogRead(ldrRD);
      //Serial.println (rd);
      int dtime = 1;
      int tol = 50;  //control value
      int avt = (lt + rt)/2; // average value top
      int avd = (ld + rd)/2; // average value down
      int avl = (lt + ld)/2; // average value left
      int avr = (rt + rd)/2; // average value right
      int dvert = avt - avd; // difference of up and down
      int dhoriz = avl - avr; //difference of left and right
      // horizontal stepper motor
      if(-1*tol > dhoriz || dhoriz > tol){
        //if left average value is bigger than right then move left
        if(avl > avr){
        //otherwise move right
        else if(avl < avr){
        //if none is true then stay where you are
      // vertical servo motor  
      if(-1*tol > dvert || dvert > tol){
        //if top average value is bigger than the down one then move up
        if (avt > avd){
        //otherwise move down
        else if (avt < avd){
        //if none is true then do nothing
        else if (avl == avr){

    Although the above program is written for stepper motors, I tested it in the beginning by using servo motors. It seems by the first tests that the system is working:

    Embedded in the whole system

    So, after the first tests were done using the servo motors, more successful tests were run with the stepper motors again successful as it appeared to be. So, it was time to embed it in the whole system and see if it actually works.

    The LDRs were embedded on the lens using double scotch tape so that the lens moves according to the sun as desired. The two stepper motors were embedded on the appropriate places that my colleagues designed for that specific purpose.

    Below, the testing of the solar tracker is made. It seems to be a bit slow on the movement but it works. :)


    LDR Structure.dxf | Solar Tracker.ino | Solar Tracker.sch | Internal Path of solar tracker PCB.png | External Path of solar tracker PCB.png