CNCing from Web Interface - Octoprint or CNCjs?

So yesterday I decided to finally give cncjs a try. I have a pine64 board that’s been gathering dust…I had originally bought it hoping I could use it in my living room as a media center and for skype/hangouts, mostly skype/hangouts. But skype doesn’t have a version that supports avr and hangouts took me two years to get working only to have lousy performance. Oh well, let’s find something else to do with this thing.

I’ve thought about trying cncjs with it for awhile - but last time I had checked they didn’t support marlin yet…and grbl on mega boards was wonky last time I tried that…I don’t really want to get an uno and shield just to try this. But I see cncjs now has marlin support - so time to try it!

Installing cncjs was pretty quick and straight forward. Just installed nvm, npm and node v6 since I saw something in the cncjs git readme suggesting that node v6 was their preferred option (though other parts of the docs seemed to indicate other versions…readme looked newer though so v6 it is. This probably went smoother for me than it would have a few months ago because I’ve recently been doing a lot of work with node/npm for work - bonus!

ran ‘cnc’, fired up my browser…hey it works! But the board is on ethernet and I’m out of ports in my office…so dig up a usb wifi adapter, configure it…move it all out to my office and plug in my MPCNC’s 3 year old version of Marlin…it works! Or at least seems to.

Loaded up some gcode, lifted my spindle up a few inches and ran the code in the air…all looked good. Doesn’t track as accurately as I’d like but I know that’s a limitation of Marlin and it’s queue. Alright, let’s try a REAL cut.

Mount up some material, zero things out…hit go and…looks like it should be working but machine isn’t moving. Hmm. Spend 30 minutes trying various things…machine still won’t move. What the heck it was working just a minute ago?

Ok, let’s shut down the spindle and my vac and try another air cut. Still won’t go. Hmmm…wait…it’s kind of quiet in here. Oh…probably helps if I plug in the power supply for the MPCNC :stuck_out_tongue:

With the router and vac going I didn’t notice I couldn’t hear the power supply for the CNC itself. And with the marlin board plugged in over USB the LCD was lit up making me think it was powered up since I don’t normally have it plugged in over USB…Doh.

Ok…everything has power, zero it out. And…go. Nice! It worked. I could get used to this workflow.

Few annoying things I’m not 100% happy with:

  • Progress in the browser doesn't track well. But I know this is a limitation of Marlin and how it queues commands. Without switching to grbl don't think I can get away from this.
  • I can't seem to direct input values in the MDI, only use the step buttons. Marlin limitation or am I just not understanding the interface? Seems like it lets me input values but then they just disappear. And I know I can send gcode to marlin to position things so not sure why this isn't working.
  • Seems that work coordinates aren't supported with Marlin? Or at least I can't figure out how to use them. This was one of the big reasons I wanted to get this going...maybe a newer version of Marlin will help? I'm still on 1.1.0-RC6 built on April 24th two years ago...I know I need to update but the machine works and I haven't had a good way to connect my Mega to a computer without disconnecting it from the machine so been lazy. Now that it's attached to a computer I should probably upgrade. I know Marlin recently made some changes to allow multiple coordinate systems...but don't think it's made it into a release yet so don't know if cncjs can take advantage of it. I could just try grbl again as well I suppose.....
Overall I'm fairly happy with it and will probably keep diving down this rabbit hole. Wish I could afford a touch screen right now since my computer is a few feet away and facing the wrong direction...but it's a start.

 

1 Like

oye…I have done that a few times.

Now that marlin is starting to get supported I think this will mature pretty quickly. I tried it last week. I will stick to my PID project while you guys mess with this side of things. I am very new to the Pi world and all the Linux stuff, so I will just follow along and dip my toe in the pool once and a while.

BTW Ryan - I should have a new “Made with MPCNC” post later this week. That big passion project I started 13 years ago and the MPCNC is finally making it possible for me to finish…it’s getting very close to being “finished” :wink:

[attachment file=57952]

[attachment file=57954]

[attachment file=57953]

I’ve actually started the post about 3 times…but it’s going to be a big one and I really want to get this a bit further along this weekend so can’t stay focused on the post :smiley:

Having the MPCNC has really made finishing this way more affordable and allowed me to customize it my own way - once again I’m SUPER happy I built this machine and have to thank you for sharing the design with all of us!

 

 

2 Likes

Is that some sort of 808? So excited to see what it is!

 

Glad to have you as a part of the crew as you are to have the MPCNC I am sure.

1 Like

I’ve been messing with making a cnc.js image. I’ll have it published soon. Just a few kinks getting worked out.

Cnc.js and Marlin has some timing issues with my Marlin. I have an open issue for it. Basically, the first command gets hung and nothing works until i send something from the terminal.

The machine offsets aren’t sending the right commands for Marlin. It should be customizable, so I just have to fix those. I think it’s great.

The other part I like is just setting the tool position next to the design. It’s especially nice when you use screws to hold down the work because you can tell where it’s safe.

Ryan, you’re close. Though it’s a bit more flexible than an 808. In fact there have been 808 clones build using the same basic hardware. And thanks for the thanks - sorry I kind of disappeared for a few months, been lurking but work has been crazy and my spare time has been dumped into this sequencer so haven’t had much time to just play CNC for the sake of playing CNC :smiley:

Jeffeb - I haven’t had any issues with timing…though I have noticed I can’t jog the machine until after I run some gcode. And sometimes when I try to set zero it tries to home the machine. But again I’m on an ancient build of Marlin so things could be goofy on that side.

I’ve really only spent an hour or two with cncjs and haven’t dug into it’s internals or config at all yet. Still debating if I want to stick with marlin or give GRBL another try. Since I don’t plan on doing any printing with the MPCNC I’m leaning more towards trying GRBL again - but haven’t looked yet at if it’s any better on Mega/Ramps than last time I tried it or if I’d be better off digging out a nano or uno and just breadboarding up my stepper drivers…

Overall I’m pretty impressed with cncjs. And I’d love to get work coordinates working so I don’t have to try and offset things when doing the CAM. Adding some end stops and being able to do more reliable tool changes would be great too. Should keep me busy most of this summer :smiley:

Well, since cnc shields are so cheap I figured why not. I can keep my marlin based ramps untouched so I can always go back to it if I don’t like how grbl/cncjs goes for me. $20 on amazon so I can get it prime shipped two days…could have saved $5 ordering from China - but I don’t feel like waiting a few weeks for delivery :smiley:

I really enjoy the marlin workflow - but it does feel limiting in quite a few ways too. Curious to see if I like a more traditional CNC workflow…

Regarding the op, I believe you can remotely connect to your Pi’s desktop using VNC from a browser. i.e. no special CNC software required.

You can, but you have to have vnc server running on the pi, and a desktop, and then run bcnc, pronterface, or repetier host.

My memory fails me in the particulars but VNC isn’t necessary if you use “ssh -X pi@x.x.x.x” to log into the Pi. This will allow you to invoke your graphical application (pronterface, bcnc, etc) from the command line and display its output back in a window on your laptop.

[attachment file=58502]

My memory fails me in the particulars but VNC isn’t necessary if you use “ssh -X pi@x.x.x.x” to log into the Pi. This will allow you to invoke your graphical application (pronterface, bcnc, etc) from the command line and display its output back in a window on your laptop.

[attachment file=58505]

My memory fails me in the particulars but VNC isn’t necessary if you use “ssh -X pi@x.x.x.x” to log into the Pi. This will allow you to invoke your graphical application (pronterface, bcnc, etc) from the command line and display its output back in a window on your laptop.

[attachment file=58508]

Whoa… sorry bout the multiple posts =8^(

Sounds promising, but I don’t quite follow. How do I do that exactly?

It’s a feature of X the GUI used on Unix systems.

Basically X is a client/server architecture - usually you run both the client (your apps) and the server (i.e. you window manager) on the same computer - but because it’s a networked system you can run them on separate machines.

So since the Pi runs unix you can run an xwindows app (like bcnc or in David’s case Pronterface) which is running on the Pi so it has direct access to the USB ports for machine control - but you send the GUI over the network to an X server on your desktop computer.

In David’s example he’s using Linux on his desktop so it’s super easy. He uses ssh to connect to his Pi and adds the -X flag which tell ssh to open the ports required for X and to setup the environment variables required to tell x clients (the apps) to connect to his desktop not an X server running on the Pi itself. There’s also a -Y flag which is like X only with weaker security - I found I had to use Y to do this on my setup though I’m not sure if it’s due to how ssh is configured on my Pine64 or if it’s due to the USB access and the permissions bCNC needed. Since I wasn’t able to get even xeyes (a really simple x demo program) running without -Y I’m assuming it’s in my ssh config. (More details about -X vs. -Y here: https://askubuntu.com/questions/35512/what-is-the-difference-between-ssh-y-trusted-x11-forwarding-and-ssh-x-u)

I’m on a mac so I don’t have a native x-server running on my desktop. But Mac is unix under the hood so it’s not hard to add one. In fact to run inkscape on a mac you have to install a x-server because that’s how the developers ported inkscape to mac. so I have the “Xquartz” server running that lets me display X apps on remote computers on my desktop.

There are other options for windows based computers…though to be honest I’ve not been as impressed with the free X servers I’ve tried on windows. But I haven’t messed with it there in a few years so not sure just what’s available. There’s an expensive commercial x server for windows that works great - I had a license for it from a company I worked for back in the 90’s. I was able to run apps on our SGI Irix on my windows desktop better than if they were running natively on Irix local because the video card in our Irix was such utter rubbish.

Here’s a good page with details on how to do it on Mac and Windows and Linux:

https://uisapp2.iu.edu/confluence-prd/pages/viewpage.action?pageId=280461906

 

1 Like

I’ve had good luck with MobiXTerm in windows, although I think that company gets flack from the FOSS religious because they tend to rebrand open source tools as their own (although they follow the letter of the licenses, including providing source code to modifications). They do make the tools easier to install. It’s also possible this new ubuntu/microsoft love child makes this a lot easier too, I haven’t used windows in a few years.

Jason, what connection settings (device, baud rate, flow control) did you use to connect your control board to the Pi? I have a mini-rambo and I can’t seem to get cncjs to connect to the control board.

Silly me; I’m running cncjs inside a docker container and I forgot to mount /dev in the container. It’s working now :slight_smile:

The Dockerfile I’m using:

FROM resin/raspberrypi3-node:latest
RUN npm install -g cncjs@latest --unsafe-perm
CMD ["/usr/local/bin/cncjs"]

Haven’t played with cncjs much though yet.

I see that people use both Octoprint and cncjs. At the top of this thread there didn’t seem to be much difference between the two: they are, after all, just a front end to manage the GCode based controllers. Both can now use Marlin firmware based controllers too (at some point cncjs was updated).

I am a longtime IT professional so building, configuring and using various systems isn’t a problem for me. I have tinkered with all kinds of hardware devices (Arduino, C, Forth, Python, FPGAs, UNIX, Linux, BSD Unix, Windows, etc) both professionally and as a hobby.

Please do share why a person would use cncjs over octoprint (I will be using octoprint on my 3D printers)?

I intend to try out both.

Edit: Just installed cncjs on a existing Pi which is pretty straightforward. Got lots of security and deprecation warnings which suggests that maintainance of the project is a little behind. Doesn’t recognise nodejs 10.

cncjs is a little more directed at cnc features. If your firmware supports workspace coordinates, for example, you have the buttons for that there, and the gcode preview is miles better.

Octoprint has the advantage of a bazillion users and they do a great job of finding bugs in the release candidates. The gcode preview and timelapses are pretty useless for CNC, but if you just want a web control and a pi gcode sender, they both work about the same.

The v1pi image has both installed, mostly because I am trying not to pick up a huge project, so it is a light touch. But also because it is based on octopi, which has a lot of the issues worked out, and comes with octoprint installed. The one advantage over octopi if you’re using octoprint is that my image comes with a version that supports a hot spot, if your barn/garage doesn’t get good enough reception with your house wifi.

I’m happy to see someone with your skillset being interested though. I have just a little time to mess with it myself, and the images take so long to build that it is really tough to get me to work on it.

2 Likes