Welcome! Log In Create A New Profile

Advanced

3 wire laser connection to RAMPS 1.4 - assistance please

Posted by Windwhistle 
3 wire laser connection to RAMPS 1.4 - assistance please
October 25, 2022 07:12AM
Hi All.
I've built a MPCNC and I planning on mounting a laser module so I can cut and engrave.
The controller is an Arduino mega2560 with a RAMPS 1.4 sat on top
I'm currently running Marlin 2.0.9

The laser is a 12v 10W (80w according to the listing [www.ebay.co.uk]) with an
Input interfaceangry smileyH2.54-3Pin (+,-, PWM/TTL)

This is a red, white and yellow cable.
If I connect the red and white wires to the Fan output (D9) I can vary the speed that the fan on the laser is running with M106 s(1-255) but there is no laser light.
When I connected the red and white to the 12v input cable and then connected to yellow to a 5v pin the laser comes on so I've proven the laser worked (one of my main concerns)

I'm just a little out of my depth with the config of marlin.
according to [marlinfw.org]
I need to enable LASER_FEATURE in Configuration_adv.h - DONE

Then I get a little lost as the docs branch out with standard, inline, dynamic inline and trapiziod modes and power.

Can anyone decode this voodoo for a layman who wishes to learn, perhaps with a single set of clear instructions regarding what I need to connect where and what needs to be in the config to make it work?

Any help and advice is greatly received - many thanks in advance.

W
Re: 3 wire laser connection to RAMPS 1.4 - assistance please
October 25, 2022 07:29AM
You need to connect the yellow PWM signal to a pwm capable IO pin on the ramps Eg D4 on the servo plug

You should use a much newer Marlin Many issues with laser where fixed recently. Ie 2.1.1


you then add #define SPINDLE_LASER_PWM_PIN 4 so marlin knows what pin to use

You should use inline, Much better results.


You NEED to watch this first [www.youtube.com]
Re: 3 wire laser connection to RAMPS 1.4 - assistance please
October 25, 2022 07:56AM
Quote
Dust
You NEED to watch this first [www.youtube.com]

Homework done I've now watched it. Some very wise words - thank you.
Interestingly, I had a discussion with my wife about this and the machine will be in a dedicated outbuilding with great ventilation AND a hinged shroud over the whole machine to catch and direct the smoke outside and protect from light bouncing about.

Just downloading the latest Marlin now.

Thank you for your directions!!!
ATB

W
Re: 3 wire laser connection to RAMPS 1.4 - assistance please
October 26, 2022 04:29AM
Morning Dust.
I'm sorry, I think I've done something wrong...confused smiley

I downloaded Marlin 2.1.1 and edited the file Configuration_adv.h
by adding
#define SPINDLE_LASER_PWM_PIN 4
at line 3400 the laser section
I built it with Visual Studio code and platform IO - no errors, a couple of warnings about feedback. Then I upload it to the board and get this..

Executing task in folder Marlin-2.1.1: platformio run --target upload

Processing mega2560 (board: megaatmega2560; platform: atmelavr@~3.4; framework: arduino)
---------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: [docs.platformio.org]
PLATFORM: Atmel AVR (3.4.0) > Arduino Mega or Mega 2560 ATmega2560 (Mega 2560)
HARDWARE: ATMEGA2560 16MHz, 8KB RAM, 248KB Flash
DEBUG: Current (avr-stub) On-board (avr-stub, simavr)
PACKAGES:
- framework-arduino-avr @ 5.1.0
- tool-avrdude @ 1.60300.200527 (6.3.0)
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
Converting Marlin.ino
LDF: Library Dependency Finder -> [bit.ly]
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 5 compatible libraries
Scanning dependencies...
Dependency Graph
|-- SPI @ 1.0
|-- Wire @ 1.0
Building in release mode
Compiling .pio/build/mega2560/src/src/inc/Warnings.cpp.o
Marlin/src/inc/Warnings.cpp:63:4: warning: #warning "Your Configuration provides no method to acquire user feedback!" [-Wcpp]
#warning "Your Configuration provides no method to acquire user feedback!"
^~~~~~~
Linking .pio/build/mega2560/firmware.elf
Checking size .pio/build/mega2560/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM: [=== ] 30.4% (used 2489 bytes from 8192 bytes)
Flash: [== ] 21.8% (used 55300 bytes from 253952 bytes)
Configuring upload protocol...
AVAILABLE: wiring
CURRENT: upload_protocol = wiring
Looking for upload port...

Warning! Please install `99-platformio-udev.rules`.
More details: [docs.platformio.org]

Auto-detected: /dev/ttyUSB0
Uploading .pio/build/mega2560/firmware.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.01s

avrdude: Device signature = 0x1e9801 (probably m2560)
avrdude: reading input file ".pio/build/mega2560/firmware.hex"
avrdude: writing flash (55300 bytes):

Writing | ################################################## | 100% 8.50s

avrdude: 55300 bytes of flash written
avrdude: verifying flash memory against .pio/build/mega2560/firmware.hex:
avrdude: load data flash data from input file .pio/build/mega2560/firmware.hex:
avrdude: input file .pio/build/mega2560/firmware.hex contains 55300 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 6.65s

avrdude: verifying ...
avrdude: 55300 bytes of flash verified

avrdude: safemode: Fuses OK (E:FD, Hgrinning smiley8, L:FF)

avrdude done. Thank you.

=============================== [SUCCESS] Took 29.15 seconds ===============================

Environment Status Duration
------------- -------- ------------
mega2560 SUCCESS 00:00:29.148


I reboot the board and the screen is on but no data displayed - I guess this due to the display not being configured on this vanilla firmware - no problem.
I have Octopi connected to the board so I send a m106 s5 command via the terminal and I get a pretty blue light glowing within the temporary shroud I have created.
Which is awesome! Thank you.

However I was under the impression that the "s5" was a speed\power setting between 1 and 255.
So I retried with a power of s100 i.e. m106 s100
The glow disappears but the fan attached to the laser increased speed.
It is the same for all "s" values with the exception of s3, s4 and s5 where the intensity of the glow and fan speed increase as the number increases.
Any ideas regarding what I have done wrong?

Thank you for your patience and assistance.

W
Re: 3 wire laser connection to RAMPS 1.4 - assistance please
October 26, 2022 05:49AM
yes you need to enable your lcd type

M106/M107 is fan control. This is the old primitive way to control a laser... inline uses standard moves gcode and is correctly synced with the start/end of the line


use move commands eg G1 X10 Y10 S100
and G0 for moves with laser off

Edited 1 time(s). Last edit at 10/26/2022 05:50AM by Dust.
Re: 3 wire laser connection to RAMPS 1.4 - assistance please
March 13, 2023 07:31AM
Hi all.
I've been enjoying the laser for the last few months, it cuts really well - I'm so impressed but I'm not so happy with my engraving.

This is engraving some bamboo
As the laser slows down to change the direction the power remains the same so it burns more.
I've been led to believe this can be improved by using GRBL but wondered if I have still got some improvement I can do in Marlin.
Checking my configs I'm not convinced I have "serial" configured correctly as kindly suggested by Dust.
I'm hoping for a little hand holding as I have managed to get myself totally confused with what I have done to get to where I am.
Here is the Ramps 1.4 board and how I have wired it.


Here is the pins config section

(if you need more let me know what bit :-) )


This seems to be what I am after but it is not doing what I expect.

... the spindle feature section


Can anyone kindly assist me in getting Marlin configured to scale the power and perhaps get it to work with "serial"?
Sorry to be a pain.
With best regards

W
VDX
Re: 3 wire laser connection to RAMPS 1.4 - assistance please
March 13, 2023 08:06AM
... to avoid this behaviour with burning the lines ends, I'm using the extruder-stepper STEP-pulses for the laser - they are calculated precisely for "pulses per mm" instead of simply PWM, regardless, how fast or slow the movement is ...


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: 3 wire laser connection to RAMPS 1.4 - assistance please
March 13, 2023 08:31AM
Thanks VDX
That sounds like a solution.
Can you elaborate how this is configured and how this manages different power settings?
I assume you would need fewer pulses per mm for high power settings - ending in just one (permanent) pulse for 100%
... or have I misunderstood?
Many thanks
Dan
Sorry, only registered users may post in this forum.

Click here to login