Welcome! Log In Create A New Profile


PCB Exposer Marlin Firmwaresad smiley

Posted by whitepawn 
PCB Exposer Marlin Firmwaresad smiley
August 20, 2023 12:48PM
I have been working on some DIY PCB laser exposer project quite time ago.Then i saw that someone already done it which is Diyouware PCB.Here is original project page for it:[www.diyouware.com]

Made electronics and mechanical parts (which i modified some of them) it works perfectly electronicly speaking and mechanicaly speaking but i struggled it software capabilities.

Let me explain this printer works briefly:

It's just a cartesian 2 axis X-Y printer on top of PHR-803T blueray module.
The blueray module focuses on home position with lens servos and keeps lens position at focus.
The printer which have arduino based motherboard takes HPGL coordinate values and translates it into stepper drivers which in my case TMC2208.
Laser diode exposes tracks-vias etc. into dryfilm, then you develop PCB.
Here is their demo about it:

I have couple of problems about this project:

Since it is quite an old project it was designed to use with EAGLE CAD software with HPGL/1 export.I use KiCAD in my projects which exports HPGL/2(which i cannot use with my printer), Gerber,DXF etc.So i have to made and DXF export in KiCAD open it with AutoCAD Plot it with HPGL/1 manually edit code to printers parameter and only that time i can use it but since it is a conversion issue AutoCAD doesn't export HPGL/1 like EAGLE does.Here is some pictures so you can understand what i mean:

Also in small segments such as numbers it overoxposes dry film:

So my main problem is this.The AutoCAD exports HPGL/1 differently (Diagonal lines on horizontal, Overlapping lines on complex objects such as text and numbers) and my PCB come out as overexposed or underexposed. I have tried many programs to convert DXF, Gerber, postscript such as PloView and GerbView none of them work for me to correctly translate into HPGL/1.Also used different laser power levels and tried many many options but it made me crazy.spinning smiley sticking its tongue out

As a result i decided to use MARLIN with Gcode but here is the problem i cannot implement laser focus function of PHR-803T. The main 4 code for focusing laser is there but since i am a hardware guy more then software i don't know where to start and how to implement it with marlin.I bought RAMPS 1.4 + Arduino Mega + Smart LCD controller for marlin firmware.I can rewire arduino (Focus signal, Step DIR, laser on/off and intensity etc.) for arduino mega and can configure pins.h according to it.

Also i want to use raster lasering for PCB exposure for more control.I am open to any toughts about this.

TLDR:I need to implement focus code to MARLIN fw.
Focus code:

Here is original source code:

Here is original arduino source code:

Any help or guide would be greatly appreciated.
Re: PCB Exposer Marlin Firmwaresad smiley
August 20, 2023 02:56PM
... in the past I did PCB-layout and CNC-milling with Eagle and export to NC/Gerber or PLT/HPGL.

Then switched to Target and got even more export-options or prgrammed several converters from HPGL or DXF into Gcode for Pronterface+Marlin ... last was with laser-engraving by removing the copper directly.

Here an older Thread (most videos lost) ... the laserengraved PCB on the 5th page:


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: PCB Exposer Marlin Firmwaresad smiley
August 21, 2023 01:51PM
This was an interesting journey through old software.

After some massaging I was able to compile and upload the ATmega image. Here's what I ended up with: TwinTeethFirmware.zip

The command I used to compile & upload it was platformio run -t UPLOAD --upload-port COM22. I used platformio within VSCode to compile it.

The binary is at: TwinTeethFirmware\.pio\build\megaatmega2560\firmware.hex

Getting the PC side program running was a challenge. I've never worked with the PROCESSING program before and know very little about Java. I had a lot of false starts but I think this should get you up and running:
  1. Download the latest PROCESSING program
  2. Unzip it and click on processing.exe to start it.
  3. Create a new sketch called TwinTeethMC
  4. Copy these ZIP files into the TwinTeethMC sketch directory: TwinTeethMC.zip, libraries.zip, code.zip
  5. Use 7-Zip's "extract here" option to unzip the three files. You should end up with TwinTeethMC sketch directory containing the directories code, data and libraries plus a bunch of pde and ser files.
  6. Restart processing.exe
  7. Open the sketch TwinTeethMCV and click on the run icon (right pointing arrow on the second line).
Re: PCB Exposer Marlin Firmwaresad smiley
August 22, 2023 04:29AM
@VDX thanks for reply.Very nice results but I don't have such powerful lasers to engrave.I just want to expose dry film.
I have seen some examples like this old laser printer to exposes dry film also.They are all great projects but i already made this project (DiyoPCB-MKI) except software retrofit.(Autofocus function in marlin.)

It's not related with our subject but here are some examples some guys made exposer from laser printer heads:
[www.youtube.com] (Video is in German language i didn't understand well but it seems pretty neat solution.I think you know german smileys with beer)
So there are many options but as i said i already built diyouware project.(DiyoPCB-MKI)

@bob thanks for reply.I didn't make myself clear, sorry for that let me explain:
I can already can compile original DiyoPCB-MKI firmware for arduino UNO not MEGA.And it works just fine (both firmware and processing code) except HPGL/1 issue i described before. TwinTeeth is more capable with 3D printing capability and laser exposing capability which uses MEGA but different laser driver and different focus codes.
I made hardware for DiyoPCB-MKI which is this one:

Thanks for compiling code but your compiled code is for TwinTeeth which is this one:

For ease of use and HPGL issues i faced with i want to change my DiyoPCB-MKI to run Marlin just like this videosad smileyI already bought Ramps+Mega+LCD and will replace with arduino uno)
Or this videos:

In a nutshell, i can upload codes in above videos but my laser module (PHR-803T) needs custom autofocus function which i attached 4 pieces of code(zip file) in my first post.
It must run autofocus code once like 3D printers homing sequence then print like other laser engravers above videos.I don't need processing code since it can be print directly with SD card so Processing code is not necessary, please don't bother it.

I already find some code for marlin based laser machines but i don't know how to implement autofocus feature for my laser module.Here are some examples:

Now i am investigating how to write custom codes for marlin to implement autofocus feature.(I don't know if its the right direction).Here is one example:

By the way how did you imported such an old project to platformio?I also use visual studio code with platformio.

Here is autofocus (IN command) explanation from original project:

Many many thanks in advance.
Re: PCB Exposer Marlin Firmwaresad smiley
August 22, 2023 06:51AM
@whitepawn -- for the "German" video - you can activate subtitles and select between many available languages, if you want to read the automatic transcription cool smiley

Edited 1 time(s). Last edit at 08/22/2023 06:51AM by VDX.

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: PCB Exposer Marlin Firmwaresad smiley
September 05, 2023 03:31PM
Hi again,

I wrote some code and shared whole process in my github page for who is wondering.
Here is my github page for it:


Autofocus doesn't work for now but i compiled marlin for it and basic stuff works such as laser on/off, movement x-y, LCD, SD card etc.

Development is slow but ongoing because i am new at this stuff. Any ideas or pull requests are welcome.smiling smiley
Sorry, only registered users may post in this forum.

Click here to login