arduinojohnny-five

Stepper Motor does not work with Arduino Mega Ramps 1.4 with Johnny-five


I have an Arduino Mega with RAMPS 1.4 shield board. I think I uploaded the correct firmware for the board (Standard Firmata and Advanced Firmata)
Here is my setting:

enter image description here
AC to DC converter

enter image description here
The board

var five = require('johnny-five');
var board = new five.Board({
port :"com5"
});
board.on('ready',function(){
  console.log('Board is ready');
  var stepper = new five.Stepper({
      type: five.Stepper.TYPE.DRIVER
      stepsPerRev: 200,
      pins: {
       step: 54,
       dir: 53
 });
  stepper.rpm(180).ccw().step(2000, function() {
   console.log("done");
  });
    });

The pin definition for X:

#define X_STEP_PIN         54
#define X_DIR_PIN          55
#define X_ENABLE_PIN       38
#define X_MIN_PIN           3
#define X_MAX_PIN           2

When I run the js file, here is the console script:

Board is ready
done

Does anybody know how can I get it work? My Arduino board is a clone, not the original one. Would it be the problem?


Solution

  • Probably the problem is that you put the wrong pin as dir (53 instead of 55).

    Moreover I suggest you to "enable" the enable function, if it is supported by johnny-five.

    And.. As for the power, I think that the main issue is because you used the wrong connector. On the RAMPS you have two separate rails on the 4-screw connector used for the main power supply:

    RAMPS power

    as you can see from the schematic and the layout on the RAMPS wiki page, the two pins marked in blue are used to power just the heatbed (or what you connect to the D8 port).

    You need to connect the 12V supply to the red port, which powers the motors, the arduino underneath and the two "extruders" connected to D9 and D10.