cncjs 1.8 adds multi-account management support to enable secure web access and web socket connections. The web interface will automatically redirect user to the Sign In page when at least one user account has been enabled in Settings > Account.
If you forgot your password, find user account settings in the ~/.cncrc
file, and remove all existing users:
~/.cncrc
(e.g. /home/pi/.cncrc
)%USERPROFILE%\.cncrc
(e.g. C:\Users\User Name\.cncrc
)"users": []
Otherwise, you can also set the “enabled” attribute to a false value for all users to disable secure web access. For example:
"users": [
{
"id": "......",
"enabled": false,
"name": "admin1",
"password": "......"
},
{
"id": "......",
"enabled": false,
"name": "admin2",
"password": "......"
}
]
Navigate to http://webglreport.com/ to make sure your browser support WebGL.
If your browser does not support WebGL due to certain reasons, follow instructions below to enable WebGL: http://superuser.com/questions/836832/how-can-i-enable-webgl-in-my-browser
First, enable hardware acceleration:
Then enable WebGL:
You may got this error when using the GPIO serial device on the Raspberry Pi:
$ .npm/bin/cnc -vv
Started the server at http://0.0.0.0:8000/.
2016-07-17T12:13:40.292Z - error: [cncserver] Error opening serial port "ttyAMA0": err={}
Add a .cncrc
file under the login (home) directory (e.g. ~/.cncrc
) with the following configuration to specify the path /dev/ttyAMA0
:
{
"ports": [
{
"comName": "/dev/ttyAMA0",
"manufacturer": ""
}
]
}
Run cnc
again and you will see that /dev/ttyAMA0
is available to use:
If you still cannot connect to /dev/ttyAMA0
, use the serialport-terminal tool to check if a “Permission denied” error occurred:
$ node_modules/serialport/bin/serialport-terminal.js -p /dev/ttyAMA0 -b 115200
Error [Error: Error: Permission denied, cannot open /dev/ttyAMA0]
Follow these steps to fix the permission denied error:
dialout
group:$ sudo vim /etc/group
add add your login account if not available:
dialout:x:20:pi,<your_login_account>
/dev/ttyAMA0
from /boot/cmdline.txt
:The original contents
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait
and new contents
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait
/etc/inittab
by commenting out the following line:#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Checkout mjpg-streamer to learn how to stream JPEG data from the input_raspicam plugin via HTTP, and follow the steps in this article:
libv4l-0
package, available in Raspbian: sudo aptitude install libv4l-0
./dev/video0
file is available on Raspberry Pi, else the camera does not have a Linux driver or required extra configuration to work.mjpg-streamer
folder, where you extracted the tar.gz
file.mjpg-streamer.sh
file; this is a simple bash script to control the mini-webserver. The header contains some writable parameters, as refresh rate or resolution. The default settings should work in most situations../mjpg-streamer.sh
start command in the current folder.mjpg-streamer.log
file for debug info.See below required commands for not-Linux geeks:
$ sudo aptitude install libv4l-0
$ ls /dev/video0
$ wget http://www.bobtech.ro/get?download=36:mjpg-streamer-rpi
$ mv get\?download\=36\:mjpg-streamer-rpi mjpg-streamer-rpi.tar.gz
$ tar -zxvf mjpg-streamer-rpi.tar.gz
$ cd mjpg-streamer
$ sudo nano mjpg-streamer.sh
$ ./mjpg-streamer.sh start
Once you have finished setup, input the URL in the webcam widget to play the M-JPEG stream:
# Replace raspberrypi with your IP address
http://raspberrypi:8080/?action=stream
To change video parameters you have to install v4l2-ctl:
$ sudo apt-get install v4l-utils
$ v4l2-ctl --list-ctrls
$ v4l2-ctl --set-ctrl brightness=200
$ v4l2-ctl --set-ctrl saturation=32
http://www.howtoembed.com/get?download=36:mjpg-streamer-rpi
FFmpeg is available for Windows and Linux, but FFserver is available only on Linux.
Sample ffserver.conf
file:
HTTPPort 8090
<Feed webcam.ffm>
File /tmp/webcam.ffm
FileMaxSize 50M
</Feed>
<Stream webcam.mjpg>
Feed webcam.ffm
Format mpjpeg
VideoBufferSize 8000
VideoCodec mjpeg
VideoFrameRate 24
VideoSize 640x480
NoAudio
</Stream>
After that started server with command:
$ ffserver -d -f ffserver.conf
and run streaming with command:
$ ffmpeg -i "rtsp://<ip-camera>/" http://localhost:8090/webcam.ffm
Now you can input the URL in the webcam widget to play the M-JPEG stream:
http://localhost:8090/webcam.mjpg
These articles might be useful if you want to connect to Arduino using WiFi:
WiFi232 | Arduino |
---|---|
Pin 1 (GND) | GND |
Pin 2 (3.3V) | 3V3 (3.3V) |
Pin 5 (RX) | Pin 1 (TX) |
Pin 6 (TX) | Pin 0 (RX) |
Node.js – Pseudo Terminal (~/dev/ttyV0) – TCP Socket (10.0.1.12:8899)
socat
to fake a serial terminal:socat -d -d pty,nonblock,link=$HOME/dev/ttyV0 tcp:10.0.1.12:8899
node blink.js ~/dev/ttyV0
Source: https://github.com/fivdi/onoff/wiki/Node.js-v4-and-native-addons
Run apt-get update
to update the system’s package list:
sudo apt-get update
Install gcc/g++ 4.8 as below:
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
Check to see which versions of gcc/g++ are installed:
pi@raspberrypi ~ $ gcc --version
gcc (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pi@raspberrypi ~ $ g++ --version
g++ (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
It should now be able to install native addons with io.js v3 or Node.js v4 or higher.
If required, use the following commands to switch between the different version gcc/g++, like so:
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
If you’re running with OS X El Capitan (version: 10.11), and the installation fails with error ld: library not found for -lgcc_s.10.5
, check out the following ways:
cd /usr/local/lib
sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
Download and install the latest driver from https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver.
Before you can get started, you will need an Arduino UNO/Nano board based on the ATmega328P. Download the latest Grbl firmware from the Grbl repository, and flash Grbl to an Arduino.
If you don’t have an Arduino, check out grbl-sim and follow the instructions below to compile Grbl into an executable for your computer:
<repo>/grbl/
), like so:$ git clone git@github.com:grbl/grbl.git
$ cd grbl/grbl
$ git clone git@github.com:grbl/grbl-sim.git
$ cd grbl-sim
PLATFORM =
line.make new
to compile the Grbl sim. It will create an executable file named grbl_sim.exe
. See below:.
examples/grbl-sim/simport.sh
) to create a fake serial port (/dev/ttyFAKE
), and use it to test your Grbl interface software.cnc -c ~/.cncrc
to start the server. The configuration file should look like below:{
"ports": [
{
"comName": "/dev/ttyFAKE",
"manufacturer": "grbl-sim"
}
]
}
/dev/ttyFAKE
from the Connection widget to interact with the Grbl simulator as if connected to an Arduino with Grbl.cncjs 1.8 adds multi-account management support to enable secure web access and web socket connections. The web interface will automatically redirect user to the Sign In page when at least one user account has been enabled in Settings > Account.
If you forgot your password, find user account settings in the ~/.cncrc
file, and remove all existing users:
~/.cncrc
(e.g. /home/pi/.cncrc
)%USERPROFILE%\.cncrc
(e.g. C:\Users\User Name\.cncrc
)"users": []
Otherwise, you can also set the “enabled” attribute to a false value for all users to disable secure web access. For example:
"users": [
{
"id": "......",
"enabled": false,
"name": "admin1",
"password": "......"
},
{
"id": "......",
"enabled": false,
"name": "admin2",
"password": "......"
}
]
Navigate to http://webglreport.com/ to make sure your browser support WebGL.
If your browser does not support WebGL due to certain reasons, follow instructions below to enable WebGL: http://superuser.com/questions/836832/how-can-i-enable-webgl-in-my-browser
First, enable hardware acceleration:
Then enable WebGL:
You may got this error when using the GPIO serial device on the Raspberry Pi:
$ .npm/bin/cnc -vv
Started the server at http://0.0.0.0:8000/.
2016-07-17T12:13:40.292Z - error: [cncserver] Error opening serial port "ttyAMA0": err={}
Add a .cncrc
file under the login (home) directory (e.g. ~/.cncrc
) with the following configuration to specify the path /dev/ttyAMA0
:
{
"ports": [
{
"comName": "/dev/ttyAMA0",
"manufacturer": ""
}
]
}
Run cnc
again and you will see that /dev/ttyAMA0
is available to use:
If you still cannot connect to /dev/ttyAMA0
, use the serialport-terminal tool to check if a “Permission denied” error occurred:
$ node_modules/serialport/bin/serialport-terminal.js -p /dev/ttyAMA0 -b 115200
Error [Error: Error: Permission denied, cannot open /dev/ttyAMA0]
Follow these steps to fix the permission denied error:
dialout
group:$ sudo vim /etc/group
add add your login account if not available:
dialout:x:20:pi,<your_login_account>
/dev/ttyAMA0
from /boot/cmdline.txt
:The original contents
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait
and new contents
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline rootwait
/etc/inittab
by commenting out the following line:#T0:23:respawn:/sbin/getty -L ttyAMA0 115200 vt100
Checkout mjpg-streamer to learn how to stream JPEG data from the input_raspicam plugin via HTTP, and follow the steps in this article:
libv4l-0
package, available in Raspbian: sudo aptitude install libv4l-0
./dev/video0
file is available on Raspberry Pi, else the camera does not have a Linux driver or required extra configuration to work.mjpg-streamer
folder, where you extracted the tar.gz
file.mjpg-streamer.sh
file; this is a simple bash script to control the mini-webserver. The header contains some writable parameters, as refresh rate or resolution. The default settings should work in most situations../mjpg-streamer.sh
start command in the current folder.mjpg-streamer.log
file for debug info.See below required commands for not-Linux geeks:
$ sudo aptitude install libv4l-0
$ ls /dev/video0
$ wget http://www.bobtech.ro/get?download=36:mjpg-streamer-rpi
$ mv get\?download\=36\:mjpg-streamer-rpi mjpg-streamer-rpi.tar.gz
$ tar -zxvf mjpg-streamer-rpi.tar.gz
$ cd mjpg-streamer
$ sudo nano mjpg-streamer.sh
$ ./mjpg-streamer.sh start
Once you have finished setup, input the URL in the webcam widget to play the M-JPEG stream:
# Replace raspberrypi with your IP address
http://raspberrypi:8080/?action=stream
To change video parameters you have to install v4l2-ctl:
$ sudo apt-get install v4l-utils
$ v4l2-ctl --list-ctrls
$ v4l2-ctl --set-ctrl brightness=200
$ v4l2-ctl --set-ctrl saturation=32
http://www.howtoembed.com/get?download=36:mjpg-streamer-rpi
FFmpeg is available for Windows and Linux, but FFserver is available only on Linux.
Sample ffserver.conf
file:
HTTPPort 8090
<Feed webcam.ffm>
File /tmp/webcam.ffm
FileMaxSize 50M
</Feed>
<Stream webcam.mjpg>
Feed webcam.ffm
Format mpjpeg
VideoBufferSize 8000
VideoCodec mjpeg
VideoFrameRate 24
VideoSize 640x480
NoAudio
</Stream>
After that started server with command:
$ ffserver -d -f ffserver.conf
and run streaming with command:
$ ffmpeg -i "rtsp://<ip-camera>/" http://localhost:8090/webcam.ffm
Now you can input the URL in the webcam widget to play the M-JPEG stream:
http://localhost:8090/webcam.mjpg
These articles might be useful if you want to connect to Arduino using WiFi:
WiFi232 | Arduino |
---|---|
Pin 1 (GND) | GND |
Pin 2 (3.3V) | 3V3 (3.3V) |
Pin 5 (RX) | Pin 1 (TX) |
Pin 6 (TX) | Pin 0 (RX) |
Node.js – Pseudo Terminal (~/dev/ttyV0) – TCP Socket (10.0.1.12:8899)
socat
to fake a serial terminal:socat -d -d pty,nonblock,link=$HOME/dev/ttyV0 tcp:10.0.1.12:8899
node blink.js ~/dev/ttyV0
Source: https://github.com/fivdi/onoff/wiki/Node.js-v4-and-native-addons
Run apt-get update
to update the system’s package list:
sudo apt-get update
Install gcc/g++ 4.8 as below:
sudo apt-get install gcc-4.8 g++-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
Check to see which versions of gcc/g++ are installed:
pi@raspberrypi ~ $ gcc --version
gcc (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
pi@raspberrypi ~ $ g++ --version
g++ (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
It should now be able to install native addons with io.js v3 or Node.js v4 or higher.
If required, use the following commands to switch between the different version gcc/g++, like so:
sudo update-alternatives --config gcc
sudo update-alternatives --config g++
If you’re running with OS X El Capitan (version: 10.11), and the installation fails with error ld: library not found for -lgcc_s.10.5
, check out the following ways:
cd /usr/local/lib
sudo ln -s ../../lib/libSystem.B.dylib libgcc_s.10.5.dylib
Download and install the latest driver from https://github.com/adrianmihalko/ch340g-ch34g-ch34x-mac-os-x-driver.
Before you can get started, you will need an Arduino UNO/Nano board based on the ATmega328P. Download the latest Grbl firmware from the Grbl repository, and flash Grbl to an Arduino.
If you don’t have an Arduino, check out grbl-sim and follow the instructions below to compile Grbl into an executable for your computer:
<repo>/grbl/
), like so:$ git clone git@github.com:grbl/grbl.git
$ cd grbl/grbl
$ git clone git@github.com:grbl/grbl-sim.git
$ cd grbl-sim
PLATFORM =
line.make new
to compile the Grbl sim. It will create an executable file named grbl_sim.exe
. See below:.
examples/grbl-sim/simport.sh
) to create a fake serial port (/dev/ttyFAKE
), and use it to test your Grbl interface software.cnc -c ~/.cncrc
to start the server. The configuration file should look like below:{
"ports": [
{
"comName": "/dev/ttyFAKE",
"manufacturer": "grbl-sim"
}
]
}
/dev/ttyFAKE
from the Connection widget to interact with the Grbl simulator as if connected to an Arduino with Grbl.