Welcome! Log In Create A New Profile

Advanced

Simple *nix CLI For Streaming G-Code to ATMegas

Posted by unicornswag 
Simple *nix CLI For Streaming G-Code to ATMegas
February 28, 2014 11:24PM
Just a couple of shell scripts I made, hopefully they will be of use to someone smiling smiley

After buiding my ATMega2560 based RepStrap/PCB mill, I was somewhat disappointed with the Linux CLI options available to control my machine. So, I started with the simple_stream python script from github as a base and added a couple shell scripts as a wrapper to easily stream gcode and (sort of) jog the machine's axes from a simple command line inerface. Just basic Bash shell scripts that should run in any unix environment with py-serial installed. It should also work with any firmware, including Marlin, GRBL, Teacup etc.

stream.sh simply lets you enter the path to a gcode file and send it to your device at /dev/ttyACM0 (or whatever you want to change that to in simple_stream.py)

jog.sh lets you enter a value (in millimeters, + or - ) for your x,y and x axes to move relative to the current position. Note that by default, jogging using this script will zero all axes.

This setup happens to fit my needs perfectly, but feel free to modify it to your liking.
Attachments:
open | download - stream.zip (2.3 KB)
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 01, 2014 04:23AM
Cool smiling smiley

I will maybe test it this week-end.

A ncurses derivative can be very cool to!

Thanks.
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 01, 2014 08:36AM
Quote
zelogik
Cool smiling smiley

I will maybe test it this week-end.

A ncurses derivative can be very cool to!

Thanks.

You read my mind! An ncurses or ncurses-like interface is next on my list. Maybe something similar to the good old TurboCNC interface that ran in DOS.
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 01, 2014 10:36AM
A ncurses based interface would be great. I would love to be able to run it in a screen and ssh in to check on my print status. I'm thinking a RPi with webcam would be great. I'm also thinking of adding a servo driven arm that can knock items off the bed after it has cooled off, so I can remotely start the next print.
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 01, 2014 04:34PM
Ncurses definitely has an appeal to me for this project, however, I need some suggestions as to what features would be useful in such an interface. I'm also wondering whether there is any real advantage the adding ncurses rather than just keeping with the style of my original program, but adding features and making it more interactive. Keep in mind that I would like this program to be equally useful for 3D printing as well as straight CNC milling.

Let's lokk at some basic components of most CAM programs out there:

1. G-Code visualizer; Obviously this won't be possible within in a CLI.

2. Jogging Controls; Already somewhat implemented in my current jog script.

3. Manual G-Code Input; Haven't added this to my scripts yet, but it would be a fairly simple task.

4. Display of G-Code Being Streamed; Already done in my streaming script.

5. File Browser: Paths to g-code files currently have to be entered manually. A Midnight Commander-style file browser for loading G-Code files is the biggest advantage I see to adding a more graphical interface.

So my question is, would any of these features be made any more accessible or useful from an ncurses environment? Are there any other useful features that could be added?

Keeping with the current interface, I would probably make a shell script for each feature listed above. The user would be able to switch between features through key combinations, such as "ALT-S" to switch to the streaming script, "ALT-J" to run the jogging script, etc.

I may also consider using the tput program to produce the interface as it is somewhat more universal than ncurses and comes preinstalled in just about every Unix environment including OSX and even most lightweight linux distros.

Edited 1 time(s). Last edit at 03/01/2014 04:39PM by unicornswag.
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 02, 2014 10:44AM
Oh, I almost forgot, the baud rate in the python script is currently set to 9600. That's the standard for grbl firmware, but yours is likely to use something else. Modify the script accordingly.
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 03, 2014 06:52AM
Quote
unicornswag
5. File Browser: Paths to g-code files currently have to be entered manually. A Midnight Commander-style file browser for loading G-Code files is the biggest advantage I see to adding a more graphical interface.

That can be simply handled by using midnight commander for navigation and adding appropriate record into mc.ext.
Re: Simple *nix CLI For Streaming G-Code to ATMegas
March 03, 2014 02:48PM
Thanks miso. I'm just not sure that I want the script to depend on Midnight Commander. i would like it to be as portable, lightweight and universal as possible.

I'm currently working on rewriting the Python streaming script into a Bash script, eliminating the need for Python and py-serial on the host machine. My goal is to have a program that can be run on any unix system, especially on ancient hardware. I'm currently using an old PowerPC iMac G3, but I also have a few i386's from the mid-90's that are just capable of booting Linux from a floppy disk. It would be great to have a machine like that control a RepRap or CNC.
Sorry, only registered users may post in this forum.

Click here to login