开源改变世界

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

推推 grbl 3年前 (2023-02-03) 251次浏览
关闭
12 个任务中的第 4 个
leoheck 打开了这个问题 2019 年 8 月 19 日 · 18条评论
关闭
12 个任务中的第 4 个

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs#510

leoheck 打开了这个问题 2019 年 8 月 19 日 · 18条评论

注释

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
大佬 评论了 2019 年 8 月 19 日  

大家好。

我在将 CNCjs 与我的 GRLB 打印机连接时遇到问题。
它安装在 Raspberry PI 上。
任何帮助都会很棒,因为我真的很想使用 CNCjs。

CNCjs 可以连接,但我无法控制 CNC,箭头显示为灰色。
CNCjs 控制台上的命令不返回任何内容。

然而,自从命令行通过串行控制台控制以来,CNC 正在工作。

有人告诉我用 sudo 安装 node serialport 可能会导致问题。但是,我无法在没有 sudo 的情况下安装 CNCjs。

我最近得到了这个3018 CNC 。

我看到我的 CNC 使用的是 GRBL 0.9j,所以我更新为使用 1.1j,但没有太大帮助。
另外,在我的电脑上连接打印机,我可以用 bCNC 软件控制打印机。

这是我第一次使用 CNC。另外,我以前从未安装过节点应用程序。

版本

  • CNJS:1.9.20
  • 节点.js:10.16.3
  • 国家公共管理机构:6.9.0

你如何安装CNCjs?

  • NPM
  • 下载 CNCjs 桌面应用程序

数控系统

  • Grbl
  • 冰沙
  • TinyG/g2核心

硬件

  • 树莓派
  • 台式机或笔记本电脑
  • 移动设备

操作系统

  • 不适用
  • 视窗
  • 苹果
  • Linux
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510 leoheck 更改了标题 CNCjs 与 在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs 2019 年 8 月 19 日
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

一种可能是您选择了错误的串行端口,而不是连接到 GRBL 控制器的串行端口。如果没有看到您正在做的事情的屏幕截图,我无法进一步猜测。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

另一种可能是串口的属主不正确,导致cncjs没有访问串口的权限。尝试这个:

whoami
ls -l /dev/ttyS0
groups

如果第二条命令显示“.. No such file or directory”,请将 /dev/ttyS0 替换为您的串口名称。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者
大佬 评论了 2019 年 8 月 20 日  

你好@MitchBradley

我正在选择正确的串行端口(现在是/dev/ttyUSB0

这是dmesg连接 CNC 的 USB 电缆后的最后几行。

[72304.084479] usb 1-1.3: new full-speed USB device number 6 using dwc_otg
[72304.217567] usb 1-1.3: New USB device found, idVendor=1a86, idProduct=7523, bcdDevice= 2.63
[72304.217581] usb 1-1.3: New USB device strings: Mfr=0, Product=2, SerialNumber=0
[72304.217591] usb 1-1.3: Product: USB2.0-Serial
[72304.221158] ch341 1-1.3:1.0: ch341-uart converter detected
[72304.223951] usb 1-1.3: ch341-uart converter now attached to ttyUSB0

在 CNCjs 上
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

串口的权限如下,我的( pi) 用户好像也在dialout组里。
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

我正在与我的用户手动启动cnc命令。pi

我也可以chmod 777作为测试,但没有任何反应。

如果您认为 CNCjs 软件不错,我几乎可以肯定这是节点安装的问题,因为这是我第一次尝试安装它。我不知道如何调试它。

这是您请求的输出。
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

当我打字时,我得到了 CNC 的答复。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

也许有什么东西延迟了输出

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

在浏览到 cncjs 服务器并打开串行端口后,尝试向命令添加详细标志并向我显示控制台日志。这对我来说是这样的:

pi@raspberrypi-tinyg:~/cncjs-test $ bin/cncjs -vv
2019-08-19T22:57:56.797Z - info init Loading configuration from "/home/pi/.cncrc"
2019-08-19T22:57:56.875Z - info init Watching "/home/pi/GCode" for file changes
2019-08-19T22:57:59.482Z - debug app app.settings: {"x-powered-by":false,"etag":"weak","env":"production","query parser":"extended","subdomain offset":2,"trust proxy":true,"views":["/home/pi/cncjs-test/dist/cncjs/app","/home/pi/cncjs-test/dist/cncjs/server/views"],"jsonp callback name":"callback","view cache":true,"verbose errors":false,"case sensitive routing":true,"strict routing":false,"view engine":"html"}
2019-08-19T22:58:00.610Z - debug app assets: name=app, asset={"routes":["/e9e533b0/","/"],"path":"/home/pi/cncjs-test/dist/cncjs/app","maxAge":31536000000}
2019-08-19T22:58:00.619Z - debug app > route=app /e9e533b0/
2019-08-19T22:58:00.636Z - debug app > route=app /
2019-08-19T22:58:00.989Z - debug service:cncengine Loaded controllers: Grbl,Marlin,Smoothie,TinyG
2019-08-19T22:58:01.420Z - info init Starting the server at http://127.0.1.1:8000
2019-08-19T22:58:02.035Z - debug service:cncengine New connection from 192.168.2.3: id=kr_dl57dfaNRHoboAAAA, user.id=, user.name=
2019-08-19T22:58:26.751Z - debug app [session-file-store] will retry, error on last attempt: Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-sessions/YxKI5InRopJmuWLjsM08JeRRTVcJ0yvM.json'
2019-08-19T22:58:26.803Z - debug app [session-file-store] will retry, error on last attempt: Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-sessions/YxKI5InRopJmuWLjsM08JeRRTVcJ0yvM.json'
2019-08-19T22:58:26.855Z - debug app [session-file-store] will retry, error on last attempt: Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-sessions/YxKI5InRopJmuWLjsM08JeRRTVcJ0yvM.json'
2019-08-19T22:58:26.907Z - debug app [session-file-store] will retry, error on last attempt: Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-sessions/YxKI5InRopJmuWLjsM08JeRRTVcJ0yvM.json'
2019-08-19T22:58:26.958Z - debug app [session-file-store] will retry, error on last attempt: Error: ENOENT: no such file or directory, open '/home/pi/.cncjs-sessions/YxKI5InRopJmuWLjsM08JeRRTVcJ0yvM.json'
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET / 304 388.119 ms
2019-08-19T22:58:27.655Z - debug service:cncengine Disconnected from 192.168.2.3: id=kr_dl57dfaNRHoboAAAA, user.id=, user.name=
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG POST /api/signin 200 246.304 ms
2019-08-19T22:58:29.072Z - debug service:cncengine New connection from 192.168.2.3: id=wKAZGgxWkq5hheyFAAAB, user.id=, user.name=
2019-08-19T22:58:29.315Z - debug service:cncengine socket.list(): id=wKAZGgxWkq5hheyFAAAB
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET /e9e533b0/favicon.ico 200 233.082 ms
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET /api/commands?_=1566255509950&paging=false 200 2191.757 ms
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET /api/state?_=1566255509949 200 2180.124 ms
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET /api/machines?_=1566255510267 200 2161.921 ms
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET /api/macros?_=1566255510269 200 1986.526 ms
V0y2UOi_GvOpVbANpHi0ctW2iKADV3MG GET /api/mdi?_=1566255510268 200 1969.761 ms
2019-08-19T22:58:45.704Z - debug service:cncengine socket.open("/dev/ttyACM0", {"controllerType":"TinyG","baudrate":115200,"rtscts":false}): id=wKAZGgxWkq5hheyFAAAB
2019-08-19T22:58:45.829Z - debug controller:TinyG Add socket connection: id=wKAZGgxWkq5hheyFAAAB
2019-08-19T22:58:45.943Z - debug controller:TinyG Connected to serial port "/dev/ttyACM0"

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

我也在做,贴在这里。

我的软件版本。
CNCjs:1.9.20
Node.js:10.16.3
NPM:6.9.0

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

我开始怀疑串口模块对行结尾感到困惑——或者它可能是一个 xon/xoff 问题。我依稀记得有人遇到过这样的问题。我将尝试找到描述它的问题。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

当前设置

➜  ~ stty -F /dev/ttyUSB0
speed 115200 baud; line = 0;
min = 1; time = 0;
-brkint -icrnl -imaxbel
-opost -onlcr
-isig -icanon -iexten -echo -echoe -echok -echoctl -echoke

这是详细的输出

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

➜  ~ cnc -vv          
2019-08-19T23:04:16.671Z - info init Loading configuration from "/home/pi/.cncrc"
2019-08-19T23:04:16.687Z - info init Watching "/home/pi/cnc" for file changes
2019-08-19T23:04:17.013Z - debug app app.settings: {"x-powered-by":false,"etag":"weak","env":"production","query parser":"extended","subdomain offset":2,"trust proxy":true,"views":["/usr/local/lib/node_modules/cncjs/dist/cnc/web","/usr/local/lib/node_modules/cncjs/dist/cnc/app/views"],"jsonp callback name":"callback","view cache":true,"verbose errors":false,"case sensitive routing":true,"strict routing":false,"view engine":"html"}
2019-08-19T23:04:17.225Z - debug app assets: name=web, asset={"routes":["/bfc45480/","/"],"path":"/usr/local/lib/node_modules/cncjs/dist/cnc/web","maxAge":31536000000}
2019-08-19T23:04:17.227Z - debug app > route=web /bfc45480/
2019-08-19T23:04:17.230Z - debug app > route=web /
2019-08-19T23:04:17.278Z - debug service:cncengine Loaded controllers: Grbl,Marlin,Smoothie,TinyG
2019-08-19T23:04:17.359Z - info init Starting the server at http://127.0.1.1:8000
2019-08-19T23:04:20.414Z - debug service:cncengine New connection from 192.168.86.107: id=tDXby63Pg1oAfQr2AAAA, user.id=7e9d0aff-ef66-4907-8e42-c1c6cb034674, user.name=lheck
2019-08-19T23:04:30.612Z - debug service:cncengine socket.open("/dev/ttyUSB0", {"controllerType":"Grbl","baudrate":115200,"rtscts":false}): id=tDXby63Pg1oAfQr2AAAA
2019-08-19T23:04:30.636Z - debug controller:Grbl Add socket connection: id=tDXby63Pg1oAfQr2AAAA
2019-08-19T23:04:30.676Z - debug controller:Grbl Connected to serial port "/dev/ttyUSB0"
2019-08-19T23:04:35.875Z - debug service:cncengine socket.command("/dev/ttyUSB0", "homing"): id=tDXby63Pg1oAfQr2AAAA
2019-08-19T23:04:45.579Z - debug service:cncengine socket.command("/dev/ttyUSB0", "reset"): id=tDXby63Pg1oAfQr2AAAA
2019-08-19T23:04:51.925Z - debug service:cncengine socket.command("/dev/ttyUSB0", "homing"): id=tDXby63Pg1oAfQr2AAAA
2019-08-19T23:05:00.035Z - debug service:cncengine socket.write("/dev/ttyUSB0", "?", null): id=tDXby63Pg1oAfQr2AAAA
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

这是旧问题报告: #257(评论)

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

从命令行运行它我看到了一些错误。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

我收到这条[MSG:Check Door]消息。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

我启动了 CNCjs,连接到/dev/tyUSB0我运行的终端

stty -F /dev/ttyUSB0 115200 cs8 -cstopb -parenb

现在当我这样做时
echo '$$' > /dev/ttyUSB0

我在 CNCjs 上看到了这个回复
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

我相信 CNCjs 现在在串行端口上做错了。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

在我看来,好像您的串行连接正在左右丢弃字符。您是否有最喜欢的终端仿真器程序,例如 minicom、screen 或 picocom?我使用 echo 和 cat 来诊断串行问题从来没有取得过多少成功。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

当然,我正在用这个命令对屏幕做同样的事情
screen /dev/ttyUSB0 115200,cs8,-parenb,-cstopb,echo

我的问题是我不知道如何正确使用它。它不会在屏幕上回显 GRBL 命令,所以我不知道它是否正常工作。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
贡献者
米奇布拉德利 评论了 2019 年 8 月 20 日  

使用 picocom 或 cu 更容易获得本地回声。两者都很小,所以安装起来很快。

sudo apt-get install picocom
picocom --ec --imap lfcrlf /dev/ttyUSB0

退出命令是^A^Q

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

是的,我这样做是对的。谢谢米奇。

安装 picocom 后我发现了命令的问题

➜  ~ sudo lsof /dev/ttyUSB0
COMMAND    PID           USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
Repetier-  582 repetierserver   13u   CHR  188,0      0t0 1116647 /dev/ttyUSB0
picocom   5013             pi    3u   CHR  188,0      0t0 1116647 /dev/ttyUSB0

这个旧repetierserver过程也与此有关/dev/ttyUSB0。=\

停止此服务后,它开始正常工作。
在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

非常感谢您的帮助和花时间调试它。我真的很感激。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510

嗯——我想到的另一件事是可能有一些其他进程正在侦听串行端口并吃掉一些字符。啊哈 – 是的,这是更重复的服务。

在 Raspberry Pi 上使用 GRBL CNC 的 CNCjs #510
作者

简而言之,检查消耗您资源的其他进程总是好的。