Skip to content

Manual Installation (RasPi)

Claudio Prezzi edited this page Jan 12, 2022 · 27 revisions

Start from a clean image of Raspbian Buster or Bullseye, on a Raspberry Pi 2, 3 or 4 (should also work with Jessie)

Install Node 12.x

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
apt-get install -y nodejs

Confirm you have the correct Node and npm version

node -v

NodeJS version should be >= 12.22.5 (and < V13!)

npm -v

NPM version should be >= 6.14.15

Install/update git

sudo apt-get update
sudo apt-get install git

Download LaserWeb

cd /home/pi
git clone https://github.com/LaserWeb/lw.comm-server.git
cd lw.comm-server
npm install

Manually start the server

cd /home/pi/lw.comm-server
node server.js   

You should get the following console response:

***************************************************************
        ---- LaserWeb Comm Server 4.1.000 ----
***************************************************************
  Use  http://192.168.1.100:8000 to connect this server.

* Updates:
  Remember to check the commit log on
  https://github.com/LaserWeb/lw.comm-server/commits/master
  regularly, to know about updates and fixes, and then when ready
  update accordingly by running git pull

* Support:
  If you need help / support, come over to
  https://plus.google.com/communities/115879488566665599508
***************************************************************

Press CTRL-C to stop the server. Now that you know it's working, you can setup the autostart of the service.

Setup Systemd to automatically start the server

# Move to the directory with the .service file
cd ~/lw.comm-server/

# Create the symlink
sudo ln -s `pwd`/lw.comm-server.service /etc/systemd/system

# Reload the service files so the system knows about this new one
sudo systemctl daemon-reload

# Enable and start the service
sudo systemctl enable lw.comm-server.service
sudo systemctl start lw.comm-server

You can check the status of the server with

sudo systemctl status lw.comm-server

You can restart the server with

sudo systemctl restart lw.comm-server

You can stop the server with

sudo systemctl stop lw.comm-server

(The logs will get added to /var/log/syslog)

Install & start the frontend

Install the LaserWeb4 executable on your Windows, OSX or Linux PC. This way you get the lastest frontend version.

    Connect your machine to one of the USB ports
    Start the LaserWeb4 app
    Click on Comms tab
    Click on "Server Connection"
    Change Server-IP to `RasPi-IP:8000`  (replace RasPi-IP with the IP of your RasPi)
    Click connect

-> You should see a green message "Server connected" in the log area at bottom right.

Alternatively you can use the frontend without installing the executable (older version):

    Connect your machine to one of the USB ports
    Open Chrome (or Chromium) on any PC in your network.
    Open URL `RasPi-IP:8000`  (replace RasPi-IP with the IP of your RasPi)
    Click on Comms tab
    Click on "Server Connection"
    Change Server-IP to `RasPi-IP:8000`  (replace RasPi-IP with the IP of your RasPi)
    Click connect

-> You should see a green message "Server connected" in the log area at bottom right.

Then:

    Set the "Machine Connection" dropdown to USB
    Choose the correct serial port in the "USB / Serial Port" dropdown (ex. /dev/ttyACM0)
    Check that the baud rate is set to 115200
    Click connect below

-> You should get a green message "Machine connected" in the log area, followed by a green line with the detected firmware. If you get some red messages insted of the green firmware line, you probably have selected the wrong port or the firmware is not supported.

Reset on connect

Some boards need a reset command after connecting (or will disconnect after a few seconds). To do that, you have to create a file called ".env" (nothing in front of the dot!) in the installation folder of the server with the following content:

RESET_ON_CONNECT=1