Juan Carlos Miranda Castro

FabAcademy - 2017

Costa Rica - St. Jude School


Back

Machine design



Assignment
  • Automate your machine.
  • Document the group project and your individual contribution.
Learning outcomes
  • Work and communicate effectively in a team and independently.
  • Design, plan and build a system.
  • Analyse and solve technical problems.
  • Recognise opportunities for improvements in the design.
Have you
  • Explained your individual contribution to this project on your own website.


Hardware


hardware

ATtiny45 microcontroller board

Arduino UNO

Computer

Mobile



Software


software

Arduino IDE



Materials


Stepper motor (17hd4063 05n)

Stepper motor driver (A4988)



Control a stepper motor

  • We wanted to control a stepper motor 17hd4063 05n using the driver A4988 to learn how to spin it and compare rotation aginst displacement to implement our mchine.

    The configuration for this setup has a step pin, a direction pin, vcc and gnd on the microcontroller. The driver has vcc and gnd for the motor (it requires mor voltage and current) and four pins for the motor coils.

    When the current is alternated on each and between the coils, the motor moves one step (it can also move in half steps). So the microcontroller sends a series of HIGH and LOW signals, and the driver changes polarity on the coil pins to make the motor rotate.

    For the first tests, we used Arduino, this is the code:

    int x;

    void setup()

    {

    pinMode(6,OUTPUT); // Enable

    pinMode(5,OUTPUT); // Step

    pinMode(4,OUTPUT); // Dir

    digitalWrite(6,LOW); // Set Enable low

    }

    void loop()

    {

    digitalWrite(4,HIGH); // Set Dir high

    for(x = 0; x < 200; x++) // Loop 200 times

    {

    digitalWrite(5,HIGH); // Output high

    delayMicroseconds(500); // Wait 1/2 a ms

    digitalWrite(5,LOW); // Output low

    delayMicroseconds(500); // Wait 1/2 a ms

    }

    delay(1000); // pause one second

    digitalWrite(4,LOW); // Set Dir low

    for(x = 0; x < 200; x++) // Loop 2000 times

    {

    digitalWrite(5,HIGH); // Output high

    delayMicroseconds(500); // Wait 1/2 a ms

    digitalWrite(5,LOW); // Output low

    delayMicroseconds(500); // Wait 1/2 a ms

    }

    delay(1000); // pause one second

    }

    We managed to spin the motor in both directions. Then, we changed the delayMicroseconds to something other than 500 to make it rotate slower, but any other value makes the motor vibrate, but not spin.

    By changing the count of iterations in the for loop, the number of steps changes. During this tests, the motor and driver got very hot:

    We were ready to attach the stepper motor with the screw shaft to make the measures for displacement related to rotations, so we changed the microcontroller for one we fabricated at the lab with the ATtiny45, but the motor didn't move any more.

    We checked all the connections several times, but couldn't get it to work again.

    We went back to the Arduino but the motor still did not move. Our guess is that we burnt the driver. We tried another driver we salvaged from an old 3D printer, but the motor wouldn't move anymore.

    Next step will be to fabricate a stepper motor driver to make new tests and continue with our machine. Esterlyn Quesada will continue with the motor driver and code.


The machine in action


Back