Nema 17 project

Hi i'm starting my first arduino project and i'm doing it in stages with the first stage being just getting a stepper motor working.

#define directionPin 2
#define stepPin 3

#define stepsPerRevolution 6400

void setup() {
  // put your setup code here, to run once
  pinMode(directionPin, OUTPUT);
  pinMode(stepPin, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  for (int i = 0; i < stepsPerRevolution; i++) {
    digitalWrite(directionPin, LOW);
    digitalWrite(stepPin, HIGH);
    delayMicroseconds(50);
    digitalWrite(stepPin, LOW);
    delayMicroseconds(50);
  }
}


Thats my code and I get no errors when I upload it to my arduino.

pics of my setup

however I run my code the motor doesn't move at all. if it helps i followed this tutorial https://www.youtube.com/watch?v=nLV0fjUWI-g&ab_channel=HenryCawley

i'm using the arduino stepper library as well.
any idea whats wrong

You can post picture directly from the clipboard into the web-editor

As far as I can see from your picture you haven't connected ground of the arduino with ground of the stepper-driver.

You should use the standardised colors:

ground / minus black or blue
+5V red
+12V (or whatever) a different color than red but similar to red (orange, pink, violet)
signals not black, blue or red

This will make it easier to check the wiring.

For driving stepper-motors I recommend to use the library mobatools
You can install this library from the library-manager of the Arduino-IDE

best regards Stefan

What’s your power supply ?

I have the ground where connected I’m following this schematic https://imgur.com/a/4FnZzMA I’m kinda confused it looks like I have everything

You cannot expect a stepper motor to go from a dead stop to 10,000 steps per second instantly. I suggest that for testing to set the delays to 10 milliseconds or more to see if the motor will move.

High speeds require acceleration. The built in Stepper library will not do acceleration. I like the MobaTools stepper library. It does acceleration and is relatively easy to learn and use.

ALITOVE 5V 8A 40W AC to DC... https://www.amazon.com/dp/B078RZBL8X?ref=ppx_pop_mob_ap_share

A search of the internet seems to show that the TB6600 requires 9V to 42V motor supply voltage.

Here for instance: https://www.makerguides.com/wp-content/uploads/2019/10/TB6600-Manual.pdf

Is there anyway you could link up power supply on Amazon for me please?

you should NOT buy electronic components on amazon for two reasons

  1. not the lowest price
  2. in most cases amazon or the sub-seller does NOT provide sufficient detailed technical data like datasheets, pin-out-pictures etc.

If you post in which country you live in I can look up for a different online-shop

best regards Stefan

the USA

Your wiring picture copied into the clipboard
and then pasted directly into this text by pressing
ctrl-v

Are you sure that the EN+input is LOW-active?
Do you have a datasheet or a user-manual for the stepper-driver?
What does the steper-driver-manual say?

Your schematic has no powersupply for the motor connected.
If you post a schematic the schematic should represent ALL details of your real hardware.
Without a power-supply here

of course nothing works.

Living in the USA.
Very good online shop for almost everything about microcontrollers sensors and powersupplies

Adjustable Powersupply 3-12V 5A for $17.50 very good price/perfomance ratio

best regards Stefan

Thanks, I'll check it out. i'm going with a different tutorial

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.