Heater Extruder 0 D10 used for a magnet: how to reduce power after 1s?
I am using ramps1.4 as a controller for a plotter.
for Pen up/down I use the Extruder 0 output for a cylindrical magnet.
The magnet can be overpowered for a shorttime to increase force, when moving back the stroke into the magnet.
When the stroke is inside, then the magnet works better and the power for the magnet can be reduced (otherwise the magne becomes too hot).
So I would like to work with 100% on the output (in my case extruder 0=D10) and after 1s reduce it to 50%.
What is the best way to achieve that? and where do I have to change the code?
According the scemata I can also start with 24V (for 12V magnet) and switch back to 6V=25% when the stroke is inside the magnet.
There is 5A and 11A input - do both have the same currency? or are they different?
Thanks for advice!
for Pen up/down I use the Extruder 0 output for a cylindrical magnet.
The magnet can be overpowered for a shorttime to increase force, when moving back the stroke into the magnet.
When the stroke is inside, then the magnet works better and the power for the magnet can be reduced (otherwise the magne becomes too hot).
So I would like to work with 100% on the output (in my case extruder 0=D10) and after 1s reduce it to 50%.
What is the best way to achieve that? and where do I have to change the code?
According the scemata I can also start with 24V (for 12V magnet) and switch back to 6V=25% when the stroke is inside the magnet.
There is 5A and 11A input - do both have the same currency? or are they different?
Thanks for advice!
Comments
working on 24V needs modification on Ramps, otherwise you´ll fry your arduinos voltage regulator.
also depending on manufacturer of Ramps supply of 24V at 11A input might get critical as the Polyfuse
can handle max16V.
so as you have 12V magnet supply on 12V ( keep as it is)
in Firmware assign Extruder 0 pin to a pin not used , so you get D10 out of the sensitive Pin List.
Power control should be possible by M42 command then.
I use the lasermode - there is a function that could controll intensity:
void LaserDriver::changeIntensity(uint8_t newIntensity)
(there is a comment in drivers.h - which I did not 100% understand - to recode this function to really use 0-255 intensity)
M42 changes the output: I have the relation to the time: the fist second is 100% afterwards 50%.
would you recommend "Custom_100MS()" to check if the pin is on - for example if it is 10xtimes in row on then change intensity with LaserDriver::changeIntensity(125)?
How to change the intensity:
in drivers.h is a comment:
/*
With laser support you can exchange a extruder by a laser. A laser gets controlled by a digital pin.
By default all intensities > 200 are always on, and lower values are always off. You can overwrite
this with a programmed event EVENT_SET_LASER(intensity) that return false to signal the default
implementation that it has set it's value already.
EVENT_INITALIZE_LASER should return false to prevent default initialization.
*/
so I changed in events.h:
#define EVENT_INITALIZE_LASER true
to
#define EVENT_INITALIZE_LASER false
I did not understand the EVENT_INITALIZE_LASER comment:
// Set laser to intensity level 0 = off, 255 = full. Return false if you have overridden the setting routine.
// with true the default solution will set it as digital value.
#define EVENT_SET_LASER(intensity) true
should I just change it to:??
#define EVENT_SET_LASER(intensity) false
but the function is nowhere defined?
Should I make a new function?
but now how can I use M3 Sxxx under CNC-control?
Events are quite simple if you look where they get used. Often it is inside a if condition, so return value determines if the if condition should get executed or not. If you have own initializer you replace
#define EVENT_INITALIZE_LASER true
by
#define EVENT_INITALIZE_LASER initMyLaser()
and initMyLaser returns false after doing its work since it did now initalize the pins.
Handling the set intensity is similar - either your function does it pr old default or both.
I find a WRITE function like:
WRITE(CNC_ENABLE_PIN,!CNC_ENABLE_WITH);
but this is a digital command.
As far as I understood I have to replace that by a analog function.
like WRITE(CNC_ENABLE_PIN,125);
but this obviously wrong.
I do not find a analogWrite...
What is the corresponding function in repetier?
(In theory CNC_ENABLE_PIN could be down in between but that is not very likely)
void Custom_500MS()
{
//reduce power after max 3x500ms
if (analogRead(CNC_ENABLE_PIN)>180){penup=penup+1;}
else {penup=0;}
if (penup>3){analogWrite(CNC_ENABLE_PIN,150);}
}
analogWrite is what you need to set power as long as it uses a free interrrupt (3,4 or 5 should be fine also sounds may use 3 I think with M300).