CNCing from Web Interface - Octoprint or CNCjs?

Noob question:

I already installed Octoprint, and it works fine as a 3D printer controller. But I wish I could also use this CNCjs thing for whenever I’m using the machine as a CNC.

Is it possible to use both? If yes, any idea how?

It is surely a pretty stupid question, but I’m a total moron when it comes to using linux.

 


I haven’t tried installing both at the same time, I don’t see why you wouldn’t be able to. You might just not be able to run the startup script for both. I’d image you would need to run one or the other due to the limitation of only one program being able to listen / communicate over the serial port. What you could do, is install the desktop gui and put desktop icons to launch either one if you have a monitor near by.

That sounds exactly like the answer I’m searching for!

I just have no Idea how to create a Desktop icon to launch a program on Linux… (I know, I’m dumb :frowning: )

Hi guys would I be able to use the pi cnc js and an Uno board with a grbl add on.

 

Gary

  1. Open terminal
  2. cd /home/pi/Desktop
  3. nano [insertanamehere]
  4. type up your commands, multiple lines are allowed (this is called bash scripting)
  5. save by hitting control-x then a few other things
  6. sudo chmod +x [thenameyouusedearlier]
  7. Go to desktop
  8. There should be a program you can double click on and that will launch

True, but both allow you to disable autoconnect. You could run them both all the time, and just connect from the one you’re wanting to use.

The other shared resource is port numbers, but I think you’re ok already.

There is a plugin for cnc.js for the webcam stream, if you already set that up in octoprint.

Yes.

Per jeffeb3’s comment, it sounds like you can just run both on boot. If for some reason that doesn’t work.

To make a desktop (works with Ubuntu desktop, is inagine it works with other Linux distributions). Create a file on the desktop with a .desktop extension and add the following code. Replace the script path on the ‘Exec=‘ line for the command you want to run. You can optionally add an icon if you’d like. Otherwise I’m pretty sure you can just remove it. My code formatting might be a little off since I’m writing this from my phone. That should run the code.

[Desktop Entry] Name=Start Exec=/home/jon/Development/my-project/start.sh Terminal=false Type=Application Icon=/home/jon/Development/my-project/icon.svg
if to want to run a browser you can do so by installing chromium and adding a few more bits to this script ( might get in trouble for a self plug ) but I wrote a blog post on it for pretty much exactly this here. Again that was for a Ubuntu but should, in theory, work the same on other distributions of Linux

I’ve tried for the last two hours to get CNCjs to run on RPI3 -

I followed the instructions - I am not new to the PIs so it’s frustrating -

It appears everything has installed but when I go to the IP that my router registers for the Pi it says the site cannot be reached.

I first started out on these instructions: https://cnc.js.org/docs/rpi-setup-guide/

Then I cleared the SD and tired these: http://danielwdunn.com/mpcnc-with-cncjs-wireless-web-interface/

Still not working…not sure where to begin troubleshooting.

Start with something simple, such as: are you even able to get a putty connection to that raspberry pi from your PC? The IP address should be something of the form: 192.168.x.z

Yes, I can get IP address and the RPI is connected to the internet. I have the IP and can connect and run all of the commands through SSH.

 

Should somewhere along the installation path the command line of pi@ be changed to root@ ? if so when and how?

 

 

First error on my third attempt to install:

root@cnc:~ # sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000
iptables v1.6.0: can’t initialize iptables table `nat’: Table does not exist (do you need to insmod?)
Perhaps iptables or your kernel needs to be upgraded.

That’s not bad. About for to go :wink:

Ok. So first, is it actually running? Ssh to it and run;

ps aux | grep cnc

That should print any commands running that include cnc in the name. If it’s running you should see it, and the grep command printed.

If it’s not running, try starting it manually, and see what it’s complaining about.

If it is running, did you try putting the raw ip and port 8000 in your browser?

http://192.168.x.x:8000

(((Obviously not x.x)))

BTW, I see that octpi uses this to create their images:

I’ve been thinking it might be cool to make a cnc image with cnc.js, octoprint, and the wifi setup page thing. I can’t remember what the wifi setup page thing is, but it would be good for us to have it start with an ad hoc wifi connection and a landing page to get to octoprint and cnc.js, because some people don’t have access to wifi where their machine is. Anyone want to work on this with me? Any other requests?

1 Like

Sorry, I just read this. No. Sudo is in the instructions when necessary.

You shouldn’t be logged in as root and doing sudo.

The iptables call is optional. That just let’s you do:
http://192.168.x.x
Instead of
http://192.168.x.x:8000

1 Like

Jeff - thanks - I do think if CNCjs is a good tool to use for MPCNC or LowRider then the instruction should be straight forward. An image would be most ideal in my opinion. Not sure how many people would use it but I’d be all for it because 3 to 7 attempts to install is just crazy.

So I errored out on these commands:

Allow access to port 8000 from port 80

Copy and paste (right-click) the following commands into the terminal (via Putty):

# Iptables (allow access to port 8000 from port 80)
sudo iptables -t nat -I PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8000

# Make Iptables Persistent
sudo apt-get install iptables-persistent -y

However, if I run the ip : 8000 now it pulls up CNCjs

I can use the 8000 port access but why have instructions to redirect to the router assigned IP if its not going to work ?

Yeah, something simple is going wrong. Don’t get discouraged. The image I bwasbtalking about probably wont be done for a while, so I would still try to fix whatever simple thing that’s stopping you.

The only reason I went down the rabbit hole on this CNCjs RPI verison was to try and use the wireless keyboard pendant to jog the machine.

However, I cannot even get that installed now that I can get to the CNCjs on the RPI using the port IP

C’Mon, Kris. You know it’s a complicated system, and things don’t always work the same way. Daniel did a lot of work getting those instructions going. How about being a little grateful? You’ve been getting a lot of help in these forums.