Problem with Makelangelo

Shop Forum Makelangelo Polargraph Art Robot Problem with Makelangelo

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #6126
    Anonymous
    Inactive

    Hi, I have a problem. I mde a Makelangelo with arduino and ramps 1.4 but I connect the arduino to the pc, open the Makelangelo sofware, connect with the arduino but I can’t move the motors I dont understante why. Thank you.
    This is my configure.h:

    #ifndef CONFIGURE_H
    #define CONFIGURE_H
    //
    // Makelangelo - supports raprapdiscount RUMBA controller
    // [email protected] 2013-12-26
    // RUMBA should be treated like a MEGA 2560 Arduino.
    //
    // Copyright at end of file. Please see
    // http://www.github.com/MarginallyClever/Makelangelo for more information.

    //
    // CONSTANTS
    //
    //#define VERBOSE (1) // add to get a lot more serial output.
    #define HAS_SD // comment this out if there is no SD card
    #define HAS_LCD // comment this out if there is no SMART LCD controller
    //#define USE_LIMIT_SWITCH (1) // Comment out this line to disable findHome and limit switches

    // machine style
    #define POLARGRAPH2 // uncomment this line if you use a polargraph like the Makelangelo
    //#define COREXY // uncomment this line if you use a CoreXY setup.
    //#define TRADITIONALXY // uncomment this line if you use a traditional XY setup.


    // servo angles for pen control
    #define PEN_UP_ANGLE (80)
    #define PEN_DOWN_ANGLE (10) // Some steppers don't like 0 degrees
    #define PEN_DELAY (250) // in ms

    // for serial comms
    #define BAUD (57600) // How fast is the Arduino talking?
    #define MAX_BUF (64) // What is the longest message Arduino can store?


    #define MICROSTEPS (16.0) // microstepping on this microcontroller
    #define STEPS_PER_TURN (400 * MICROSTEPS) // default number of steps per turn * microsteps
    #define MAX_FEEDRATE (40000.0) // depends on timer interrupt & hardware
    #define MIN_FEEDRATE (1500)
    #define DEFAULT_FEEDRATE (7000.0)
    #define DEFAULT_ACCELERATION (8)

    #define STEP_DELAY (150) // delay between steps, in microseconds, when doing fixed tasks like homing

    #define NUM_AXIES (6) // x,y,z
    #define NUM_TOOLS (6)
    #define MAX_SEGMENTS (32) // number of line segments to buffer ahead

    // for arc directions
    #define ARC_CW (1)
    #define ARC_CCW (-1)
    #define MM_PER_SEGMENT (10) // Arcs are split into many line segments. How long are the segments?


    #ifdef HAS_LCD
    #define HAS_SD
    #endif

    // SD card settings
    #define SDPOWER -1
    #define SDSS 53
    #define SDCARDDETECT 49
    // Smart controller settings
    #define BEEPER 44
    #define LCD_PINS_RS 19
    #define LCD_PINS_ENABLE 42
    #define LCD_PINS_D4 18
    #define LCD_PINS_D5 38
    #define LCD_PINS_D6 41
    #define LCD_PINS_D7 40
    #define LCD_HEIGHT 4
    #define LCD_WIDTH 20
    // Encoder rotation values
    #define BTN_EN1 11
    #define BTN_EN2 12
    #define BTN_ENC 43
    #define BLEN_C 2
    #define BLEN_B 1
    #define BLEN_A 0
    #define encrot0 0
    #define encrot1 2
    #define encrot2 3
    #define encrot3 1

    #define NUM_SERVOS (1)
    #define SERVO0_PIN (5)
    #define SERVO1_PIN (4)


    //#define MOTHERBOARD 1 // RUMBA
    #define MOTHERBOARD 2 // RAMPS

    #if MOTHERBOARD == 1
    #define MOTOR_0_DIR_PIN (16)
    #define MOTOR_0_STEP_PIN (17)
    #define MOTOR_0_ENABLE_PIN (48)

    #define MOTOR_1_DIR_PIN (47)
    #define MOTOR_1_STEP_PIN (54)
    #define MOTOR_1_ENABLE_PIN (55)
    #endif

    #if MOTHERBOARD == 2
    #define MOTOR_0_DIR_PIN (60)
    #define MOTOR_0_STEP_PIN (61)
    #define MOTOR_0_ENABLE_PIN (56)

    #define MOTOR_1_DIR_PIN (46)
    #define MOTOR_1_STEP_PIN (48)
    #define MOTOR_1_ENABLE_PIN (62)
    #endif


    //
    // EEPROM MEMORY MAP
    //
    #define EEPROM_VERSION 4 // Increment EEPROM_VERSION when adding new variables
    #define ADDR_VERSION 0 // address of the version number (one byte)
    #define ADDR_UUID (ADDR_VERSION+1) // address of the UUID (long - 4 bytes)
    #define ADDR_SPOOL_DIA1 (ADDR_UUID+4) // address of the spool diameter (float - 4 bytes)
    #define ADDR_SPOOL_DIA2 (ADDR_SPOOL_DIA1+4) // address of the spool diameter (float - 4 bytes)


    //
    // TIMERS
    //
    // for timer interrupt control
    #define CLOCK_FREQ (16000000L)
    #define MAX_COUNTER (65536L)
    #define TIMER_PRESCALER_COUNT (5)
    // time passed with no instruction? Make sure PC knows we are waiting.
    #define TIMEOUT_OK (1000)

    // optimize code, please
    #define FORCE_INLINE __attribute__((always_inline)) inline


    #ifndef CRITICAL_SECTION_START
    #define CRITICAL_SECTION_START unsigned char _sreg = SREG; cli();
    #define CRITICAL_SECTION_END SREG = _sreg;
    #endif //CRITICAL_SECTION_START


    //
    // STRUCTS
    //
    // for line()
    typedef struct {
    long step_count;
    long delta; // number of steps to move
    long absdelta;
    int dir;
    float delta_normalized;
    } Axis;


    typedef struct {
    int step_pin;
    int dir_pin;
    int enable_pin;
    int limit_switch_pin;
    int limit_switch_state;
    int reel_in;
    int reel_out;
    } Motor;


    typedef struct {
    Axis a[NUM_AXIES];
    int steps_total;
    int steps_taken;
    int accel_until;
    int decel_after;
    float feed_rate_max;
    float feed_rate_start;
    float feed_rate_start_max;
    float feed_rate_end;
    char nominal_length_flag;
    char recalculate_flag;
    char busy;
    } Segment;



    //
    // METHODS
    //

    extern Segment line_segments[MAX_SEGMENTS];
    extern Segment *working_seg;
    extern volatile int current_segment;
    extern volatile int last_segment;
    extern float acceleration;


    //
    // GLOBALS
    //
    extern Motor motors[NUM_AXIES];


    #endif // CONFIGURE_H
    #7135
    Anonymous
    Inactive

    I fix this problem. I modify the file motor.ino:

    //


    // Makelangelo – supports raprapdiscount RUMBA controller
    // [email protected] 2013-12-26
    // RUMBA should be treated like a MEGA 2560 Arduino.
    //


    // Copyright at end of file. Please see
    // http://www.github.com/MarginallyClever/Makelangelo for more information.

    //


    // INCLUDES
    //


    #include “MServo.h”

    //


    // GLOBALS
    //


    Axis a[NUM_AXIES]; // for line()
    Axis atemp; // for line()
    Motor motors[NUM_AXIES];

    Segment line_segments[MAX_SEGMENTS];
    Segment *working_seg = NULL;
    volatile int current_segment=0;
    volatile int last_segment=0;
    int step_multiplier;

    Servo servos[NUM_SERVOS];

    // used by timer1 to optimize interrupt inner loop
    int delta[NUM_AXIES];
    int over[NUM_AXIES];
    int steps_total;
    int steps_taken;
    int accel_until,decel_after;
    long current_feed_rate;
    long old_feed_rate=0;
    /*
    long prescalers[] = {CLOCK_FREQ / 1,
    CLOCK_FREQ / 8,
    CLOCK_FREQ / 64,
    CLOCK_FREQ / 256,
    CLOCK_FREQ /1024};
    */

    //


    // METHODS
    //


    // for reasons I don’t understand… if i put this method in the .ino file i get compile errors.
    // so I put it here, which forces the externs.
    FORCE_INLINE Segment *segment_get_working() {
    if(current_segment == last_segment ) return NULL;
    working_seg = &line_segments[current_segment];
    working_seg->busy=true;
    return working_seg;
    }

    int get_next_segment(int i) {
    return ( i + 1 ) & ( MAX_SEGMENTS – 1 );
    }

    int get_prev_segment(int i) {
    return ( i + MAX_SEGMENTS – 1 ) & ( MAX_SEGMENTS – 1 );
    }

    float max_speed_allowed(float acceleration, float target_velocity, float distance) {
    //return sqrt(target_velocity*target_velocity – 2*acceleration*distance);
    return target_velocity – acceleration * distance;
    }

    /**
    * set up the pins for each motor
    */
    void motor_setup() {
    motors[0].step_pin=MOTOR_0_DIR_PIN;
    motors[0].dir_pin=MOTOR_0_STEP_PIN;
    motors[0].enable_pin=MOTOR_0_ENABLE_PIN;
    motors[0].limit_switch_pin=37;
    motors[0].reel_in = HIGH;
    motors[0].reel_out = LOW;

    motors[1].step_pin=MOTOR_1_DIR_PIN;
    motors[1].dir_pin=MOTOR_1_STEP_PIN;
    motors[1].enable_pin=MOTOR_1_ENABLE_PIN;
    motors[1].limit_switch_pin=36;
    motors[1].reel_in = HIGH;
    motors[1].reel_out = LOW;

    int i;
    for(i=0;i<NUM_AXIES;++i) {
    // set the motor pin & scale
    pinMode(motors.step_pin,OUTPUT);
    pinMode(motors
    .dir_pin,OUTPUT);
    pinMode(motors
    .enable_pin,OUTPUT);

    // set the switch pin
    motors
    .limit_switch_state=HIGH;
    pinMode(motors
    .limit_switch_pin,INPUT);
    digitalWrite(motors
    .limit_switch_pin,HIGH);
    }

    motor_set_step_count(0,0,0);

    // setup servos
    #if NUM_SERVOS>0
    servos[0].attach(SERVO0_PIN);
    #endif
    #if NUM_SERVOS>1
    servos[1].attach(SERVO1_PIN);
    #endif
    #if NUM_SERVOS>2
    servos[2].attach(SERVO2_PIN);
    #endif
    #if NUM_SERVOS>3
    servos[3].attach(SERVO3_PIN);
    #endif
    #if NUM_SERVOS>4
    servos[4].attach(SERVO4_PIN);
    #endif

    #7136
    Anonymous
    Inactive

    Can you clone the github branch and submit a pull request with your change?

    https://help.github.com/articles/fork-a-repo/
    https://help.github.com/articles/creating-a-pull-request/

    Then I can include it (and your name) in the code so you get credit for your fix.

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.