Welcome! Log In Create A New Profile

Advanced

Help needed for pin assignment on RAMPS 1.4 board.

Posted by kd6hq 
Help needed for pin assignment on RAMPS 1.4 board.
October 21, 2018 12:46PM
I am using the following: RAMPS 1.4, Marlin firmware V 1.1.8.

Recently I decided to build a Laser engraver/cutter. I disassembled an older printer and ordered parts to build
one that looks like the Eleksmaker A3. Additionally I purchased a 7W diode laser that requires a 5A driver board.
Since I am using a RAMPS 1.4 board I have been using the PWM signal from D9. I would like to continue
using D9 but so far all the 5A driver boards I have found want 0-5V TTL signals. I understand that it is possible
to reassign the pins to a 5V PWM signal.

Will this work? Is it possible to feed a PWM signal where a TTL signal is expected?

I've never reassigned a pin before, so I don't know what the "define statement" should look like or where it should be placed.

I understand that Marlin V 1.1.9 has settings for Laser/Spindle operation.
Would it be simpler to switch versions?

thanks for the help.
Don
Re: Help needed for pin assignment on RAMPS 1.4 board.
October 22, 2018 09:32AM
You cant re assign D9 to annother pin as such... (well not without hacking the arduino IDE)

I would try using D8, If you then provide the 11amp power plug on the ramps with 5v the output of D8 is 5v..

PWM is still TTL, just lots of on and off's, If its a digital laser on/off, it should be fine. If its actually powering the laser, It may not like it, and both on and off states can be delayed (capacitors in drivers)


It sort of depends what the gcode what ever your using is generating...

Some software uses the fan on/off gcode, If this is the case for you, you can redefine which pin that command toggles.

pins are defined in pins_RAMPS.h

eg
#ifndef RAMPS_D8_PIN
#define RAMPS_D8_PIN 8
#endif
#ifndef RAMPS_D9_PIN
#define RAMPS_D9_PIN 9
#endif

If you wanted to swap anything that used D8 to use D9 you could just change this to

#ifndef RAMPS_D8_PIN
#define RAMPS_D8_PIN 9
#endif
#ifndef RAMPS_D9_PIN
#define RAMPS_D9_PIN 8
#endif


Or you can also just solder a wire to the input of the mosfet, its still 5v there....

Edited 1 time(s). Last edit at 10/22/2018 09:34AM by Dust.
Re: Help needed for pin assignment on RAMPS 1.4 board.
October 22, 2018 10:16AM
Thank you Dust

OK, I found
// Heaters / Fans
//
#ifndef MOSFET_D_PIN
#define MOSFET_D_PIN -1
#endif
#ifndef RAMPS_D8_PIN
#define RAMPS_D8_PIN 8
#endif
#ifndef RAMPS_D9_PIN
#define RAMPS_D9_PIN 9
#endif
#ifndef RAMPS_D10_PIN
#define RAMPS_D10_PIN 10
#endif

So I will change it to look like this..

#ifndef MOSFET_D_PIN
#define MOSFET_D_PIN -1
#endif
#ifndef RAMPS_D8_PIN
#define RAMPS_D8_PIN 9
#endif
#ifndef RAMPS_D9_PIN
#define RAMPS_D9_PIN 8
#endif
#ifndef RAMPS_D10_PIN
#define RAMPS_D10_PIN 10
#endif

However right below this I happen to see:

if ENABLED(IS_RAMPS_EFB ) // Hotend, Fan, Bed
#define FAN_PIN RAMPS_D9_PIN
#define HEATER_BED_PIN RAMPS_D8_PIN

#elif ENABLED(IS_RAMPS_EFF) // Hotend, Fan, Fan
#define FAN_PIN RAMPS_D9_PIN
#define FAN1_PIN RAMPS_D8_PIN

Should I also change the board type to "EFF" from "EFB"?


Since I originally ask this question I have come up with another.
I will be using two steppers on the Y axis. I know that I could simply solder them wires together into one plug to run them in parallel. That I have already done and it works fine.
However if I swapped the pin allocation for Y and Z pins setup in the pins_RAMPS_h

#define Y_STEP_PIN 60
#define Y_DIR_PIN 61
#define Y_ENABLE_PIN 56
#define Y_CS_PIN 49

#define Z_STEP_PIN 46
#define Z_DIR_PIN 48
#define Z_ENABLE_PIN 62
#define Z_CS_PIN 40

I think I should be able to use the two plugs on the board since Y and Z would be swapped? Would it really be that simple or are there other places changes would need to be made?
I would also need to change the speed, steps etc. settings etc.

thank you for the help.
Re: Help needed for pin assignment on RAMPS 1.4 board.
October 22, 2018 11:58PM
"Should I also change the board type to "EFF" from "EFB"?"

It will make zero difference
as both have #define FAN_PIN RAMPS_D9_PIN

yes swapping Y and Z is just that easy

your steps/speeds etc all remain unchanged as they are for Y, and at the board level its using Z.

Only thing you need to check is that they have the correct microstepping jumpers as thats hardware
Re: Help needed for pin assignment on RAMPS 1.4 board.
October 23, 2018 04:52AM
Thank you Dust
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 02, 2018 02:51AM
Your laser driver board has two inputs, right? One should be power and one should be TTL. The TTL input is then used to control the current that is fed into your laser, i.e. 0V = Laser off, 5V = Laser max (or inverted). A PWM signal can be used to "simulate" these voltages.

If you enable the laser option ("SPINDLE_LASER_ENABLE") within Marlin's Configuration_adv.h, there are 3 pins assigned in pins_RAMPS.h (Marlin 1.1.9): Pin 4 for "Laser enable", pin 6 as PWM and pin 5 as direction pin (only necessary for CNC spindles). All these pins can be found in the "SERVOS" area on the RAMPS PCB.

SPINDLE_LASER_POWERUP_DELAY/POWERDOWN_DELAY should also be reduced - depends on your laser driver, but I guess this should be a really low value.

You should also change the SPEED_POWER_SLOPE/INTERCEPT/MIN/MAX values below because Marlin's default setting describes a 30,000 RPM spindle. I use SLOPE=1, INTERCEPT=0, MIN=0, MAX=255 so I can directly set the PWM value between 0..255 from the G-code.

edit: In my configuration, I don't use "laser enable" and "direction" pins - I only connect the laser PWM pin to the TTL input. The laser power input is directly connected to the power supply via a dedicated physical switch. I'd like to have full control of when the laser is enabled or not and avoid loosing my eyesight due to errors in Marlin or a bad G-code script...

Edited 1 time(s). Last edit at 11/02/2018 02:58AM by trapperjohn.
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 02, 2018 03:14AM
Hi trapperjon

Thanks for the input.

Well you close but not quite correct. The laser driver module dose have 2 inputs, on 12V and the other 12V PWM input. Currently the PWM input is being provided via D9 on the RAMPS 1.4 board with a configuration of "EFB". If I understand you correctly I should be able to change this, by using a driver board that uses a TTL level signal and by changing the board type to "SF" instead of "EFB".

I would need to move the pins but that should not be a big problem. I'm currently using the servo pins to drive a fan. I should be able to use the pins on Aux-1 or -2 for the this.

What program are you using to run the laser? Are you using the M106/107 or M03/05 commands?

I'm using a program called Light Burn and it automatically generates the appropriate coded depending on how you setup the program.
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 02, 2018 06:40AM
I did not change the board type, just enable the laser option in the advanced config header.

What specific laser driver do you own?

You could also use for example a MOSFET or an opto-coupler between the RAMPS board and your laser driver to feed the PWM input:

                12V
                  |
                  | 
5V PWM output -> MOSFET
                  | 
                  |
                12V PWM input

I use M3 / M5 commands and the Jtech Photonics Plugin for Inkscape. Currently I'm modifying it to generate G-code also from (grayscale) images (without dithering but modifying the laser output instead). But this still needs a lot of fine-tuning ...

Edited 1 time(s). Last edit at 11/02/2018 07:06AM by trapperjohn.
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 02, 2018 07:18AM
I'm using one of the Jtech current drive modules.
With a ramps board it uses D9 in a "EFB" board setting.
So the pwm signal is 12V from D9.

You might want to look at Light Burn, it has a 30 day free trial.
When using Marlin it defaults to M106 commands but has an option
to use M03/05 commands also.

Jtech has not come out with a 5 amp driver board yet so I have been looking
at [www.ebay.com] this one, but it uses a TTL level input.

So by using pin 6 should take care of it. Did you add a pull up resistor to it?

Why did you not choose to define the board as "SF" ? Was there a specific reason not to?
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 05, 2018 01:09PM
The laser is attached to my 3D printer using a quick swap mounting plate therefore I didn't want to break 3D printing functionality...
[www.thingiverse.com]

Unfortunately I just found out that M3/M5 commands lead to stuttering moves. Each time an M3 command appears between G1 commands, the laser stops for a short moment. I already removed the powerup/powerdown delays from the firmware but this did not help. This totally breaks grayscale engraving ...

The M106 command seems to not have that affect as the fan speed is always applied to the next "move block". I'll check if there is an easy possibility to convert M3/M5 to work in the same way (or reconfigure my laser to use a fan output ...).
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 05, 2018 02:52PM
I don't know if it would work for but I'm using one current modules from JTech.
It uses the D9 fan control on the RAMPS board. On the JTech web sight there in some information about using it with the RAMPS board.
I'm not sure how it would work with your "quick" swap setup. Also it uses the M106 command.
VDX
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 05, 2018 05:23PM
... in my modules I'm simpy using the extruder STEP pulses - so it's simply: G0-moves are without laser, G1-moves with ... and the pulsing rate is exactly synchronized with the speed - so no "burned edges", as with PWM and accelerated moves.

To adjust the power I'm changing the pulses lengths - "lowest power" will emit 5µs long pulses ... then, the more power, the longer a pulse ...


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: Help needed for pin assignment on RAMPS 1.4 board.
November 06, 2018 02:34AM
Accelerated moves are actually no issue for me - I'm mostly targeting grayscale engraving which I'm doing line-wise. The laser is always moving from left to right at the same speed and laser power modulated via PWM. Acceleration and deceleration are done before and after the the laser is switched on.

But if I understand the Marlin config correctly, I just need to disable laser support and define pin 6 as FAN1_PIN. No need to change any connection at all. Will try that today...
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 11, 2018 12:15PM
Just wondering how pin 6 worked out for you?
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 12, 2018 04:23PM

Very good so far - still dialing in speed and power levels, but the first attempts look promising.

Edited 1 time(s). Last edit at 11/12/2018 04:26PM by trapperjohn.
VDX
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 12, 2018 04:41PM
smileys with beer


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: Help needed for pin assignment on RAMPS 1.4 board.
November 12, 2018 07:59PM
Here is a Face book group you may be interested in.
[www.facebook.com]
Most of the folks on there are using 2.5W diode lasers.

It looks like your laser may be scorching the wood just a little.
Do you have any kind of Air-assist on your machine? If not you
may want to consider it. Air-assist blows the charcoal away before it has a chance to land on the wood.

Some coasters I made for a friend.



Other than that I would say that you are very
much on your way.
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 13, 2018 02:36AM
Thanks - there is no real ventilation yet (only the air flow through the box).

And I think that also the dark parts are still a bit overpowered.
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 13, 2018 06:03AM
Have a look at this post that I did on Face book.

[www.facebook.com]

One way to do air assist setup:



Edited 1 time(s). Last edit at 11/13/2018 06:12AM by kd6hq.
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 17, 2018 12:06PM
I was just wondering what constant current laser driver you are using?
Re: Help needed for pin assignment on RAMPS 1.4 board.
November 18, 2018 02:41PM
I use the 4.5A driver from Lasertack
[lasertack.com]

attached to a 3.5W NUBM05 diode.
Sorry, only registered users may post in this forum.

Click here to login