Program for stepper motor

Hi can anyone help me by writing code for arduino. I need to writ using drv8825 driver,and arduino shield v3, and Nema 17 steper motor.
If someone would be willing to help me, I would be very happy.
I am a beginner in programming myself.

The search phrase "arduino drv8825 stepper tutorial" will turn up lots of ideas, and even some tutorials!

Be sure to follow instructions to set the current limit correctly, and to use an adequate, external motor power supply.

I tried but it didn't work for me.

If you want help from this forum, please read and follow the instructions in the "How to get the best out of this forum" post.

People are happy to answer specific questions about your well-documented attempt.

No you’re not, you’re not learning anything at all if someone else does the work for you.

Your skill level will be car wash assistant.

Hi, @tinel04
Welcome to the forum.

What didn't work for you?

Tom... :smiley: :+1: :coffee: :australia:

I am also willing to help. Say what you did, show what you did, with drawing and code. I have a stepper simulation ready, if it fits your project.

Hello, I wrote this code so I can write how many mm the motor will rotate. my motor was more or less just shaking as you can see in the video below
Thanks for all help.

(Attachment 20230309_103131.mp4 is missing)

Hi,
Do you still have the problem?
If not, what fixed it.

Please post code and can we please have a circuit diagram?
An image of a hand drawn schematic will be fine, include ALL power supplies, component names and pin labels.

Thanks.. Tom... :smiley: :+1: :coffee: :australia:

Your picture shows a red wire connecting to the 0v line - is that what you wanted ?

The gray wire is in Pin 1. That pin is also used for your USB (upload sketch), so you should find an available pin on the Arduino for the Gray wire. This is what I see:

     --- |  | YEL +5v
     --- |  | RED GND
     --- |  | RED 2B
     --- |  | BLU 2A
Loop PUR |  | GRN 1A
Loop PUR |  | BLK 1B
Pin2 WHT |  | RED +5v
Pin1 GRY |  | YEL GND

Pinout and information:

           +-------------------------+
  LOW=DSBL | ENABLE    A4988    VMOT | 8-35vdc ---+ 100uf electro cap
           | MS1                 GND | gnd -------+ pwr spike protect
           | MS2                  2B | stepper 2B
           | MS3                  2A | stepper 2A
       SLP | RESET                1A | stepper 1A
       RST | SLEEP                1B | stepper 1B
     Pin 3 | STEP                VDD | 5vdc
     Pin 2 | DIR                 GND | gnd
           +-------------------------+

           MS1	MS2	 MS3   Step resolution
           Low  Low	 Low   Full step
           High Low	 Low   1/2 step
           Low  High Low   1/4 step
           High High Low   1/8 step
           High High High  1/16 step

           SET DRIVER CURRENT LIMIT
           1. Power A4988 driver (Vdd, GND)
           2. Connect RST to SLP
           3. Disconnect motor
           4. Apply USB power
           5. Calculate current limit: Current Limit = Vref ÷ (8 × Rcs)
           6. A current limit of 1A (standard) needs Vref of 540mV
           7. Adjust POT while measuring Vref at GND to POT (metal screw)
           8. If the motor is making a lot of noise,  lower the current limit

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