547,335 active members*
2,734 visitors online*
Register for free
Login
IndustryArena Forum > OpenSource CNC Design Center > Arduino > How does UGS know Arduino pins for stepper drivers?
Results 1 to 7 of 7
  1. #1
    Registered
    Join Date
    Oct 2004
    Posts
    170

    How does UGS know Arduino pins for stepper drivers?

    What I have is an Arduino Uno connected to a breadboard with three A4988 stepper drivers and one Nema 17 stepper. There is a 24v 2a source for the stepper.
    This is a trial configuration before moving on. I'm hoping to refurb an old Sherline mill to pay forward to a "young" kid (he is 22, I'm 70). He is a recent grad Mechanical Engineer.
    I have ran an example Arduino sketch to prove the wiring is working and the stepper moves.
    I flashed the Arduino with GRBL. I installed UGS Platform edition.
    I find that I need to reflash GRBL to the Uno each time before I start UGS.
    So, I start UGS and use the Setup Wizard. Step 1 is to connect, which works - I end up with "Connected to Grbl 0.9j.
    Step 2 is to import settings, which since this is a breadboard test I don't have any.
    Step 3 is Motor wiring which is where I fail. I get no movement regardless x, y, z or direction.
    Early in the project I was curious how UGS would know which pins I chose on the Arduino for step and direction. I believe that is my issue.
    Is there a generic "setting" file I can edit to import in Step 2 of the wizard? What format is is that file?
    Is there someplace UGS that I can input the pin information?
    Seems I am really close, but have no movement.
    Steve.

  2. #2
    Registered
    Join Date
    Mar 2015
    Posts
    335

    Re: How does UGS know Arduino pins for stepper drivers?

    I find that I need to reflash GRBL to the Uno each time before I start UGS.
    That is not normal.

    I end up with "Connected to Grbl 0.9j.
    You are running a very old grbl version. Download the latest
    So, I start UGS and use the Setup Wizard. Step 1 is to connect, which works - I end up with "Connected to Grbl 0.9j.
    To get things moving, you don't need the UGS wizzard.
    Early in the project I was curious how UGS would know which pins I chose on the Arduino for step and direction.
    UGS don't need to know this, the grbl controller knows the layout of pins.
    What format is is that file?
    The settings can sent to the grbl controller as a plain text file

    Grbl has a very good WiKi to get started https://github.com/gnea/grbl/wiki

    I suggest:
    - you upload the latest grbl version (1.1f or later)
    - don't configure it using UGS
    - Use UGS to try get things moving
    - If the steppers then don't move, check if you can move them by hand
    - post your configuration
    - post your wiring
    - check if the drivers get warm (that means current is flowing and it is a good sign)
    - check if you can rotate the steppers by hand if they are not moving
    - post a UGS screen shot

  3. #3
    Registered
    Join Date
    Oct 2004
    Posts
    170

    Re: How does UGS know Arduino pins for stepper drivers?

    [QUOTE=hfjbuis;2464950]
    That is not normal. You are right, it didn't need that today. I think my issue yesterday was going into Arduino and running a sketch which stayed active on the UNO

    To get things moving, you don't need the UGS wizard. I was using the wizard since initially I had no motion and desperate.

    UGS don't need to know this, the grbl controller knows the layout of pins. Only if the board is wired correctly, which is why I posted the topic question. After a lot of searching I found a file in the grbl folder called cpu_map_h.h that identifies the step and direction pins on an Arduino that GRBL needs. After changing the wiring on my breadboard to match those pins, it works. When testing with a sketch earlier in Arduino you can set pins for step and direction, I used 2,3 & 4 for direction and 5,6,7 for step. The cpu_map_h.h shows grbl needs the pins 2,3,4 as step x,y,z and pins 5,6,7 as direction x,y,z. I'm sure everyone who makes a machine or hat for Arduino knows this. Using Arduino sketches you define the pins as you want.

    The settings can sent to the grbl controller as a plain text file not sure what you mean

    Grbl has a very good WiKi to get started https://github.com/gnea/grbl/wiki I found no answer to my issue there.

    The steppers now move with UGS using a simple box from Fusion360 using the grbl post processor. Solution is to wire your Arduino pins 2,3,4 as step x,y,z and pins 5,6,7 as direction x,y,z.
    Problem solved.

  4. #4
    Registered
    Join Date
    Mar 2015
    Posts
    335

    Re: How does UGS know Arduino pins for stepper drivers?

    I am glad every thing is working now. Have fun,

    This link in the grbl WiKi shows the default connection: https://github.com/gnea/grbl/wiki/Co...rbl#grbls-pins

    The settings can sent to the grbl controller as a plain text file not sure what you mean
    You can sent the configuration file as a plain text gcode file using UGS.
    The settings are described: https://github.com/gnea/grbl/wiki/Gr...-Configuration

  5. #5
    Registered
    Join Date
    Oct 2004
    Posts
    170

    Re: How does UGS know Arduino pins for stepper drivers?

    Quote Originally Posted by hfjbuis View Post
    I am glad every thing is working now. Have fun,

    This link in the grbl WiKi shows the default connection: https://github.com/gnea/grbl/wiki/Co...rbl#grbls-pins


    You can sent the configuration file as a plain text gcode file using UGS.
    The settings are described: https://github.com/gnea/grbl/wiki/Gr...-Configuration
    I was to that site so many times and never saw that!!! Would have saved me days.
    Steve.

  6. #6
    Registered
    Join Date
    Apr 2007
    Posts
    33

    Re: How does UGS know Arduino pins for stepper drivers?

    Steve are you running the A4988 thru a ramps 1.4 board or just a bread board? If just a bread board I would suggest getting a arduino Mega 2650 as a minimum to run any kind of automation using steppers. The Mega has more memory and I/O for CNC, .also consider getting a ramps 1.4 board so that you can use the A4988 with all the noise reduction etc. Any CNC mill work you will do will require a serial input and downloading of G-code while driving the steppers. I would suggest getting an Arduino stepper motor shield board and plugging it into the UNO to learn about programming steppers. (their are many good stepper motor sketches around to practice with. Also you will use this to check clearances and travel on your Nema 17's when their mounted. gRBL is a complicated program and has been suggested there have been improvements in the newer versions. I am glad you got the motors running but the real fun starts when their mounted and your setting the pulses per liner motion unit which is directly tied into the types of drive mechanisms your using. Emergency stops and resets etc. are another source of motors not moving when sent instructions.
    Doc

  7. #7
    Registered
    Join Date
    Apr 2007
    Posts
    33

    Re: How does UGS know Arduino pins for stepper drivers?

    To answer your question about how does the arduino know what pins are being used. The pin assignments are usually in the Arduino grbl library that is edited depending upon which board your using.

Similar Threads

  1. Stepper drivers to the arduino
    By obadek in forum Arduino
    Replies: 6
    Last Post: 09-13-2019, 10:13 AM
  2. Replies: 2
    Last Post: 11-22-2018, 04:15 PM
  3. New DIY CNC Arduino Nano+GRBL+UGS
    By gerbilovsky in forum DIY CNC Router Table Machines
    Replies: 8
    Last Post: 10-24-2017, 01:56 PM
  4. Replies: 3
    Last Post: 12-10-2015, 07:14 PM
  5. Stepper motor&drivers,servo motors&drivers,motion control card CHINA factory
    By stepmotordriver in forum Manufacture Company Listing
    Replies: 0
    Last Post: 06-21-2014, 09:14 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •