Hello
I have bought an Arduino UNO, CNC shield v3, 4988 stepper motor driver and a 17HS13-0404S stepper motor.
Dragonframe animation software provides a sketch for controlling it with Arduino - but the pins are not configured for use with the CNC shield. I have attached the sketch.
This gentleman kindly explains how to modify the sketch to work with the CNC shield here:
..which I have tried, but I get nothing at all going to the motors when I try to control them from Dragonframe.
I have zero knowledge about coding, so I thought I would reach out to the community for some help and suggestions. In the future I would like to buy three more motors and drivers, so I would love a solution that hooks up all four channels.
Please post the code that you tried. Please read the how to use the forum stickies to see how to format and post code. For a variety of reasons, many members are reluctant to download attached code.
Have a look at this post by Robin2. It explains how steppers and stepper drivers work and has a link to another post that has a simple stepper sketch that you can use to individually test each motor to confirm that the hardware is working properly.
OK, in the case where the code is too long it is acceptable to attach the code. I looked at the code that you attached, but didn't go all the way through so didn't realize that it would not fit.
Per the link that you attached you need to make these changes.
Search the file for "set output pins" and insert the CNC shield pin definitions so it looks like this.
I had previously got as far as modifying the code and uploading to the board, but the problem is that I just get nothing from the motors in Dragonframe software, not a flicker.
Even with the unmodified code I could get something from the motors (albeit not what I need) but the modification just kills any response from them.
I'm certain that I am using Dragonframe in the correct manner so I can only imagine that there must be an error in the code modification provided in order to route the signals through the CNC shield.
I really do appreciate your help
Many thanks
Daniel
Before you blame the software, have you verified that the hardware works properly by writing a small sketch to test each motor individually? This post contains good information about steppers and stepper driver basics. Also a link to a simple stepper program that you could use to test the motor subsystems. Use the modified pin map that is to be inserted for the step and dir pins. Pin 2 = X step, pin5 = X dir for example. Have you set the driver current properly?
As far as I can see the modification is done per the link. And the code compiles, so I am at a loss as to why it will not work for you. Is there software on the PC that communicates with the slider controller? I mean how are commands communicated to the slider?
I put together a test circuit of 2 DRV8825 boards and steppers and connected to my Uno to test the last code that you posted. I am able to control the two motors by inputting commands through serial monitor. So the software does work, that leaves hardware or PC side software.
It's a really simple interface to communicate, with very little exposed to get wrong. Like I said, when I load the unmodified sketch it does work a little, that is, it rotates the motor on channel 1 only, and only in one direction -
I've attached screen grabs of the connection dialogue and the controller page.
Not sure where we go from here - Perhaps I will try and contact the guy who posted the original mod tutorial, though he does specifically say if you can't get it to work then to consult a friend rather than him! Plus he sells kits to do just this so it wouldn't really be in his interest to help me do a DIY job!
I would suggest that you try to send commands using serial monitor. If that works, there is a problem on the PC side. If not, the problem may be the Arduino/CNC card. The syntax is:
mm 1 1000 move motor, motor number, steps
mp 1 Return position of motor 1
pr 2 1000. Set step rate, motor, rate
hi Should return "hi" and the software version number (1 4 1.2.7)
sa Stop all motors
Be sure the serial monitor baud is set to 57600 and line endings to cr/lf.
Did you notice the spaces in the command. mm space 1 space 1000. Without the spaces (delimiters) the parser has no way of separating the parts of the command. Like I said, I connected 2 motors up and the software works fine, with all of the command that I sent, with the connections as posted for the 2 so i have no reason to expect that it won't work for 4. So if the hardware is responding to commands from the serial monitor, the problem sure seems to be on the PC side. Look in the controller software (Dragonframe??) and make sure that it is configured to use the right serial port and baud rate.
I tried with spaces and there is no movement on the motor
There are no settings for baud rate within dragonframe and it's deffinitely connected to the correct port.
As I say it is only when I upload the modified sketch that I get no movement at all. WHen I upload the original DFMoco I get movement on one axis only and only in one direction. So it does seem as if dragonframe is communicating effectively with the board.