Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:00 01 Aug 2025 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Help needed with G-code for ILI9341

Author Message
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 04:53am 14 Jun 2020
Copy link to clipboard 
Print this post

I am trying to mill out a faceplate/surround for an ILI9341 display using one of those cheap Arduino controlled CNC Router/Laser engravers. I have written a short G-code program to cut out the viewing area, drill the mounting holes and recess the rest of the display area into the back of the faceplate. Here is a portion of the code that I cannot work out what I have done wrong.
; ROUTE OUT BACK AREA FOR REST OF DISPLAY (USING 1.4MM BIT)
;
G00 X12 Y2 ;STARTING POINT
M3 ;SPINDLE CLOCKWISE
G1 Z-0.5   ;FIRST CUT -0.5mm
G1 X12 Y54 ;ROUTE BACK AREA 1ST CUT
G1 X80 Y54
G1 X80 Y2
G1 X11 Y2
G1 X11 Y55
G1 X81 Y55
G1 X81 Y1
G1 X10 Y1
G1 X10 Y56
G1 X82 Y56
G1 X82 Y0
G1 X9 Y0
G1 X9 Y56
G1 X8 Y56
G1 X8 Y0
G1 X7 Y0
G1 X7 Y56
G1 X6 Y56
G1 X6 Y0
;
M05 ;STOP SPINDLE ********* PROBLEM POINT ***********
G1 Z3                           ;Z AXIS RAISED TO CLEAR
;
G00 X1 Y1 ;STARTING POINT
G1 Z-1   ;2ND CUT -1mm
G1 X12 Y54 ;ROUTE BACK AREA 2ND CUT
G1 X80 Y54
G1 X80 Y2
G1 X11 Y2


When the router reaches the "PROBLEM POINT" it moves to home without raising the bit and proceeds to a diagonal point back at area of the viewing area cut.

I am very confused on how the code is interpreted this way and I have been banging my head against the shed wall. If someone could point me to the error of my ways it would be immensely appreciated.

OA47
 
Gizmo

Admin Group

Joined: 05/06/2004
Location: Australia
Posts: 5119
Posted: 05:01am 14 Jun 2020
Copy link to clipboard 
Print this post

Have you removing the M05? Just wondering if it interprets this as a stop and go home instead of just a stop. You can leave the spindle running during a traverse.

Or try the Z3 before M05 as a test.

Glenn
The best time to plant a tree was twenty years ago, the second best time is right now.
JAQ
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 05:18am 14 Jun 2020
Copy link to clipboard 
Print this post

Thanks for the reply Glenn but I have tried both of your suggestions and if I rem out the M05 then the problem moves to the Z3 command. It is as if I have reached the limit of commands in a sequence. I will try to break it up and see if that helps.

OA47
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 05:29am 14 Jun 2020
Copy link to clipboard 
Print this post

I think I have found the bug and I will give it another try.
OA47
 
TassyJim

Guru

Joined: 07/08/2011
Location: Australia
Posts: 6283
Posted: 06:06am 14 Jun 2020
Copy link to clipboard 
Print this post

I use CNCview.exe
It saves a lot of discarded material

Jim
VK7JH
MMedit
 
Bizzie
Senior Member

Joined: 06/07/2014
Location: Australia
Posts: 192
Posted: 09:39pm 14 Jun 2020
Copy link to clipboard 
Print this post

Is
  Quote  G00 X1 Y1 ;STARTING POINT
valid G code?

I think it should be GO X1 Y1 ;STARTING POINT
Rob White
 
Justplayin

Guru

Joined: 31/01/2014
Location: United States
Posts: 328
Posted: 11:21pm 14 Jun 2020
Copy link to clipboard 
Print this post

I don't know anything about G-code, but when I did a lookup of M05 and found that it could also be M5.  Perhaps the "cheap Arduino" controller doesn't support the M05 variant.

Just a thought.
I am not a Mad Scientist...  It makes me happy inventing new ways to take over the world!!
 
grunto
Newbie

Joined: 07/01/2015
Location: Australia
Posts: 15
Posted: 12:31am 15 Jun 2020
Copy link to clipboard 
Print this post

I normally use Mach3 and your GCode interpreter may be different so take my observations with a grain of salt!

I am assuming you are trying to cut a rectangle hole in the material? If so I have a couple of thoughts:

1. Your initial route is a strange tool path - you mill a rectangle at a depth of Z-0.5 and then go up and down the LHS multiple times, effectively cutting a pocket on the LHS (assuming the material is greater than 0.5mm thick).
2. You stop the spindle when the end mill is still in the material? You would normally retract before stopping a spindle (you normally wouldn't stop a spindle when traversing as it takes some time to spin up / down).
2. After you retract the spindle and return to the starting point you drop to a depth of Z-1 (without starting the spindle?) and then move from the starting point (X1 Y1) to X12 Y54 so you are going to either break the end mill or cut a diagonal line to that point - probably not what you intended?

Not sure why the M05 is a problem - certainly Mach3 has no issue with it but as suggested in a previous post it probably isn't required.
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 09:58am 15 Jun 2020
Copy link to clipboard 
Print this post

Due to my very grey cells I had fallen for the same issue some time ago and had forgotten about it. The software that came with the 3 axis unit shows a 3D diagram of the paths that the router will take and as you manually step thru the program it highlights the path taken by that command. The issue is that it shows the diagonal path at the M05 command when in fact it is two steps further on at the G00 X1 Y1 which should be as in the first cut G00 X12 Y2 ;STARTING POINT and as mentioned the router should be restarted with an M3 ;SPINDLE CLOCKWISE. Once these corrections were made everything worked flawlessly and I am very happy with the end result having the display neatly recessed into the back of the casing so that it can be sealed and not have a deep edge where you need to use the touch feature.

Thank you to all that helped. It is amazing when you get stumped on a problem for some time and just asking for help can alert you to the initial problem.

I think my head would still be making dents in the shed walls if it wasn't for this great forum.
OA47
 
matherp
Guru

Joined: 11/12/2012
Location: United Kingdom
Posts: 10310
Posted: 10:00am 15 Jun 2020
Copy link to clipboard 
Print this post

Have a play with CAMBAM. I've used it for years and can highly recommend. Their demo version allows full functionality for a limited number of uses. It includes both the drawing capability and g-code generation
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 581
Posted: 10:23am 17 Jun 2020
Copy link to clipboard 
Print this post

  OA47 said  ... the display neatly recessed into the back of the casing so that it can be sealed and not have a deep edge where you need to use the touch feature.
OA47


sounds great...    how about a photo to inspire us cnc newbies ?

A library of gcode snips for the various displays, switches etc would be good. Hacking with a file after drilling holes etc is ok I guess but I tend to stuff up with crappy results.
BTW can plastic panels be cut out ok, i am worried about melting edges. My last attempt at cutting thick polyethylene with a jigsaw was not good - the plastic melted and the cut edges welded together again during the cut !!!    
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 08:16am 20 Jun 2020
Copy link to clipboard 
Print this post

  Quote  how about a photo to inspire us cnc newbies ?


I will see what i can do over the next couple of days.

  Quote  BTW can plastic panels be cut out ok


I find slow down the revs and feed rate so that the plastic does not melt and still chips ok.

OA47
 
OA47

Guru

Joined: 11/04/2012
Location: Australia
Posts: 986
Posted: 10:42pm 22 Jun 2020
Copy link to clipboard 
Print this post

  Quote  how about a photo to inspire us cnc newbies ?


3.2" ILI9341




Earlier tests with 2.4 and 2.8 inch in front panels







OA47
 
zeitfest
Guru

Joined: 31/07/2019
Location: Australia
Posts: 581
Posted: 03:36am 24 Jun 2020
Copy link to clipboard 
Print this post

Nice !
You could probably sell them, the panel-type lcds often seem not to have any way of fixing to panels.
 
vegipete

Guru

Joined: 29/01/2013
Location: Canada
Posts: 1132
Posted: 03:47am 24 Jun 2020
Copy link to clipboard 
Print this post

Compressed air blasting at the cutter when machining plastic can be your friend. Except that it is noisy and sprays chips all over the place. Be cautious using any cutting fluid other than plain water, particularly with polycarbonate.
Visit Vegipete's *Mite Library for cool programs.
 
Print this page


To reply to this topic, you need to log in.

The Back Shed's forum code is written, and hosted, in Australia.
© JAQ Software 2025