Hi,
I'm building a complex 3D printer using the Marlin firmware on the arduino mega with the ramps 1.4 shield, and I need to intervene and correct the z-axis.
The stepper driver I'm using is the DRV8825 and I'm implementing the above by connecting the enable, step, dir pins of the z-axis through a logic level converter to a teensy 3.6 (along with other sensors to for the system feedback) while the teensy is the one connected to the stepper driver.
The idea is simple - the teensy should do all that received by Marlin and on top of that correct when needed.
My problem is that I'm not managing to recreate the stepper movements received, and if I can, the steps are very rough and the motor makes a lot of noise.
Most of the sensor algorithm is written down so I'm now only focusing on this problem (code attached is only relevant to this and not the sensors)
I'm using 3 interrupt pins as well as digitalWriteFast and digitalReadFast.
Since the speed of a step is defined by the pulse length, I divided the step interrupt into rising and falling so I retain the pulse length.
I'd be happy if someone could tell me what's wrong with my code or how to implement it better given that i'm using the teensy.
One last thing, pins M0-M2 are fixed by jumpers and not implemented by the code. (I'm using 16 microsteps/steps)
Marlin - http://marlinfw.org/
Ramps 1.4 - http://reprap.org/wiki/RAMPS_1.4
DRV8825 - https://www.pololu.com/product/2133
DRV8825 Data sheet - https://www.pololu.com/file/0J590/drv8825.pdf
View attachment intermediator.ino
View attachment stepper_corrections.cpp
View attachment stepper_corrections.h
Thanks
I'm building a complex 3D printer using the Marlin firmware on the arduino mega with the ramps 1.4 shield, and I need to intervene and correct the z-axis.
The stepper driver I'm using is the DRV8825 and I'm implementing the above by connecting the enable, step, dir pins of the z-axis through a logic level converter to a teensy 3.6 (along with other sensors to for the system feedback) while the teensy is the one connected to the stepper driver.
The idea is simple - the teensy should do all that received by Marlin and on top of that correct when needed.
My problem is that I'm not managing to recreate the stepper movements received, and if I can, the steps are very rough and the motor makes a lot of noise.
Most of the sensor algorithm is written down so I'm now only focusing on this problem (code attached is only relevant to this and not the sensors)
I'm using 3 interrupt pins as well as digitalWriteFast and digitalReadFast.
Since the speed of a step is defined by the pulse length, I divided the step interrupt into rising and falling so I retain the pulse length.
I'd be happy if someone could tell me what's wrong with my code or how to implement it better given that i'm using the teensy.
One last thing, pins M0-M2 are fixed by jumpers and not implemented by the code. (I'm using 16 microsteps/steps)
Marlin - http://marlinfw.org/
Ramps 1.4 - http://reprap.org/wiki/RAMPS_1.4
DRV8825 - https://www.pololu.com/product/2133
DRV8825 Data sheet - https://www.pololu.com/file/0J590/drv8825.pdf
View attachment intermediator.ino
View attachment stepper_corrections.cpp
View attachment stepper_corrections.h
Thanks