Welcome! Log In Create A New Profile

Advanced

Running dual x stepper drivers and stepper motors with marlin firmware

Posted by tm america 
Running dual x stepper drivers and stepper motors with marlin firmware
July 09, 2015 05:26PM
On my machines i am running ramps1.4 with arduino mega2560 using modified marlin firmware. I have been building my 4ft by 4ft machines using dual y stepper drivers and dual y stepper motors running marlin..all my bigger machines like 4ft by 8ft and 5ft by 10ft machines i have been wiring in separate tb6560 stepper drivers wired into the x axis..Now i am wanting to run drv8825 stepper drivers on the ramps1.4 and still have dual stepper drivers for the x axis..I know i can do it with the y and z axis but it looks like the firmware is doing the x axis differently as if it wants to duplicate the x axis with an offset ..Any time i try to change the firmware so it will duplicate what x1 is doing for x2 it gives me errors when compiling..Is there an easy way to run dual x stepper drivers without having to wiring them in externally?
Re: Running dual x stepper drivers and stepper motors with marlin firmware
July 10, 2015 03:40AM
Just wire the steppers in series and use one drv8825.
Works fine for me on z-axis. ( With standard steppers )

I have a Ramps board that has a 30V 5A fuse and 35V capacitors for the steppers.
It is possible to use a 24V PSU for the steppers, when you manage to feed the arduino from a separate 5V source.
(eg. disconnect D1 on the Ramps and use a 5V UBEC circuit )
-Olaf

Edited 2 time(s). Last edit at 07/10/2015 03:42AM by o_lampe.
Re: Running dual x stepper drivers and stepper motors with marlin firmware
July 10, 2015 12:40PM
I am wanting something I can do in the firmware that will allow me to use the x and E1 for the x and x2 steppers ..I basically want it to be how it would be for the z or y axis when you use dual stepper drivers..It needs to run in duplication mode..I am thinking if I copy and paste the section in the configuration adv h about dual y and just change the y to a x then maybe have to do something in other places ??
Re: Running dual x stepper drivers and stepper motors with marlin firmware
July 10, 2015 01:25PM
So after looking at the firmware some more I am thinking I can just change this in the configuration adv h

// Same again but for Y Axis.
//#define Y_DUAL_STEPPER_DRIVERS

// Define if the two Y drives need to rotate in opposite directions
//#define INVERT_Y2_VS_Y_DIR true

#ifdef Y_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS
#define EXTRUDERS 1
#endif

to this?

// Same again but for X Axis.
//#define X_DUAL_STEPPER_DRIVERS

// Define if the two x drives need to rotate in opposite directions
//#define INVERT_X2_VS_X_DIR true

#ifdef X_DUAL_STEPPER_DRIVERS
#undef EXTRUDERS
#define EXTRUDERS 1
#endif

Then add this to the pins h

#define X2_STEP_PIN 36
#define X2_DIR_PIN 34
#define X2_ENABLE_PIN 30

Is there anything else I would need to change to make it use the E1 for the x2 stepper driver?Obviously I need to uncomment the part about dual X steppers..But not sure if it is referencing anywhere else in the firmware to make it duplicate the x to the x2???
Re: Running dual x stepper drivers and stepper motors with marlin firmware
July 11, 2015 10:40PM
I added these parts to the code and it still didn't work It did compile ok now looking at the code i added to the configuration adv h i think i might have to make some changes to the EXTRUDERS 1..But i am not seeing where this is in the firmware?I was thinking it would be a page like pins h
Re: Running dual x stepper drivers and stepper motors with marlin firmware
July 11, 2015 11:37PM
If X_DUAL_STEPPER_DRIVERS is not implemented in the code, this will accomplish nothing. Defines are not functions in software, they are merely conditionals which determine what is and is not included via #ifdef and #ifndef statements elsewhere. Go find what Y_DUAL_STEPPER_DRIVERS enables, and write it into X axis code . . .

- Tim

Edited 1 time(s). Last edit at 07/11/2015 11:37PM by tadawson.
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 08, 2016 03:46PM
I am building a 1m x1m printer unit using lead screws and nema 23's. My design calls for 2 motors per axis running in tandem in parallel (which by way of wiring them in parallel would apparently be too much load for the drivers). And of course there is the option to wire in series like most people out there seem to suggest and just spread the work load on the motors but this I'm guessing would limit the ability to get the most working power from them.

My latest find was the Azteeg X3 Pro Controller, having 8 stepper driver connections, I thought this may be the way to go by accomplishing everything in the firmware. This would also leave 2 drivers open for extruders. tm america, It sounds like you have figured out a way to do this using the Ramps but do you think this would work the same for the Azteeg X3 Pro? Any suggestions or advice or even a step by step would be appreciated. I have no experience with these electronics and firmware and learning off the cuff so I'm sure we will fry something eventually once we get started wiring things but I really hope to avoid that. If anyone has any code they would like to share please?
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 08, 2016 04:05PM
Quote
kugo
I am building a 1m x1m printer unit using lead screws and nema 23's. My design calls for 2 motors per axis running in tandem in parallel (which by way of wiring them in parallel would apparently be too much load for the drivers). And of course there is the option to wire in series like most people out there seem to suggest and just spread the work load on the motors but this I'm guessing would limit the ability to get the most working power from them.

My latest find was the Azteeg X3 Pro Controller, having 8 stepper driver connections, I thought this may be the way to go by accomplishing everything in the firmware. This would also leave 2 drivers open for extruders. tm america, It sounds like you have figured out a way to do this using the Ramps but do you think this would work the same for the Azteeg X3 Pro? Any suggestions or advice or even a step by step would be appreciated. I have no experience with these electronics and firmware and learning off the cuff so I'm sure we will fry something eventually once we get started wiring things but I really hope to avoid that. If anyone has any code they would like to share please?
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 08, 2016 05:21PM
Nema 23 motors are typically driven using external drivers driven from a 24V or 36V power supply. It is possible to drive them from all-in-one boards such as Duet or Smoothieboard if you choose the motors to have a suitable current rating, preferably between 1.5A and 1.8A. Use at least 24V power and preferably 30V. Don't try this with cheap plug-in drivers because they have nothing like enough PCB area to cool the chips properly, and heatsinks stuck on top of the plastic chips are worse than useless.

If you connect two stepper motors in series, the torque at low speeds is unchanged, but the maximum speed you can get from them before the torque starts to drop off is halved. This can be countered by increasing the supply voltage. Using two motors in series for the Z axis should be no problem because you don't need high speed. Using two in series for the X axis might limit the maximum travel speed you can achieve. Best try it and see, but have a backup plan in case you need to use separate drivers for the X motors.

Be aware that dual motors can and do get out of sync, in particular when you power the printer or just the motors off and on again. So an idle hold mode that reduces motor current is preferred to one that turns off the motor current altogether.



Large delta printer [miscsolutions.wordpress.com], E3D tool changer, Robotdigg SCARA printer, Crane Quad and Ormerod

Disclosure: I design Duet electronics and work on RepRapFirmware, [duet3d.com].
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 08, 2016 05:59PM
As dc42 said there are significant drawbacks to the series configuration. Each motor has a resistance and an inductance and these values are additive when in series.

Just pull off the step, direction, and enable pins and run external drivers. ... Or you could keep going down the path you described and rework marlin.
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 08, 2016 07:25PM
My thinking was if the motors never exceeded the maximum load specs of the plugin drivers (which my motors are 2.8 peak output and the e.g TMC2100 driver is 2.5 peak) then the Nema 23's should be okay. With 3d printing, there isn't much load on the motors other than a little resistance and weight of the rails itself never even close to stalling them. Though it's interesting to know more about using "external drivers" using the Nema 23's. What manufactures/models should I be looking for there. Would I be able to use them with Ramps or Azteeg X3 Pro for example? DRobs86, what does it mean to "pull off the step, direction, and enable pins and run external drivers? Is that in the firmware or driver or controller board? and how to do this if I went this route?

However, if in theory, the Nema 23's never draw more than the plugin drivers can handle, how can this be achieved in the Marlin Firmware how to specifically accomplish this?
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 09, 2016 02:07AM
Hi, Tm America,

I had a requirement to create dual signals of the extruder stepper signals (E0-direction/E0- step signal)
for making a filament movement sensor (Info is posted in forums under- General/Filament movement sensor for Marlin firmware).

I was using a ramps board which didn’t have headers to tap into for dual signals. After a lot of hunting around in Marlin I found that I could create dual signals by modifying the stepper.h and then was able to output dual E0 signals to I/O pins which I then connected up another micro processor.

I was only using one extruder, I found where Extruder E0 signals were in the stepper.h and added E1 signal commands to each of the E0 functions. Then in Pins sketch mapped the E1 pins to the I/O’s that I wanted to use.

I wonder whether you could do the same with the X stepper signals in stepper.cpp by adding X2 commands signals to the appropriate lines.

Looking at Marlin there appears to be separate commands for X2 and Y2 so hopefully they don’t share anything that will stop it working.

Good to use the find command (ctrl f) in the Arduino environment when hunting down commands across Marlin sketchs.


I have a Corexy with single X& Y steppers drivers as well as dual Z stepper drivers and dual Z home endstops, I managed to get them to auto sync with a bit of work in Marlin.
Properly a bit much to get auto syncing for both X and Y steppers.

Cheers

Edited 1 time(s). Last edit at 01/09/2016 02:12AM by RepRot.
Re: Running dual x stepper drivers and stepper motors with marlin firmware
January 09, 2016 10:13PM
Just had a play around with Marlin firmware to see if I could get dual X axis stepper signals without selecting dual x axis option on my ramps board. As I don't use a dual x stepper motor setup I used an oscilloscope to ensure that all three dual stepper x signals were present on I/o pins.

Description:..............Allows dual signals for the X axis (Step, Dir, Enable) - this can be outputted to I/O pins for external stepper drivers or configured to use for an existing stepper driver.
.....................................Don’t configure for dual x axis in configuration.adv.h
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Marlin Sketch:............ configuration.h
Line............................ 345
Insert line................... #define X2_ENABLE_ON 0 // for COREXY set to 0
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Marlin Sketch:.............marlin.h
Line:............................ 127
Default:....................... #define enable_x() X_ENABLE_WRITE( X_ENABLE_ON)
Change:......................#define enable_x() {{X_ENABLE_WRITE( X_ENABLE_ON);} {X2_ENABLE_WRITE (X2_ENABLE_ON);}}
Line:............................128
Default:........................#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); axis_known_position[X_AXIS] = false; }
Change:.......................#define disable_x() { X_ENABLE_WRITE(!X_ENABLE_ON); X2_ENABLE_WRITE(!X2_ENABLE_ON); axis_known_position[X_AXIS] = false; }

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Marlin Sketch:.............stepper.cpp
Line:............................125
Default:.......................#define X_APPLY_DIR(v,Q) X_DIR_WRITE(v)
Change:......................#define X_APPLY_DIR(v,Q) {{X_DIR_WRITE(v);} {X2_DIR_WRITE(v);}}
Line:............................126
Default:.......................#define X_APPLY_STEP(v,Q) X_STEP_WRITE(v)
Change:......................#define X_APPLY_STEP(v,Q) {{X_STEP_WRITE(v);} {X2_STEP_WRITE(v);}}

Marlin Sketch:............stepper.cpp
Line:...........................847
Default:......................X_DIR_INIT;
Change:.....................X_DIR_INIT; X2_DIR_INIT;

Marlin Sketch:............stepper.cpp
Line:...........................881
Default:......................if (!X_ENABLE_ON) X_ENABLE_WRITE(HIGH);
Change:.....................if (!X_ENABLE_ON) {{X_ENABLE_WRITE(HIGH);} {X2_ENABLE_WRITE(HIGH);}}
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Marlin Sketch:............pins.cpp …..or what ever board you are using.
Line:...........................24
Change:.....................Added the following and define what I/O pins you wish to output signal to. (You may wish to use an existing
.................................. onboard stepper driver, therefore you will need to know which I/O pins the stepper driver is using.
..................................#define X2_STEP_PIN ............... xx
..................................#define X2_DIR_PIN .................. xx
..................................#define X2_ENABLE_PIN .......... xx

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Sorry, only registered users may post in this forum.

Click here to login