Monday, May 5, 2014

Project CNC - More repairs and learning to adjust current limit of stepper drivers

Early last week I killed the driver board for the Z-axis stepper. Initially, it moved intermittently and then it just stopped moving entirely.  It occurred while I was trying some test cuts in acrylic (to try and find the best feed rate, and depth of cut for different plastics using different end mills/bits). After the Z-axis failed, touching the chip on the driver board I found that it was very hot. I allowed the board to cool (keeping my fingers crossed that it was just a thermal shutdown and would reset when it cooled) and then tried it again... it still didn't work but it did heat up even more.

I expected that I would have a printed circuit board (isolation routed by this very machine) to hold the micro-controller board, motor driver boards as well as plugs for all the connections to power supply, stepper motors, homing switches and control panel – completed by now. But, I don't. While I have finished the board design to plug all the components into – I was so anxious to make the board (a few weeks back) that I didn't wait until I had tested and calibrated everything to the degree that I have now. 
Eagle layout for board to plug Arduino nano, driver boards etc. into
So... initial attempts at making the board failed. As a result I have had to keep the whole deal on a breadboard. My concerns have been that it's way to easy to accidentally pull out a wire and the board is exposed to all the sawdust that is generated when cutting anything (might interfere with connections or even short circuit a connection).
Breadboard with Nano and stepper drivers
Well, early last week one of these possibilities came to light and the result was frying the stepper driver board for the Z-axis.

I have some other driver boards that I pulled and replaced while trying to determine why certain steppers seemed to be missing steps. Initially, replacing the board seemed to help and then the same problem returned. Further testing revealed that the main issue, at that time, was the “Seek” speed.  So, it is possible that some of these "failed" boards are actually Okay

Due to these prior issues I decided that I needed to test and adjust current regulation on all my stepper controller boards (A4988 breakout boards) to help prevent future failures:
  • adjusted all boards to limit current to 1A
    • logic supply to all boards is 5V (Arduino digital outputs)
      Testing and adjusting current limit pot
      • For these breakout boards (A4988) “Vref(in volts) = Current(in amps) / 2.5”
        • measuring Vref:
            • positive voltage measurement so need to take it at test point (using red lead on most VOM's) and reference to ground (black/common lead on most VOM's connected to “-” side of supply – ground pin on Arduino)
            • test point on Pololu board is marked separately
            • test point on other boards (StepStick) is the case of the potentiometer
      • calculating for a current limit of 1A (Current = 1A) we get
        • Vref = 1A/2.5
        • Vref=0.4volt
      • pots adjusted until Voltage read 0.4V
  • Tested all boards wired to a NEMA17 stepper using 18v PSU (cordless drill battery) and a super basic Arduino sketch
    • /* StepStick super basic code
      Runs stepper motor 1 revolution each direction

      Digital 3 Step
      Digital 2 Direction


      int Step = 3;
      int Direction = 2;

      void setup() {     
        pinMode(Direction, OUTPUT);
        pinMode(Step, OUTPUT);
        digitalWrite(Direction, LOW);
        digitalWrite(Step, LOW);

      void loop() {
        digitalWrite(Direction, LOW);
       for (int i = 0; i < 200; i++) {
          digitalWrite(Step, HIGH);
          digitalWrite(Step, LOW);
       digitalWrite(Direction, HIGH);
      for (int i=0; i<200; i++) {
         digitalWrite(Step, HIGH);
          digitalWrite(Step, LOW);
  • Determined that I do, indeed, have 4 dead driver boards (2 are from initial tests at the start of this build when I adjusted connections while board was still powered – I'm fairly certain that the most recent board failure occurred due to a connecting wire coming loose on the breadboard).
  • Should be good to go now but I did order an extra 5 boards just in case (I do need, at least, 1 of them for my 3D printer extruder - more on that build later...).