Custom GUI for "grbl"

Go To Last Post
18 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Many of you may already know I have a small CNC machine shop. I have converted an old (mid '70s era) Bridgeport BOSS CNC to use MACH3 instead of the antiquated controller. I have also made my own screenset for MACH3.

 

I am currently designing a simple Pick-and-Place machine for populating surface mount PC boards using an Arduino (with a CNC Shield) and "grbl" to control it.

 

In my experimenting with grbl, I am discovering the available "G-code senders" to be severely lacking - especially to someone (like me) that has a lot of experience with "real" CNC machines. So I'm looking into making my own interface for grbl. My understanding is that it is basically a "terminal" with very specific features. Writing computer code is NOT really my forte, but I have been able to accomplish a few things. So I initially look to something I'm familiar with (rather than learn a whole new language).

 

When making my MACH3 screenset, I found that the GUI was similar to when I made my web pages using HTML. My understanding of HTML is rudimentary (I use Notepad to write/edit it), but it got me wondering....

 

Could HTML (and a browser) do the job?

 

If not, is anybody familiar with a similar simple language that will do the job?

 

Are there any suggestions for other simple ways to proceed?

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For my day job, I build desktop and mobile applications (simulating everything from electromechanical, hydraulic systems, and HMI display software) using primarily HTML5 (our team used to use Flash, but we've since moved on to HTML5). So perhaps I could be of assistance to help point you in the right direction. However, can you elaborate on some of the details? I'm not familiar with CNC machines or MACH3 interface but I can certainly tell you that building an application in HTML5 is certainly possible (quite a complex one too).

 

The difficulty comes when you need to hook that interface into other systems. In one application I created a C# application to house a real time 3D simulation which had an HTML5 interface on top to communicate with the low-level systems.

My digital portfolio: www.jamisonjerving.com

My game company: www.polygonbyte.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Any shell or scripting language would work. Personally I'd use PERL for platform independence, otherwise Windows PowerShell ISE which has both interactive and scripted windows and is easy to learn and debug.

 

Basic serial io is explained here

http://learn.sparkfun.com/tutori...

 

My CNC router is a pile of parts at the moment but i expect to use powershell to refine subblocks of commands that i can cut and paste together for machining of the final part.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jamison wrote:
can you elaborate on some of the details?

Here is an example of one of my MACH3 screens:

The black window (right) that shows the cutterpath is not needed for the Pick-and-Place machine. The display (upper left) will need to recieve info from the Arduino via USB and put numbers there. Buttons will be for loading files of G-Code and displaying in the window (lower right), and scrolling the file as each line is executed. Other buttons will send character strings to the Arduino via USB. And others will change to different pages....

 

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

Last Edited: Mon. Jun 20, 2016 - 06:07 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dak664 wrote:
Basic serial io is explained here

http://learn.sparkfun.com/tutori...

Thanks dak664! That looks very helpful!

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aeroHAWK wrote:

Jamison wrote:
can you elaborate on some of the details?

Here is an example of one of my MACH3 screens:

*image snipped*

The black window (right) that shows the cutterpath is not needed for the Pick-and-Place machine. The display (upper left) will need to recieve info from the Arduino via USB and put numbers there. Buttons will be for loading files of G-Code and displaying in the window (lower right), and scrolling the file as each line is executed. Other buttons will send character strings to the Arduino via USB.

 

I could see this as being an easy task for just pure C#. While I have yet to interface a micro with a serial port or USB, C# can hook right into a serial port to send/receive data. I've been wanting to build an interface for a micro to send/receive data to a custom desktop application for building real time simulations with physical controls (such as sensory feedback for augmented reality applications).

 

Anyway... back to the topic at hand. Do you have any experience with building GUIs in Visual Studio (C#, Basic, C++, WPF, etc)? You could actually visually put that GUI together with Visual Studio's Form Design. You can drag and drop controls (buttons, labels, images, etc.) onto a window and then you hook events into them such as button clicks. You would then just need an interface to communicate with your Arduino via serial or USB.

My digital portfolio: www.jamisonjerving.com

My game company: www.polygonbyte.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Personally I use C#, but for the OP I think I would recommend Visual Basic.

 

btw, I also have a Pick and place project on the go, but I have not got far. You may be interested to have a look at LitePlacer if only to get some ideas, it has a C# interface and I think uses a control board with grbl.

Bob. Engineer and trainee Rocket Scientist.

Last Edited: Mon. Jun 20, 2016 - 06:27 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jamison wrote:
Do you have any experience with building GUIs in Visual Studio

I have only used the generic form, defining the size of windows and buttons, etc. I have not used custom images.

 

I know I can easily create the graphics with HTML (it's time consuming, but relatively easy). You suggest that serial communication is fairly simple in C. If using Visual Studio for the graphics is similar in difficulty to HTML, then VS may be the way to go.

 

Unfortunately this is looking like a bigger task than I had hoped (not unexpected though).

 

I guess this explains why I am not satisfied with the existing solutions....

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

donotdespisethesnake wrote:
Personally I use C#, but for the OP I think I would recommend Visual Basic.

 

btw, I also have a Pick and place project on the go, but I have not got far. You may be interested to have a look at LitePlacer if only to get some ideas, it has a C# interface and I think uses a control board with grbl.

 

Thanks Bob. I have dabbled in VB, but it was about a decade ago.

 

Yes, I am familiar with LitePlacer. It uses the TinyG board with grbl. I studied it for ideas as you suggest. My design utilizes a twin spindle head with each spindle rotating +/- 90 degrees (NEMA14 stepper controlled by Z with grbl). Each spindle is raised/lowered with an R/C servo (actuated by grbl's coolant commands M7, M8, M9, and are either up or down). Two vacuum solenoids will be turned on/off using M3/M4 and S0/S1. I made simple mods to grbl to enable M7 and make S1 equal 100% PWM duty cycle. I'll make a simple PCB for an ATtiny to provide PWM for the R/C servos and buffer other signals.

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

aeroHAWK wrote:

Jamison wrote:
Do you have any experience with building GUIs in Visual Studio

I have only used the generic form, defining the size of windows and buttons, etc. I have not used custom images.

 

I know I can easily create the graphics with HTML (it's time consuming, but relatively easy). You suggest that serial communication is fairly simple in C. If using Visual Studio for the graphics is similar in difficulty to HTML, then VS may be the way to go.

 

Unfortunately this is looking like a bigger task than I had hoped (not unexpected though).

 

I guess this explains why I am not satisfied with the existing solutions....

Due to the need to communicate with a serial or USB, I doubt HTML5 would provide everything you need. Building the interface in HTML5 would be a lot simpler (personal opinion) than it would be in C# and you get a lot more control over style. But the difficulty comes because I don't think an HTML5 app could hook with the serial ports or USB, so even if you built the interface in HTML5, you would still need a layer of native application such as C# or as donotdespisethesnake recommended, Visual Basic. This would complicate the communication a little more but would actually simply the building and updating of your user interface (would also make it so much more portable if you wanted to it put on another device such as a tablet).

 

As I've said, I have not actually used serial or USB communication with a C# application myself, but I've looked at the documentation for accessing serial ports with C# (some example code on the MSDN: https://msdn.microsoft.com/en-us/library/system.io.ports.serialport.readline(v=vs.110).aspx). Once you've got the communication set up, it's similar to network programming. Data bytes are sent or received and you need to design your micro code and the C#/VB application code to agree on the different packets of data.

My digital portfolio: www.jamisonjerving.com

My game company: www.polygonbyte.com

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Jamison wrote:
Once you've got the communication set up, it's similar to network programming. Data bytes are sent or received and you need to design your micro code and the C#/VB application code to agree on the different packets of data.

Thanks Jamison. This gives me something to think about....

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Well I've been searching online for info about a GUI for grbl. I've discovered that it is a much more involved problem to solve than I originally understood. There is a guy that is very open about the GUI he is writing. There are a lot more to than just a "terminal" program. So it looks like I may be better off trying to get an existing GUI to work....

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You could implement a GUI in html/javascript with a node.js backend to talk to the serial port or USB. The front-end runs on the browser and does all the gui stuff and talks via websockets to the back end that interfaces to the grbl interface. There's also a zillion other ways of doing it but javascript/node.js has a degree ofplatform independence.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I guess everyone has their own favourite way to put GUI interfaces on things. I think my favourite might be Python+Tkinter (which comes as part of Python). Second choice might be QT5 (and that generally means C++).

 

EDIT: actually I say that but you can language bindings for QT with other languages:

 

https://en.wikipedia.org/wiki/Li...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Kartman wrote:
You could implement a GUI in html/javascript with a node.js backend to talk to the serial port or USB.

snip...

There's also a zillion other ways of doing it

clawson wrote:
my favourite might be Python+Tkinter

This is intriguing. If I were to create an HTML GUI, its "look" would be easily changed (without having to change its function), and it would be independent of the "backend". MACH3 Screens are like that. They are easily modified (with the appropriate app) without affecting the rest of the program (I don't know if that makes sense... I like the modular nature of it).

 

So as I get inspired, I could create a suitable GUI in HTML and then take on the task of talking to grbl via USB. And if I use Java as Kartman suggests, the whole thing would be platform independent.

 

Thanks!

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Just came across this list of GUIs:

 

http://www.shapeoko.com/wiki/ind...

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

dak664 wrote:
Just came across this list of GUIs:

Thanks dak664! Another great link....

Perfection is achieved, not when there is nothing more to add, but when there is nothing left to take away. Antoine de Saint-Exupery (1900 - 1944)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Note that Java is not Javascript! Two very different languages.