Sources of information used in this tutorial:
My writeup on getting the WaveShare LCD and touchscreen digitizer to work
BillyBlaze's Boot to Browser
kusti8's guide to installing Chromium on Raspberry Pi
You will need these parts:
- Raspberry Pi 3
- WaveShare 800x480 HDMI Touch Screen
- 2.5-amp USB power supply
- A MicroSD card with 4GB or greater capacity. I think there's a Raspberry Pi MicroSD card hardware compatibility list somewhere.
OctoPi Setup
====================================
Follow the steps on this page. There, you can download a version of Raspbian that has had OctoPrint and some extras (webcam, etc.) built in. Skip the "Installing from source" section.
Please note: Some tutorials tell you that you need to 'sudo raspi-config' and then have it expand the filesystem. The OctoPi distribution does that for you automatically, so there's no need!
After the image is done flashing to your SD card - which will take a LONG time - open the 'boot' partition and find the file: config.txt
Delete EVERYTHING in it, and replace with the following (you may have to scroll to see all of this):
Code: Select all
disable_overscan=1
framebuffer_width=800
framebuffer_height=480
hdmi_force_hotplug=1
hdmi_group=2
hdmi_mode=1
hdmi_mode=87
hdmi_cvt 800 480 60 6 0 0 0
max_usb_current=1
dtparam=i2c_arm=on
dtparam=i2s=on
dtparam=spi=on
dtparam=audio=on
start_x=1
gpu_mem=128
dtparam=spi=on
dtparam=i2c_arm=on
dtoverlay=w1-gpio
#device_tree_overlay=w1-gpio-pullup=on
#device_tree_param=gpiopin=4
#device_tree_param=extpullup=1
device_tree_overlay=ads7846
device_tree_param=cs=1
device_tree_param=penirq=25
device_tree_param=penirq_pull=2
device_tree_param=speed=50000
device_tree_param=keep_vref_on=0
device_tree_param=pmax=255
device_tree_param=xohms=150
device_tree_param=xmin=200
device_tree_param=xmax=3900
device_tree_param=ymin=200
device_tree_param=ymax=3900
Once you're done with all that, safely unmount/eject the SD card, put it into the slot on the bottom of the Pi, and plug in the power supply. You should get a boot screen that looks like this:
If you see a bunch of static looking stuff on the right side of the screen, it's because something went wrong with editing config.txt. If what you see is just like the above image, you did it right!
NOTE: The first time you boot the OS on your Pi, it will run a bunch of "first boot" tasks that will make it take awhile to finish booting. Subsequent booting should complete in well under a minute!
Once the Pi is done booting, you will need to bring it up in a browser. The OctoPrint interface should pop up a window asking you to specify a username and password for access control. Either set that up, or tell it to skip that. Please note that if you set up access control, it will apply to the touchscreen along with any other Web client, meaning that it will be read-only unless you log in through the touch screen.
After you choose what to do about access control, the interface will probably tell you that there's a new version of OctoPrint available, and ask whether to update. Say Yes. This will take a few minutes, and then OctoPrint will restart.
After it's done restarting, the OctoPrint interface will ask you to reload. Once that's done, click Settings -> Plugin Manager -> Get More. From that screen, you can install Touch UI. Do so. It will tell you that you need to restart OctoPrint before the plugin will work. Click System -> Restart OctoPrint -> Proceed.
Set up & calibrate the touchscreen
====================================
Log into your Pi according to the instructions on the OctoPrint site that I linked above. Then, do this:
Code: Select all
sudo -s
aptitude install libts-bin
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/fb0
ts_calibrate
Reboot the Pi:
Code: Select all
sudo init 6
Code: Select all
sudo -s
export TSLIB_TSDEVICE=/dev/input/event0
export TSLIB_FBDEVICE=/dev/fb0
ts_test
Set up boot-to-browser
====================================
In the Pi terminal, do this:
Code: Select all
wget -qO - http://bintray.com/user/downloadSubjectPublicKey?username=bintray | sudo apt-key add -
echo "deb http://dl.bintray.com/kusti8/chromium-rpi jessie main" | sudo tee -a /etc/apt/sources.list
apt-get update
apt-get install --no-install-recommends xinit xserver-xorg xserver-xorg-video-fbdev x11-xserver-utils matchbox unclutter
apt-get install chromium-browser rpi-youtube -y
Once everything finishes installing, do this:
Code: Select all
nano /usr/share/X11/xorg.conf.d/99-fbdev.conf
Code: Select all
Section "Device"
Identifier "myfb"
Driver "fbdev"
Option "fbdev" "/dev/fb0"
EndSection
Allow X11 to run as anybody:
Code: Select all
sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
Press Ctrl+D to log out of root, which will return you to normal user mode, causing your prompt to look like "pi@octopi:~ $"
Now, get the Touch UI boot files, and install them so the system boots directly into the browser:
Code: Select all
git clone https://github.com/BillyBlaze/OctoPrint-TouchUI-autostart.git ~/TouchUI-autostart/
sudo cp ~/TouchUI-autostart/touchui.init /etc/init.d/touchui
sudo chmod +x /etc/init.d/touchui
sudo cp ~/TouchUI-autostart/touchui.default /etc/default/touchui
sudo update-rc.d touchui defaults
Finally, reboot your Pi:
Code: Select all
sudo init 6
About twenty seconds later, you should see OctoPrint's status screen (machine status, file, timelapse, etc.) The tabs and menu are all at the top of the screen. Scrolling is done by dragging a fingertip or stylus up/down on the screen. You won't need to scroll much, if ever. If you use the on-screen terminal, be advised that the terminal screen itself is scrollable, and it can be a little tricky to scroll back to the top of the screen and access the different tabs.
Connect to your Raspberry Pi according to the instructions linked above, set an access password when prompted, then click Settings and tell OctoPrint everything it needs to know about your printer. See the section below if you're connecting to a RAMBo.
I'm working on a printable enclosure for this. Stay tuned.
Connecting to a RAMBo
====================================
I recently got an Eris, which uses the RAMBo Mini controller. I found that at first, the temperature updates only came once a minute or so. That's no good! I went into Settings -> Features and enabled the following:
- Send a checksum with every command
- Support TargetExtr%n/TargetBed target temperature format
- Disable detection of external heatups
I've also been using OctoPi with a Smoothieboard for the last month or so, and it isn't necessary to turn on any of these options. Additionally, OctoPi connects to my Smoothieboard automatically when it starts, but it never seems to do this successfully with my Eris' RAMBo. You'll need to tap the system menu (3 horizontal bars, top left), then tap Connection, verify everything's correct, then tap Connect. It will take a moment. After that, the system menu icon will flash green a few times, and you should have access to the movement controls on the tab with the joypad icon.
Homing
====================================
There are two home icons on the Control tab (joypad icon). The first will only tell the printer to move to homed position, which is useful for Cartesian systems, but not for Deltas. Instead, click the home icon between the up and down arrows. That sends G28, and homes the printer properly.
Shutting Down
====================================
DO NOT!!! just unplug your Raspberry Pi. It's running Linux, a full-fledged operating system. As such, it needs to be shut down properly! Tap the system menu (three horizontal bars, top left), then tap System, then Shutdown, then Proceed. If you screw this up, there's a risk that you may corrupt the SD card, at which point you'd have to reinstall the image and start this tutorial from scratch. Fortunately, Raspbian uses a journaling filesystem. If there's an accidental power loss, you'll probably be OK.