Welcome! Log In Create A New Profile

Advanced

Adding Some Code on Marlin Firmware

Posted by hehenryprbo 
Adding Some Code on Marlin Firmware
July 29, 2019 11:38PM
Hello, i want to add some code like "analogWrite(PIN_PWM, Value)" whenever the stepper of extruder is moving. But i am confused about where to place the code. Can somebody tell me how to do that, thank you.

i am using Ramps 1.4 board, Cura software, arduino software, and of course marlin firmwarespinning smiley sticking its tongue out
VDX
Re: Adding Some Code on Marlin Firmware
July 30, 2019 03:51AM
... do you need an analogue voltage or PWM?

For "speed-synchronous pulsing" I'm using the extruder step pulses and set the "pulses per mm" per E value in G-code:

"G0 X0 Y0 F6000"
"G1 X10 Y0 E500 F3000"

Will give a line from 0,0 to 10,0 with 50 pulses per Millimeter (in firmware the pulse/mm value is defined to 1).


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

Call for the project "garbage-free seas" - [reprap.org]
Re: Adding Some Code on Marlin Firmware
July 30, 2019 11:15AM
because on arduino mega that i use just genereta PWM, so i want to use PWM. But i means, i want just generate PWM whenever extruder run and then when extruder stop, PWM will become 0. Just like that
Re: Adding Some Code on Marlin Firmware
July 30, 2019 02:27PM
FYI this function (PWM output on extrude) has been a standard feature of RepRapFirmware for about 4 years. See [reprap.org]. You need a 32-bit board to run RepRapFirmware.



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].
VDX
Re: Adding Some Code on Marlin Firmware
July 30, 2019 04:28PM
... hmmm ... I don't see your problem confused smiley

If the printer moves with "G0 Xnnn Ynnn Znnn", the extruder STEP output is "quiet".

When "printing" with "G1 Xmmm Ymmm Zmmm Eeee", the extruder STEP output performs eee pulses, evenly distributed along the moved/printed line from "nnn" to "mmm" ...


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

Call for the project "garbage-free seas" - [reprap.org]
Re: Adding Some Code on Marlin Firmware
July 30, 2019 11:32PM
can i use the step pin ouput extruder as a voltage output then ?
VDX
Re: Adding Some Code on Marlin Firmware
July 31, 2019 03:57AM
... yes - I'm doing this for "pulsed" paste-dispensing and for laser-engraving.

The ArduinoDue gives 3,3V HIGH output - so, for controllers with 5V or 24V input level, I'm level-shifting the 3,3V to 5V or respective 24V.

Another problem could be the pulse-length -- the Due gives pulses with 0,5 microseconds duration, what's not long enough for some controllers - here I'm using a monoflop to make the pulse longer (2 to 10 microseconds) ... or another small Arduino (Pro Nano) as "slave" to set/define the pulse-length between 5 to 500 microseconds for "virtual" power setting when laser-engraving ...


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

Call for the project "garbage-free seas" - [reprap.org]
Re: Adding Some Code on Marlin Firmware
August 01, 2019 04:33AM
i am confusing about changing the code of step pin output of extruder, so what i have done just give a line of code

if (parser.linearval('F') > 0 || parser.linearval('E') > 0){
analogWrite(4, 254);
}

inside "gcode_get_destination" void which is inside marlin_main.cpp

hahaha...

but i hope can find a way to make an output pwm that synchronous with the speed of extruder...
VDX
Re: Adding Some Code on Marlin Firmware
August 01, 2019 11:41AM
... why coding? - simply use the pin as is smoking smiley


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

Call for the project "garbage-free seas" - [reprap.org]
Help to make HEATED_BED run colder
January 21, 2020 04:07PM
Hello,
I need help to make HEATED_BED run colder - actually below the room temperature by using Peltier Cooler.

I am able to configure HEATED_BED heater output pin which is in my case D8 with settings in the configuration_adv .h ----- lines 97 to 101

#define HEPHESTOS2_HEATED_BED_KIT
#if ENABLED(HEPHESTOS2_HEATED_BED_KIT)
#undef TEMP_SENSOR_BED
#define TEMP_SENSOR_BED 70
#define HEATER_BED_INVERTING true // where this line invert pin operation - and it can drive Peltier Cooler.

This is my quick way to make this work , but there is one problem: On the power reset settings of the HEATED_BED is set to 0 and temperature loop engage immediately driving the Peltier Cooler.

It can be fixed by inserting the condition for the HEATED_BED temperature PIN D8 in my case. That condition should be: If HEATED_BED is set to 0 pin D8 should be LOW otherwise if the 1C - to ambient temperature loop will take over. This way HEATED_BED temperature can be set between 1C - to ambient temperature.

A am not the programmer with very limited knowledge of the marlin software operation and I know this is not the appropriate location to make changes , but after spending few weekends on this I got lost.

Can anybody help with adding the pin condition and / or and point me to the right location what to modify.

Thanks,
Attachments:
open | download - Configuration_adv.h (118.6 KB)
open | download - Configuration.h (81.2 KB)
Sorry, only registered users may post in this forum.

Click here to login