November 17, 2021

Week 10:
Output

I didn't realize the motor driver was bad, this will cause pain in my final push...

Because of my final project idea (CNC watering system), I am designing a board that will drive at least three stepper motors. This first iteration will serve as a baseline design for my final project (being able to drive 3-4 motors). Here is a quick look at what the schematics and PCB looks like:

This PCB is designed around the "Moo" drv8436 breakout board by Zach, you can see the detailed descriptions here. This drv8436 module drives a bipolor stepper motor. Because of the design, micro-stepping was limited to these three options 1/4, 1/8, 1/16; but I am not worried about the stepping options at the moment since my machine does not require high precision. I then went on to stuff the board. Here's what it looks like:

It might be hard to see in the microscope picture, but there is a tiny wire on top of the drv8436 module. It is used to connect nSleep pin to the 3.3V pin, so that when the microcontroller got power, the 3.3V will wake up the module itself and be ready to work. During my soldering, the wire can come loose and has come loose on me. I spent quite some to to patch this one back to where it needs to be. (Note: the "moo" driver was updated by Zach shortly after with a added Nsleep pin ("baa" v0.2). However, this will cause much pain in my final project bacuase the "moo" module was the only available option in EECS shop. becuase of the connected pins, this module will back up 5V to my microcontroller and essentially render it useless. You can see it here. Afterwards, I moved on to modify some of Zach's example code to test and drive one motor for this assignment, it works! Here are some codes:


#define DIR 9 // PA2
#define STEP 10 // PA3
#define M1 11 // PA6

void setup() {
  SerialUSB.begin(115200);
  pinMode(DIR, OUTPUT);
  pinMode(STEP, OUTPUT);
  pinMode(M1, OUTPUT);

  digitalWrite(DIR, LOW);
  digitalWrite(M1, HIGH);
}

int delayus = 2;
int changetimer = 0;

void loop() {
  SerialUSB.println("step");
  digitalWrite(STEP, HIGH);
  delay(delayus);
  digitalWrite(STEP, LOW);
  delay(100);
//  if (changetimer == 100) {
//    delayus++;
//    if (delayus == 100) {
//      delayus = 10;
//    }
//    changetimer = 0;
//  }
//  changetimer++;
}
                                

In this code, I just simply modified pins to my corresponding pins and have the motor step forward at a slower speed. Here's a vidoe:

My design is linked here. (Note: this turned out to have a flaw, see 5V backup issue in the descriptions.)

Today I Learned:

1) Driving a motor is a lot of fun, it will be a important component of my final project.
2) DRV8436 has a internal 5V regulator that can cause trouble, see more in my final documentations Here is the datasheet.