Welcome! Log In Create A New Profile


Marlin with DC Motor for Extruder

Posted by jmiller451 
Marlin with DC Motor for Extruder
March 21, 2016 08:24PM
I have an Arduino Mega to run Marlin firmware for my 3d printer. For the extruder, instead of a stepper motor I have a DC motor so I want to get the Mega to output a continuous voltage (and boost the power) instead of a pulsing "step" signal. Unfortunatey, I'm not a strong C++ programmer I can read it with a basic understanding so please bare with me.

Here's what I've been thinking for a start to the code:

insert the following at line 786 in stepper.cpp
// my test code insert
long var = 1; // conversion variable - shouldn't be defined here since this repeated
long rate = var * ( step_rate)^-1 / timer_interval; //for each "step" use the "step/mm" variable (set in line 590 of the configuration.h file) divided by the frequency of the step function multiplied by the conversion to get the specified output
E3_STEP_WRITE(rate) ; //writes output to test pin on XX

Here's what I think I would need
1. How do I command to cause an analog write to an output pin location? The _step_write function seems to be defined in stepper.cpp line 991, but I'm not sure where to go from here. Normally, I've seen the input/output done with java where the syntax is analogWrite(pin, value) (https://www.arduino.cc/en/Reference/AnalogWrite). But since this is all written in C++, I'm not sure how to output an analog signal to a given pin.
2. where should "rate" be defined. It doesn't need to be defined every loop, just calculated.
3. Is "timer" the correct variable to identify the period of the timer?
4. Is "axis_steps_per_unit[E_AXIS] the correct way to define this variable? I think this only needs to be simply the variable which relates steps to length.
5. where should the variable "var" be defined. since this is a loop structure probably doesn't need to be defined over and over. also since variable can be a static (for now), it can be defined elsewhere (perhaps in the configuration.h file?).
Re: Marlin with DC Motor for Extruder
March 23, 2016 05:41AM
If you just want on and off (even PWM) you can just connect it to a IO pin (with suitable electronics) and control it with the m42 command


Can only use unused pins though, normally used pins are locked out to stop sillyness
Re: Marlin with DC Motor for Extruder
March 24, 2016 06:52PM
I would like it to scale the PWM output according to the intented extrusion rate. If I control this in the Gcode with an M-command I would need to reconfigure my Slicer to add the M42 command for every extrusion line. I was hoping to change this in the firmware instead. Any thoughts on how to do this?
Re: Marlin with DC Motor for Extruder
April 08, 2023 03:03PM
I want to to something similar to this. instead of DC motor, I want to install a valve based extruder (Just on and off)

Could you help me please?
I don't want to modify every line of gcode, I just want to turn on a signal when the extruder suppose to extrude.
Re: Marlin with DC Motor for Extruder
April 08, 2023 04:21PM
... for paste-jetting I'm using the extruder-steps by recalculating the needed E-step number in the G-code according to the moved path, so it's a precise "pulses per mm" output.

To change it into "ON/OFF" instead of pulsing, but still exactly "synchrone" to the G1-moves, I've used an external "retriggered monoflop" IC, where the timer circuit is triggered with every E-step and reset with the next G0 command (so two pins wired to the timer-IC - "E-STEP" and "RESET") ...

Aufruf zum Projekt "Müll-freie Meere" - [reprap.org] -- Deutsche Facebook-Gruppe - [www.facebook.com]

Call for the project "garbage-free seas" - [reprap.org]
Sorry, only registered users may post in this forum.

Click here to login