v1pi: Raspberry Pi Image with Octoprint and CNC.js (and wifi hotspot)

I didn’t mean to imply anything. I was only trying to mention that Windows’ inability to read the Linux filesystem is not a good indicator that the card was corrupt.

At any case, the user looks to have gotten past that issue.

You’re right. It’s hard to tell tone from text, but I wasn’t offended. It may have been that some of the reports are because people thought it was corrupt from the start.

I was just trying to say that it is a real problem, although not everyone here will agree on the magnitude.

1 Like

Hi. Im new here and a newbee with pi stuff. I have download the image. Work fine to me wit an additional Notebook an browser access. Im want to have a touchscreen on the raspberry, so that i dont need an additional device. But if i run the pi with Touchscreen i see following screen

Is it possible to show the browser screen on the pis Touchscreen?

I mean this screen on my pis Touchscreen

Yes. The image does have a desktop environment installed. At a minimum, you’ll need to install that, and use raspi-config to make it choose to boot to the desktop at startup. After that, you can install google chrome and then start that up in kiosk mode, pointing to http://localhost.

I think someone made instructions for this somewhere. Let me see if I can find them. Otherwise, you’ll have to wait for me to get time to test the commands myself.

Glad you got the screen working, at least. That can sometimes be another challenge.

Here are the instructions I was thinking. This person also installed the tinyweb pendent in cnc.js, which you may not want:

Oh that looks fun!

1 Like

Nice, but I think these instructions are a bit outdated.

Here is my approach:

Upgrade you pi with:

sudo apt update && sudo apt upgrade && sudo apt dist-upgrade -y

Install packages:

sudo apt-get install --no-install-recommends xserver-xorg -y
sudo apt-get install --no-install-recommends xinit -y
sudo apt-get install raspberrypi-ui-mods -y
sudo apt-get install chromium-browser -y
sudo apt-get install unclutter -y

Use raspi-config to set boot into Desktop with autologin

sudo raspi-config
3 Boot options
B1 Desktop / CLI
B4 Desktop Autologin

disable screensaver

sudo nano /etc/xdg/lxsession/LXDE-pi/autostart

for Raspberry Pi 3 and lower add

@xset s off 
@xset -dpms

for Raspberry Pi 4 add

@xset s off
@xset dpms 0 0 0

create the folder autostart in .config

mkdir /home/pi/.config/autostart

create a file kiosk.desktop

nano /home/pi/.config/autostart/kiosk.desktop

add

[Desktop Entry]
Type=Application
Name=Kiosk
Exec=/home/pi/kiosk.sh
X-GNOME-Autostart-enabled=true

Create kiosk script:

nano /home/pi/kiosk.sh

#!/bin/bash
 
# Run this script in display 0 - the monitor
export DISPLAY=:0

# Hide the mouse from the display
unclutter &
 
# If Chrome crashes (usually due to rebooting), clear the crash flag so we don't have the annoying warning bar
sed -i 's/"exited_cleanly":false/"exited_cleanly":true/' /home/pi/.config/chromium/Default/Preferences
sed -i 's/"exit_type":"Crashed"/"exit_type":"Normal"/' /home/pi/.config/chromium/Default/Preferences
 
# Run Chromium and open tabs
/usr/bin/chromium-browser --kiosk http:localhost:8000/pendant &
 
# Start the kiosk loop. This keystroke changes the Chromium tab
# To have just anti-idle, use this line instead:
# xdotool keydown ctrl; xdotool keyup ctrl;
# Otherwise, the ctrl+Tab is designed to switch tabs in Chrome
# #
while (true)
do
xdotool keydown ctrl+Tab; xdotool keyup ctrl+Tab;
sleep 15
done

Download tinyweb (check latest version on Releases · cncjs/cncjs-pendant-tinyweb · GitHub)

wget https://github.com/cncjs/cncjs-pendant-tinyweb/archive/v1.2.4.zip

Unzip and move

unzip v1.2.4.zip

sudo mv /home/pi/cncjs-pendant-tinyweb-1.2.4 /home/tinyweb

Change startscript for CNCJS

sudo nano /etc/default/cncjs

change

DAEMON_ARGS="--host=$HOST --port=$PORT" 

to

DAEMON_ARGS="--host=$HOST --port=$PORT -m /pendant:/home/tinyweb/src"

Reboot your PI

Using a 320 px wide screen?
Since Chromium can’t get narrower than 350 or so pix, you need to alter the css for tinyweb

nano /home/tinyweb/src/css/theme.css

Add:

body {
    margin-right: 20px;
}

Hope this helps someone :wink:

4 Likes

Anyone have any useful custom commands to add to the side bar of cncjs?

How about

sudo shutdown - h now

:wink:

1 Like
sudo rm -rf /

:japanese_goblin: j/k, don’t do it. Ever.

1 Like

You don’t want a space between the - and the h. Restart is also nice:

sudo shutdown -h now
for restart:
sudo shutdown -r now

restarting cnc.js:
sudo service cncjs restart

These are different than Macros, which are sent to Marlin.

I will add, for anyone who is interested, that most sudo commands will not work. shutdown and service have been configured for skipping the password prompt. The server runs as pi user.

You’re right, I configged sudoers to always accept sudo commands from user pi without password…

1 Like

Happy Dutch phone autocorrect… :blush:

1 Like

I guess I meant Macro’s then, I have some set up for common position locations when i have repeatable task, parking position, spindle on/off, disable steppers, I’ll take a picture when I can

1 Like

Hi All,
now that I have made some chips, I want to add octoprint and CNC.js. I am familiar with octoprint from the 3D printer side of things, is there a reason to use pi 4 over 3B?

I see the 4 comes with various amounts of memory. is it safe to assume 4 gb is overkill?

I have used both. The 4 supposedly needs active cooling, but I haven’t had trouble with the one I have that doesn’t. These services are not crushing the pi. It will even work on a zero, although, I don’t recommend it. I assume you mean 3B+.

1 Like

thanks Jeff,

yes, 3B+. I put a fan on m pi for the ender3, and I think that helped keep it from skipping steps, but that could have been something else too.

thanks again
Ben

ok, Pi ordered , SD flashed… that was easy.

BIG THANKS TO JEFF!

3 Likes

I’m using a raspberry pi cnc hat to control my machine, using cncjs. I want to use octoprint with the better Grbl plugin. Will your image work for this? Thanks