Wednesday, June 3, 2015

Day 13-
June 3rd

These past few days have been dedicated to understanding Arduino coding along with the Mega chip and it's sistering rep-rap board. So far we have been able to make all our motors move in a random fashion after we decimated our original 3d printrbot shown in pieces below.  But not in the way we expected it to, originally, the plan was to mount the rep-rap board atop the mega Arduino board, but after running multiple tests we gave up and attempted to wire the boards together in a more crude fashion, by closely examining the board we wired the two boards together so that it would allow us to utilize the two boards together and Dr. McColgan confirmed that we could use the setup for our final product.  So far the code we are using for our motors is one that Cham and I found on the example section on the Arduino website, our adapted code is as follows.
/*
 * MotorKnob
 *
 * A stepper motor follows the turns of a potentiometer
 * (or other sensor) on analog input 0.
 *
 * This example code is in the public domain.
 */

#include <Stepper.h>

// change this to the number of steps on your motor
#define STEPS 100

// create an instance of the stepper class, specifying
// the number of steps of the motor and the pins it's
// attached to
Stepper stepperX(STEPS, 10,11,12,13);
Stepper stepperY(STEPS, 6,7,8,9);
Stepper stepperZ(STEPS, 2,3,4,5);
// the previous reading from the analog input
int previous = 0;

void setup()
{
  Serial.begin(9600);
  // set the speed of the motor to 30 RPMs
  stepperX.setSpeed(30);
  stepperY.setSpeed(30);
  stepperZ.setSpeed(30);
}

void loop()
{
  // get the sensor value
  int val = analogRead(0);
  Serial.print(val); Serial.print(" "); Serial.println(previous);
  // move a number of steps equal to the change in the
  // sensor reading
  stepperX.step(20);
  stepperY.step(-20);
  stepperZ.step(30);
  

  // remember the previous value of the sensor
  previous = val;
}


The wiring setup for the motors in our printer
Our beautiful 3d printer- Dismantled.


No comments:

Post a Comment