top of page

CNC Machining: ChatGPT Takes the Wheel

Exploring the potential of advanced AI language models to control hardware


Introduction

The rapid advancements of large language models like ChatGPT are reshaping our world. In our recent experiment, we developed a “plugin” that allows ChatGPT to directly communicate with a CNC machine, showcasing both the astonishing possibilities and concerns of AI-driven hardware control.

AI Evolution

As AI language models evolve, their capabilities expand from programming to passing bar exams. The recent addition of plugins enables ChatGPT to access real-time information from the internet and interact with third-party software apps like Expedia, Shopify, Slack, and Wolfram Alpha.

The Experiment

We allowed ChatGPT access to our OpenBuilds CNC machine to examine the potential benefits of AI-driven hardware control. Using OpenAI’s API and the CtrlEase front end, we put ChatGPT’s machining skills to the test.


The Result

While GPT3.5’s initial attempt resulted in just a straight line instead of the desired “GPT3”, the GPT4 model produced a much better result after a few rounds of feedback (see image below). While there is still a lot of room for improvement, the fact that our CNC router could engrave the word “GPT4” by simply issuing prompts to ChatGPT is a testament to the potential of AI technology in CNC machining. We did not have to use Fusion 360 or VCarve Pro — a single conversation with the AI was all it took! This breakthrough signals a tectonic shift that is underway in the software world.



The future

We are entering an era where increasingly intelligent software can not only interact with the software but also write its own code to control hardware.

With human feedback, ChatGPT’s ability to learn and improve is impressive. While it may not be perfect yet, the rate of progress is staggering. Soon, multimodal features of GPT4 to accept images and text will enable AI to analyze camera images, learn from mistakes, and improve even faster.

Our experiment demonstrates that we’re entering an era where increasingly intelligent software can not only interact with other software but also write its own code to control hardware. What responsibilities do developers and users have in ensuring the ethical use of AI-driven hardware control? How can we strike a balance between harnessing the benefits of AI advancements and mitigating potential risks?

Code that was written by GPT3.5 to engrave the word “GPT3” using my CNC machine.

G21 ; Set to millimeter mode
G90 ; Set to absolute positioning mode
G1 Z-75.5 ; Move to the cutting height in Z-axis
G1 X40 Y0 F200 ; Move to the starting point of letter "G"
G1 Z-1 ; Move down to start cutting
G1 X40 Y25 F200 ; Draw the first line of letter "G"
G1 X60 Y25 ; Move to the next point
G1 X60 Y0 ; Draw the second line of the letter "G"
G1 X55 Y0 ; Move to the next point
G1 X55 Y15 ; Draw the third line of the letter "G"
G1 X40 Y15 ; Move to the next point
G1 X50 Y15 ; Draw the last line of letter "G"
G1 Z-75.5 ; Raise the tool
G1 X70 Y0 F200 ; Move to the starting point of letter "P"
G1 Z-1 ; Move down to start cutting
G1 X70 Y25 F200 ; Draw the first line of letter "P"
G1 X85 Y25 ; Move to the next point
G1 X85 Y20 ; Draw the second line of letter "P"
G1 X75 Y20 ; Move to the next point
G1 X75 Y15 ; Draw the third line of letter "P"
G1 X85 Y15 ; Move to the next point
G1 X85 Y0 ; Draw the last line of letter "P"
G1 Z-75.5 ; Raise the tool
G1 X95 Y0 F200 ; Move to the starting point of letter "T"
G1 Z-1 ; Move down to start cutting
G1 X110 Y0 ; Draw the first line of letter "T"
G1 X110 Y25 ; Move to the next point
G1 X105 Y25 ; Draw the second line of letter "T"
G1 X105 Y15 ; Move to the next point
G1 X95 Y15 ; Draw the third line of letter "T"
G1 Z-75.5 ; Raise the tool

The sample code was written by GPT4 after a few rounds of feedback.

G90 ; Set absolute distance mode
G21 ; Set units to millimeters
G92 X0 Y0 Z0 ; Set current position as origin

; G
G0 X0 Y0 Z-75 ; Move to starting position
G1 F200 ; Set feed rate to 200 mm/min
G1 X0 Y25
G1 X25 Y25
G1 X25 Y15
G1 X15 Y15
G1 X15 Y5
G1 X25 Y5
G1 X25 Y0
G1 X0 Y0
G0 X15 Y10 Z-75 ; Inside G line
G1 X15 Y20
G1 X10 Y20

G0 Z-73 ; Lift router 2 mm
G0 X30 Y0 Z-73 ; Move to starting position of P

; P
G0 Z-75 ; Lower router to cutting height
G1 X30 Y25
G1 X55 Y25
G1 X55 Y20
G1 X40 Y20
G1 X40 Y0
G1 X30 Y0

G0 Z-73 ; Lift router 2 mm
G0 X60 Y0 Z-73 ; Move to starting position of T

; T
G0 Z-75 ; Lower router to cutting height
G1 X60 Y25
G1 X80 Y25
G1 X80 Y20
G1 X75 Y20
G1 X75 Y0
G1 X65 Y0
G1 X65 Y20
G1 X60 Y20

G0 Z-73 ; Lift router 2 mm
G0 X90 Y0 Z-73 ; Move to starting position of 4

; 4
G0 Z-75 ; Lower router to cutting height
G1 X110 Y0
G1 X110 Y5
G1 X95 Y5
G1 X95 Y20
G1 X90 Y20
G1 X90 Y25
G1 X95 Y25
G1 X110 Y5
G1 X115 Y5
G1 X100 Y25
G1 X90 Y25

G0 Z5 ; Move Z-axis up to safe height
G0 X0 Y0 ; Move to starting position
M30 ; End program

Note: During this experiment, adequate safety measures were implemented to ensure the safe operation of the equipment. Additionally, a “kill switch” was in place to stop the CNC machine in case of any unexpected or erratic behavior.

42 views0 comments

Recent Posts

See All

Comentários


bottom of page